cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1776
Views
2
Helpful
8
Replies

Translation Pattern Stripping off site code

gearbox
Level 1
Level 1

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?

Gear Misner
HyeTech Network & Security, LLC
@collabcowboy
8 Replies 8

Jeffrey Ness
Level 1
Level 1

I think you should be able to use a forward-digits 3 to just forward the last 3 digits.

Can you do that on a voice dial-peer?  Let me log in and check really quick...

Gear Misner
HyeTech Network & Security, LLC
@collabcowboy

Yeah that option is not availiable on a voip dial-peer unless its called something else.

Gear Misner
HyeTech Network & Security, LLC
@collabcowboy

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

mustafa_baig
Level 4
Level 4

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

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?

Gear Misner
HyeTech Network & Security, LLC
@collabcowboy

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

Thank you sir!  You are a gentleman and a scholar

Gear Misner
HyeTech Network & Security, LLC
@collabcowboy
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: