Voice Translation Rules in Media Gateways
Voice Translation Rule is a key part in the Voice Gateways which helps you to translate the Calling Number, Called Number and the
Plan type customized for your customers / partners while sending or recieving calls in the gateway.
This document helps you to create the Voice Translation Rules for configuring the Calling and Called Dial patterns and plans specific for
National and International dialing plans. There are examples given for changing the Number type and plan and Rejecting calls.
Example 1
This example replaces the first occurrence of the number “123″ with “456″.
voice translation−rule 1
rule 1 /123/ /456/
These are test voice translation−rule examples:
router#test voice translation−rule 1 123
Matched with rule 1
Original number: 123 Translated number: 456
router#test voice translation−rule 1 1234
Matched with rule 1
Original number: 1234 Translated number: 4564
router#test voice translation−rule 1 6123
Matched with rule 1
Original number: 6123 Translated number: 6456
router#test voice translation−rule 1 6123123
Matched with rule 1
Original number: 6123123 Translated number: 6456123
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
In this example, the rule matches the first occurrence of the number that contains the pattern “123″ anywhere
in the number. Specifically, you can use the start and end of number indicators. The Example 2 and Example
3 sections show this.
Example 2
This example shows how to replace any occurrence of “123″ at the start of a number with “456″.
voice translation−rule 1
rule 1 /^123/ /456/
These are test voice translation−rule examples.
router#test voice translation−rule 1 123
Matched with rule 1
Original number: 123 Translated number: 456
router#test voice translation−rule 1 1234
Matched with rule 1
Original number: 1234 Translated number: 4564
router#test voice translation−rule 1 6123
6123 Didn’t match with any of rules
Example 3
If you want only the match of an exact number, specify both the start and end number indicators:
voice translation−rule 1
rule 1 /^123$/ /456/
router#test voice translation−rule 1 123
Matched with rule 1
Original number: 123 Translated number: 456
router#test voice translation−rule 1 1234
1234 Didn’t match with any of rules
router#test voice translation−rule 1 6123
6123 Didn’t match with any of rules
Example 4
This example replaces all numbers with “5554000″.
voice translation−rule 2
rule 1 /.*/ /5554000/
router#test voice translation−rule 2 123
Matched with rule 1
Original number: 123 Translated number: 5554000
router#test voice translation−rule 2 86573
Matched with rule 1
Original number: 86573 Translated number: 5554000
router#test voice translation−rule 2 “”
Matched with rule 1
Original number: Translated number: 5554000
Example 5
This example replaces any number that starts with a combination of zeros (0, 00, and so forth) with “909″.
voice translation−rule 5
rule 1 /^0+/ /909/
router#test voice translation−rule 5 0123456
Matched with rule 1
Original number: 0123456 Translated number: 909123456
router#test voice translation−rule 5 00123456
Matched with rule 1
Original number: 00123456 Translated number: 909123456
NUMBER TYPE AND PLAN TRANSLATION
Example 1
In this example, if a number starts with “4″ and the type is “national”, the rule adds “90″ as a prefix. If the
type is “international”, the rule adds “900″ as the prefix.
voice translation−rule 7
rule 1 /^4/ /904/ type national national
rule 2 /^4/ /9004/ type international international
router#test voice translation−rule 7 493456567 type national
Matched with rule 1
Original number: 493456567 Translated number: 90493456567
Original number type: national Translated number type: national
Original number plan: none Translated number plan: none
router#test voice translation−rule 7 493456567 type international
Matched with rule 2
Original number: 493456567 Translated number: 900493456567
Original number type: international Translated number type: international
Original number plan: none Translated number plan: none
This is useful when telephone companies (Telcos) remove access codes on national and international
numbers. You can add the correct prefix with the number type as a basis.
Example 2
This example changes the number type and plan.
voice translation−rule 8
rule 1 /^2\(…$\)/ /01779345\1/ type unknown national plan unknown isdn
This rule matches any four−digit number that starts with “2″. The rule removes the “2″, adds the number
“01779345″ as a prefix, and sets the plan to “isdn” and the type to “national”.
router#test voice translation−rule 8 2001 type unknown plan unknown
Matched with rule 1
Original number: 2001 Translated number: 01779345001
Original number type: unknown Translated number type: national
Original number plan: unknown Translated number plan: isdn
Reject Calls
Use the reject keyword to reject calls that match. This example rejects all calls that start with “234″.
rule 1 reject /^234/
router#test voice translation−rule 10 1234
1234 Didn’t match with any of rules
router#test voice translation−rule 10 2345
blocked on rule 1