Twilio from-pstn-e164-us but EU numbers and 011 reformatting non-NPA numbers


Twilio is our host even for our European numbers.
However the extensions.conf has this line where non NPA numbers get reformatted with a 011-prefix:

exten => _+1NXXNXXXXXX/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _+1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _+1NXXNXXXXXX/_011NX.,n,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:2},1)
exten => _[0-9+]./_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _[0-9+]./_1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):1})
exten => _[0-9+]./_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => _[0-9+]./_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _[0-9+]./_011NX.,n,Goto(from-pstn,${EXTEN},1)
exten => _[0-9+].,1,Goto(from-pstn,${EXTEN},1)
exten => s/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => s/_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => s/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => s/_011NX.,n,Goto(from-pstn,${EXTEN},1)
exten => s,1,Goto(from-pstn,${EXTEN},1)
;exten => _.,1,Set(CDR(twilio_call_sid)=${SIP_HEADER(X-Twilio-CallSid)})

So an incoming call from Spain for example looks like 01134xxxxxxxxx where it should be +34xxxxxxxxx.

How to get this? Is there a channel/support dedicated to European users and the specific call rules we need here?

Van Bernaert
I don’t find to get the format to

If you would be satisfied with all numbers in E.164 format (starting with + then country code), just change the Context for the trunk to

If your system requires numbers formatted in a special way, write your own context to replace from-pstn-e164-us (you can copy that as a starting point).

to say, copying all the exten’s to from-pstn, and from there finetuning for my use? Right?

Is there any good tool to create GUI-wise a dialplan? Or is this really only ‘code’-wise?

I really want to learn making good dialplans, as I plan to switch from 3CX to freepbx (testing/playing now with 1 server)

Extensions have a default context of from-internal; this is normally not changed.

If you want to change how caller IDs are displayed on incoming calls, copy the from-pstn-e164-us to extensions_custom.conf, give it a new name there, modify it to meet your needs, and change the context for your trunk(s) to use the new version.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.