So I receive and make many calls which are international, most currently via our E1 (EuroISDN) line on the ZAP channel. I use the callerID number where ever I can for many things, and keeping it standard makes lots of sense to me. I also have PBXs paired up around the world so localizing the number is a really bad idea until the last minute. So I really want to have the + on a phone number for as long as possible.

well the good news is Asterisk fully supports this. In your “zapatel.conf” file add these lines to the “[channels]” part:

 nationalprefix=+44
 internationalprefix=+

 

Well ok I’m in the UK so +44 is right for me, if you’re elsewhere then adjust to taste. Now all inbound calls will have the international dialing codes added.

So that’s the inbound part done.. now for the outbound. This is really simple..in your outbound context add these two lines..

[PSTNOutBound]
exten => _+X.,1,noop(internation Dailing!! )
exten => _+X.,n,goto(PSTNOutBound,00${EXTEN:1},1) ; + = 00 for UK PBX

What this does is replace the + with the international dialing prefix.. again I’m in the UK so 00 is right for me. Oh but wait you say, what happens if the number I’m dialing is a UK number?!? Well in the context you need to check for that and again strip those out and replace…

exten => _0044X.,1,Dial(${ISDNTRUNK}/0${EXTEN:4}) ; we're in the UK, remove the 0044 and put a 0 in front 
exten => _0X.,1,Dial(${ISDNTRUNK}/${EXTEN}) ; matches 0 and 00
exten => _9X.,1,Dial(${ISDNTRUNK}/${EXTEN:1}) ; remove the leading 9 
exten => _90044X.,1,Dial(${ISDNTRUNK}/0${EXTEN:5}) ; remove lots of leading digits

So the final context looks like this:

[PSTNOutBound] 
exten => _+X.,1,noop(internation Dailing!! ) 
exten => _+X.,n,goto(PSTNOutBound,00${EXTEN:1},1) ; + = 00 for UK PBX 
exten => _0044X.,1,Dial(${ISDNTRUNK}/0${EXTEN:4}) ; we're in the UK, remove the 0044 and put a 0 infront 
exten => _0X.,1,Dial(${ISDNTRUNK}/${EXTEN}) ; matches 0 and 00 
exten => _9X.,1,Dial(${ISDNTRUNK}/${EXTEN:1}) ; remove the leading 9 
exten => _90044X.,1,Dial(${ISDNTRUNK}/0${EXTEN:5}) ; remove lots of leading digits

The context handles users dialing a + (ie call back, click to Dial) or dialing the international dialing of a number. It also supports dialing out without a 9. ie just the number, with or without international dialing digits.