I’m trying to set up a dial plan for local numbers in the UK on Twilio.
The trunk is set to have an outbound dial prefix of + (requirement of Twilio).
A number would usually be something like area code (5 digits entered, leading 0 stripped) plus a 6 digit phone number.
Country code of 44 is set as prepend and 0 as prefix in the outbound routes settings (requirement for Twilio to work, again).
Following those, I want to be able to enter a number like 0[012378]XXXXXXXXX and have the rule match.
That doesn’t work - I get “…please check the number and dial again…”
Setting it as X[012378]XX. does work. However, 0[012378]XX.doesn’t.
Replacing the leading 0 with X in the first example also doesn’t work.
An Outbound Route Dial Pattern compares what was dialed to the combination of ‘prefix’ and ‘match pattern’. If the result matches, prefix is removed and replaced with prepend.
So, you could set up a Dial Pattern with:
prepend:44
prefix:0
match pattern:[12378]XX.
When the user dials 02072345678 (72345678 in London) this is matched against 0[12378]XX. which matches, so the number is replaced with 442072345678 and sent to the trunk logic, which converts it to +442072345678, the correct format for Twilio.
If you want to allow international calling, you could have an additional Dial Pattern with:
prepend: (leave blank)
prefix:00
match pattern:ZXX.
If the user dials 0033123456789 (01 23 45 67 89 in Paris) this is matched against 00ZXX. which matches, so the number is replaced with 33123456789 and sent to the trunk logic, which converts it to +33123456789, the correct format for Twilio.
Your production routes should handle other formats used in UK, especially 999 and 112.