Number translation

Status
Not open for further replies.

dbbrito

Member
Oct 27, 2021
44
1
8
45
Friends, I need to create a "number translation" or Outbound Routes but I'm not getting it, if anyone can help.
There are two ways I can dial:
2238222826
or
02238222826

the termination provider only accepts E164, and the call has to go out:
542238222826 where the biggest problem is removing the zero 0.
Regards
 

hfoster

Active Member
Jan 28, 2019
685
81
28
34
Your destination number, you probably want:

^0(/d{10})$

The outbound routes work on regex captures, which can be utilised in the bridge statement as denoted by the '$1' for the first capture group. You can then also apply a prefix of your choosing, which would end up looking like:

sofia/gateway/SIP-Trunk/54$1
 

dbbrito

Member
Oct 27, 2021
44
1
8
45
Your destination number, you probably want:

^0(/d{10})$

The outbound routes work on regex captures, which can be utilised in the bridge statement as denoted by the '$1' for the first capture group. You can then also apply a prefix of your choosing, which would end up looking like:

sofia/gateway/SIP-Trunk/54$1
Thanks for the help "hfoster" but it didn't work, now it gives an error: [inbound routes] 404 not found, and the rule is in Outbound.
In fact, I need to register the routes with the following conditions:

Fixed:
2238222826
or
02238222826

mobile:
22938222826
or
022938222826

I also tried to create the rule in the translation number: ^0(\d+)$ to remove the zero but it also gave an error of [inbound routes] 404 not found

In asterisk I can do it, I even enabled the number_translation module, but also without success.

Thank you again! Regards
 
Last edited:

mcs3ss2

Active Member
Sep 8, 2020
286
33
28
AU
One of my termination provider uses E64
Here is my outbound route for 10 digit number
1652186348704.png
 

Architect

New Member
Jun 1, 2021
26
4
3
53
You will need to create 2 Outbound Routes because you will need to reference 2 destination_number conditions:

  1. ^0?(\d{10})$
    • This one will accept both of the following and strip the leading zero
      • 2238222826
      • 02238222826
  2. ^0?(\d{11})$
    • This one will accept both of the following and strip the leading zero
      • 22938222826
      • 022938222826
And make sure your bridge action has /$1 after the Gateway reference.

I use the following site to test my regex conditions for Outbound Routes: http://regexstorm.net/tester?
It has been a great tool!
 
Status
Not open for further replies.