03-11-2011 10:06 AM
Hey guys,
I am having an issues stripping of a site code using a translation pattern. Here is what I have.
Interside Dialing Code = 4
Side Codes = (1-9) Small company
Extensions = 3 digits (I know I know It should be 4, but they like 3 digits)
Example Dial-Peer
dial-peer voice 4000 voip
description [Interoffice Access Code to NJ]
destination-pattern 42...
session protocol sipv2
session target ipv4:10.3.10.1
dtmf-relay sip-notify
codec g711ulaw
no vad
Now I need a translation pattern to strip of the 4 and the 2 and keep the three digits... Any Ideas?
03-11-2011 10:09 AM
I think you should be able to use a forward-digits 3 to just forward the last 3 digits.
03-11-2011 10:44 AM
Can you do that on a voice dial-peer? Let me log in and check really quick...
03-11-2011 10:45 AM
Yeah that option is not availiable on a voip dial-peer unless its called something else.
03-11-2011 11:05 AM
I wasn't sure if it was an option for the voip dial peers as not. I don't have my translation pattern examples handy, but looking at the Dial Peer Configuration for Voice Gateways document, you should be able to do this with similar:
Create the translation rule with whatever translation-rule number suits you (matching the dial peer number may be a good scheme if you are going to have several, one per site code) and define 10 rules with ^ being the beginning of the string and then digits to match followed by digits to replace that portion with (so rule 0 replaces 420 when it occurs at the beginning with just the 0 effectively stripping the 42)
translation-rule 1
rule 0 ^420 0
rule 1 ^421 1
rule 2 ^422 2
rule 3 ^423 3
rule 4 ^424 4
rule 5 ^425 5
rule 6 ^426 6
rule 7 ^427 7
rule 8 ^428 8
rule 9 ^429 9
Apply the translation-rule to the VOIP dial peer:
dial-peer voice 4200 voip
translate-outgoing called 1
{where 1 is the translation-rule number used above}
HTH
03-11-2011 02:33 PM
Only POTS dialpeers strip digits.
Here is example of the rule that you can use
!
voice translation-rule 1
rule 1 /^42\(...\)/ /\1/
!
!
voice translation-profile STRIP-42
translate called 1
!
dial-peer voice 4000 voip
translation-profile outgoing STRIP-42
description destination-pattern 42...
session protocol sipv2
session target ipv4:10.3.10.1
dtmf-relay sip-notify
codec g711ulaw
no vad
HTH
Mustafa Baig
03-13-2011 05:02 PM
Mustafa,
I like the way you did this because I only have to use one translation pattern. I have just one question, in looking at your translation pattern what does the "1" mean? Is that just a place holder for the number splice?
03-13-2011 05:24 PM
The "\1" points to the first set of digits that we are matching with "\(...\)". So basically the rule says that match any string that starts with 42 and make a set of 3 digits right after that. Then replace the string with the first set only.
So if we were to do /^42\(.\)\(.\)\(.\)/ , that will give us three sets of single digit each (captured by the ".") and then can reference to them in the replacement string as /\1\2\3/ or manipulate it anyway you like.
Here is a reference from cisco.com http://www.cisco.com/en/US/tech/tk652/tk90/technologies_configuration_example09186a00803f818a.shtml#c2
Mustafa Baig
03-13-2011 05:58 PM
Thank you sir! You are a gentleman and a scholar
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide