Number replacement

Number replacement - is the process of replacement of callee or caller ID using certain configured rules.
Replacement patters are configured on peers (see Peer types) and should be in format of Regex patterns.

Number replacement during routing

Number replacement is performed automatically during Routing (more detailed see chapter Routing).
In this mode there is no need to configure in Call handler anything else additionally.

Number replacement for inbound call

Automatic number replacement for inbound call uses following algorithm.

In case if inbound peer has been configured to perform Number replacement, the system tries to substitute numbers (caller ID or callee ID) according to rules.
After number replacement system uses replaced numbers to perform routing by destination code and Billing.
Usually number replacement is used to trim technical prefixes in order to bring numbers to E.164 format to perform correct billing.

In case if rules are configured in a way, that system can't perform substitution, then routing is stopped.
This feature could be used to pass only some specific sets of callee or caller IDs.
In case if you want to replace specfic numbers, and others topass without changes, you need to add wldcard substitution .* -> & at the end.
More in detail this substitution is explained in section Regex patterns.

In case if there is no rules for number replacement, it's assumed that routing would be done without number replacement.

Number replacement for outbound call

Automatic number replacement for outbound call uses following algorithm.

In case if outbound peer has been configured to perform Number replacement, the system tries to substitute numbers (caller ID or callee ID) according to rules.
After number replacement system uses replaced numbers to generate outbound call.
Usually number replacement is used to add technical prefixes in order to E.164 numbers.

In case if rules are configured in a way, that system can't perform substitution, then route to this peer is not included to routing table.
You can use this feature to pass only some specific sets of callee or caller IDs to terminating peer.
In case if you want to replace specfic numbers, and others topass without changes, you need to add wldcard substitution .* -> & at the end.
More in detail this substitution is explained in section Regex patterns.

In case if there is no rules for number replacement, it's assumed that generation of outbound call will be done without number replacement.

Number replacement without routing

In all other cases to perform number replacement according to configured rules from Call handler you should use application Replace.
In this case you could manually configure the order of number replacement while handling call.
Application Replace could be used together with instruction Changing А-number from call handler.

Billing.

In order for numbers to pass to billing in correct format, during manual configuration you should specify, which exact numbers are stored in billing.
Real callee/caller IDs are always stored in CDR (fields real caller ID and real callee ID in Call detail report).
Callee/caller IDs, which are used for Billing (fields caller ID and callee ID in Call detail report) by default are set to the same values as real ones.
In order to change them use function CDR and application Set.
Add Set with next values:

name value
CDR(__CALLER_ID)
А number
CDR(__CALLEE_ID)
B number

Here, A and B numbers - numbers, which would be used for billing and will be stored in fields caller ID and callee ID in Call detail report.
Insert this code before call of Dial in any point of call handling.
Double underscore is needed for variable to be transferred to outbound call and to be stored in outbound CDR.

Русский перевод