Voice Translation Rules… The Rules

Voice Translation Rules… The Rules

#1 Replace
Rule 1 /123/ /456/  ->  123  =  456

#2 replace any start occurance
Rule 1 /^123/ /456/   ->   123456  =   456 456
123          =    456

#3 Match Exact Number
Rule 1 /^123$/ /456/   -> 123        =     456
1234      =  No Match

#4 Any 5 digits beginning with XX
Rule 1 /^12…/ /0121/     12    =   0121

#5 Replace All numbers
Rule 1 /.*/ /0121/       *        =              0121

#6 replace all except null
Rule 1 /.+/ /0121/      123         =              0121
#7 replace start number that begins with 0 (and combinations e.g.00)
Rule 1 /^0+/ /909/     0123   =   909123
00123  =  090123
123      =  No Match

              =              Slice
              =              in replacement indicates what to keep
( )            =              Indicates what to keep
(a)          =              Keep ‘a’
b            =              ignore ‘b’
l              =              copy first into replacement number

e.g.
/ (x)          y            (z)          / / w12      /
rule 1 /^ (12) 3 (45) $ /      /412/     ->   12345    =              41245
Rule 1 /^2 (…$) /    / 01211234 1  /    ->   2001       =              01211234001

Reject Calls
Rule 1 reject /^1234/

Apply Rules

Voice Translation-rule 1
Rule 1 /123/ /456/
Voice Translation-profile CALLING_PROFILE
Translate calling 1

Dial-peer voice 1 pots
Translation-profile outgoing              CALLING_PROFILE

More Examples

Rule 1 /^.*/ (..)    /1/                                                              = 12345 = 45
Rule 2 /^ (01…) – (…….?$)/     /123/                       = 01208-333444   =  01208333444
Rule 3 /^ (0[12]..) – (…) – (….$)/   /123/      = 0208-123-4567  =  02081234567

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s