Pages

Sunday, December 5, 2010

Voice Translation Madness

Voice Translations


Ahhh the world of VOIP has finally come back to me, I'm adjusting to the new life, but I love being back in the technology. A few days back I received an interesting ticket on some voice translations that needed to be done for a customer. This was on a CME so using called and calling number translations weren't available to me as they would be in CUCM. There is an interesting story about that, that will be saved for another post later. So pretty much this customer wanted all inbound numbers to have a 9(off net call local) or a 91(off net long distance) added to them, so when a customer went into their directory, they don't have to edit the number to make a call, they can just dial it. Also when certain extensions dial out they wanted a few of the users DID to show instead of the main line number. Easy day, Well obviously if I'm writing a post this wasn't an easy ticket. First a quote that I follow. "Before we design a solution, it's often useful to define the problem to be solved" That is from the famous Radia Perlman. I had the problem in right? Well yes I needed to punch some code down and move on to the next ticket, but my approach was a little shaky. What I actually did is below and experienced guys will see the mistake.


1st thing I did was jump straight to the translations. I added my forward slashed and added the numbers to catch. I added my forward slashed put in the extensions to have their DID and then in the next set added the first numbers and \0/ at the end it to go back to set 0. EASY. Hell I even tested it out


router#test voice translation-rule 1 4127
Matched with rule 1
Original number: 4127 Translated number: 2025304127

Ok onto the next one

Rule was a carryover from the previous config so I left it in place. Next one are the area codes that need to get a 9 added. We live in a large area so we have several local area codes

/^302/ That means begins with so I can have a 302 later in the set, but it won't mach cause it has to begin with 302.


/\(.*\)9302\1/ This gets a little funky we have the first forward slash to indicate start of a match, but then we add a back slash "\" and it indicates a number slice the "(" indicates match numbers to keep, the "." indicates any digit, and the "*" indicates match none more numbers, which pretty much means everything we add in a ")". We add the translation to prepend a "9302" and we close it all then we add a "\1/" to indicate match set 1 which is ".*". So with all that anyone that dials in with a 302 number the number will show as a 9302 number in the directory of inbound calls. Even ran a test on this

router#test voice translation-rule 2 3025128425
Matched with rule 1
Original number: 3025128425 Translated number: 93025128425

The one for long distance numbers is pretty much the same. We are doing a catch all in the 1st match adding a "91" and matching the inbound number with set 0. So what did I do wrong? I tested it right. Well I tested it on the command line and not with a inbound call or having the customer make a outbound call based on me calling in. That's the clue I'll give. The config and where I applied it is all below.




voice translation-profile inbound
translate called 2
!
voice translation-profile outbound
translate calling 1


!
voice translation-rule 1
rule 1 /4127/ /202530\0/
rule 2 /4153/ /202530\0/
rule 3 /4151/ /202530\0/
rule 4 /4156/ /202530\0/
rule 5 /4160/ /202530\0/
rule 6 /4161/ /202530\0/
rule 7 /^.*/ /2025303180/

voice translation-rule 2
rule 1 /5858/ /5002/
rule 2 /^302/ /\(.*\)9302\1/
rule 3 /^401\(.*\)/ /9401\1/
rule 4 /^671\(.*\)/ /9671\1/
rule 5 /^803\(.*\)/ /9803\1/
rule 6 /^340\(.*\)/ /9340\1/
rule 7 /^.*/ /91\0/

No comments:

Post a Comment