cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
964
Views
0
Helpful
3
Replies

Dial peer RegEx and translation driving me nuts!

UrbanPeasant
Level 1
Level 1

By the end of laying this out for smart people to read and possibly be able to help with, I might land on my own answer, if not, I'll click 'Post'.

 

Working on the principle of having one dial peer to receive an inbound call to our CUBE, and another to then send that call outbound (be this inwards from PSTN and outwards to CUCM, or vice versa) and applying translations to make our dial plan work, I'm generally fairly happy with working with dial peers, translations and the kind of regex involved.

 

Presently I'm trying to use a single dial peer to pick up calls from an upstream SBC that is sending in everything prefixed with +44 . The number received may be either a full E.164 presentation, or our internal 5 digit extension prefixed with +44 (e.g.  +44152459521B or +4495219). I then need to send the calls destined for us internally outwards to CUCM on one dial peer, and the calls destined for the PSTN outwards to our ITSP on another dial peer. Through the use of translation rules and an incoming profile attached to the receiving dial peer I thought this should be perfectly possible. But it seems I've fallen into a hole somewhere.

 

With the below config an incoming call to +4495219 succeeds, but a call to +44152495219 fails. For the same reason a call to a large part of the UK national PSTN fails too, and the translation debug clearly shows why. Our mobile networks begin with 7 (+447………) so those calls work, along with call to numbers not matched by the xlate rule.

 

At first I thought that my translation rule would work to match only the incoming +44 and the 5 digit extension dial , and stop, but it simply matches any 5 numbers with anything following them. So my thinking was wrong and I stand corrected.

 

Is there a way I can get the RegEx changed to match only 5 numbers and stop, or update the rule(s) to get round my problem?

It might be the case that I have forget about the xlate, create another dial peer to match the short dialed number by destination pattern \+44[19][02-5]... , send it in to CUCM, and create a new translation profile there to drop +44. Perhaps I'm over-complicating things on the CUBE.

 

voice translation-rule 7

rule 1 /^\+44\([19][02-5]...\)/ /+4415245\1/

voice translation-profile NORMALISE+44

translate called 7

!

dial-peer voice 22 voip

description *INBOUND from UPSTREAM SBC*

translation-profile incoming NORMALISE+44

preference 1

session protocol sipv2

incoming called-number +44.%

codec g711alaw

no vad

!

dial-peer voice 23 voip

description *LANSide OUTBOUND to CUCM*

destination-pattern +441524[56][1569][0123457]...

session protocol sipv2

session target ipv4:10.42.18.72

codec g711alaw

no vad

!

dial-peer voice 24 voip

description *WANSide OUTBOUND to PSTN*

destination-pattern +44T

session protocol sipv2

session target ipv4:88.215.63.165

voice-class sip early-offer forced

codec g711alaw

no vad

 

 XLATE WORKING AS EXPECTED:

debug translate detail

767633: Jan 22 09:37:24.939: xrule_checking

767634: Jan 22 09:37:24.939: xrule_checking calling +44152451100A, called +4495219

767635: Jan 22 09:37:24.939: xrule_checking peer_tag 22, direction 1, protocol 3

767636: Jan 22 09:37:24.939: h323_xrule

767637: Jan 22 09:37:24.939: h323_xrule

767638: Jan 22 09:37:24.939: xrule_checking Return rc = -4

767639: Jan 22 09:37:24.939: xrule_checking

767640: Jan 22 09:37:24.939: xrule_checking calling +44152451100A, called +44152459521B

767641: Jan 22 09:37:24.939: xrule_checking peer_tag 23, direction 2, protocol 3

767642: Jan 22 09:37:24.939: xrule_checking Return rc = -5

 

show call active voice brief

2895 : 3289336 -2023979800ms.1 (09:37:24.931 UTC Wed Jan 22 2020) +3370 pid:22 Answer +44152451100A connected

2895 : 3289337 -2023979790ms.1 (09:37:24.941 UTC Wed Jan 22 2020) +3360 pid:23 Originate +44152459521B connected

 

XLATE NOT DOING WHAT I ORIGINALLY INTENDED

767663: Jan 22 09:39:49.332: xrule_checking

767664: Jan 22 09:39:49.332: xrule_checking calling +441524511000, called +44152459521B

767665: Jan 22 09:39:49.332: xrule_checking peer_tag 22, direction 1, protocol 3

767666: Jan 22 09:39:49.332: h323_xrule

767667: Jan 22 09:39:49.332: h323_xrule

767668: Jan 22 09:39:49.332: xrule_checking Return rc = -4

767669: Jan 22 09:39:49.332: xrule_checking

767670: Jan 22 09:39:49.332: xrule_checking calling +441524511000, called +44152451524595219

767671: Jan 22 09:39:49.332: xrule_checking peer_tag 23, direction 2, protocol 3

767672: Jan 22 09:39:49.332: xrule_checking Return rc = -5

767673: Jan 22 09:39:49.340: xrule_checking

fa-sipgw01-lg02#

 

DIAL NOT CAUGHT BY XLATE RULE

3460 : 3290756 -2018953230ms.1 (11:01:11.533 UTC Wed Jan 22 2020) +10330 pid:22 Answer +44152451100A connected

3460 : 3290757 -2018953220ms.1 (11:01:11.539 UTC Wed Jan 22 2020) +10320 pid:24 Originate +44781496571C connected

 

KR

Nathan.

'Post!'

3 Replies 3

Chris Deren
Hall of Fame
Hall of Fame

My suggestion is to match inbound calls based on SIP URI VIA class and for outbound matching use e164-class maps along with server groups, this is more modern and recommended approach.

For example here is snippet of how this can be accomplished:

voice class uri 10 sip
host ipv4:<CUCM IP>
host ipv4:<CUCM IP>

!

voice class uri 100 sip
host ipv4:<SIP Provider IP>

host ipv4:<SIP Provider IP>

!

voice class server-group 10
ipv4 <CUCM IP>
ipv4 <CUCM IP> preference 1
description CUCM Server Group
!
voice class server-group 100
ipv4 <SIP Provider IP>
ipv4 <SIP Provider IP> preference 1
description SIP Provider IP Server Group

!

voice class e164-pattern-map 10
description CUCM Destinations
e164 <numbers pointing to CUCM>
e164 <numbers pointing to CUCM>

etc

!

voice class e164-pattern-map 100
description PSTN Destinations
e164 9011T
e164 91[2-9]..[2-9]......

e164 9[2-9]......
e164 9411

etc

!

dial-peer voice 10 voip
description CUCM - Inbound
session protocol sipv2
incoming uri via 10
dtmf-relay rtp-nte
no vad
!
dial-peer voice 100 voip
description SIP Provider - Inbound
session protocol sipv2
incoming uri via 100
dtmf-relay rtp-nte
no vad

!

dial-peer voice 101 voip
description SIP Provider - Outbound
translation-profile outgoing strip9
session protocol sipv2
session server-group 100
destination e164-pattern-map 100
dtmf-relay rtp-nte
no vad

!

dial-peer voice 11 voip
description CUCM - Outbound
translation-profile outgoing <translation if needed to normalize call to CUCM>
session protocol sipv2
session server-group 10
destination e164-pattern-map 10
dtmf-relay rtp-nte
no vad

Interesting, thanks Chris.
The first thing I note in that config is the server group idea, meaning I don't need 4 dial peers to send calls to each of my 4 subs, each being the same but for the IP address. I'll take that forward as a matter of course.

I've got everything working now, but I did it the way I noted at the end, new dial peer, new xlate for the short number on CUCM. But it 'feels' clumsy, so I'll pick over that config you've posted to see how that works. I'm almost glad I had to pose the question :)

Great, let us know if you have any other questions.

 

Please remember to rate all useful posts!

 

Chris

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: