Dial out | Pattern | Prepend e164 | help

adrnandes

Member
Nov 19, 2024
32
0
6
39
Hi there,
My provider Twilio expects to receive the number in E164 format, for example, +44xxxxxxxxxx.
So, I need to adjust the rules in fusionpbx, Dashboard, to rearrange the numbers, in cases where the user dials in the following ways: +44, +440, 00, 01, 02, 03, 05, 07, 09, 084, 087, 0800, the number must be adjusted and arrive at Twilio in the E164 format.
Fusionpbx 5.3 version.
Any help please?
Thank you.
 

dcitelecom

Member
Oct 20, 2021
153
3
18
61
To convert all numbers to e.164 format use the following but forget the + sign. Twilio does not need it and it will only cause problems.
In your Outbound Route, you would use a condition statement for your destination number with Regex like
^(?:0044|00|44|440|01|02|03|05|07|09|084|087|0800)?(\+?[2-9]\d{10,17})$
to first strip away all the numbers you do not want and then add the 44 or +44 country back to the dial string in your Action Bridge to Twilio
sofia/gateway/Provider-Name/44$1
0044207123456789 -> 207123456789
44207123456789 -> 207123456789
440207123456789 -> 207123456789
01207123456789 -> 207123456789
 

adrnandes

Member
Nov 19, 2024
32
0
6
39
Hi dcitelecom,
Thank you very much for your help.
I couldn't get it to work with your regular expression, but it inspired me on how to diagnose and find a way to make it work, so I adapted it to the configuration below, and now it's working.
And in my scenario, it was necessary to use the +.
Thank you.

UK Numbers Regular Expression | Twilio | FusionPBX 5.3
^(?:0044|00|44|440|\+44|0)?([1-9]\d{8,15})$
sofia/gateway/Twilio/+44$1