How do I delete the country code of all incoming calls?

(Namen) #1

Country code 380 ua you need to remove the country code from the caller’s number (380686400568) so that the number was of this type (0680000000)


There is a comprehensive context in /etc/asterisk/extensions.conf called [from-pstn-e164-us] you could rewrite is as [from-pstn-e164-ua] to suit what you are getting from your VSP’s and how the good folks of Ukraine like to see and dial things. Just put the new context in /etc/asterisk//extensions_custom.conf, then just send your inbound calls to that context.


Why would one want to do this?


Some folks wouldn’t understand, but many who want to ‘normalize’ dialing do like it’s method though, pair that with normalized outbound dialing and 10 or 11 digit or e164 dialing will work as will returning calls from received numbers.


That I can understand

(Namen) #6

Where can I find the configuration [from-pstn-e164-ua] to insert into /etc/asterisk//extensions_custom.conf?


As of 2009,

(R. Stindl) #8

You could put an adapted version of this text in your extensions_custom.conf
In this example I remove the country code of Austria “+43” and replace it with a “0”, then I remove the area code of Vienna “01”. For all other country codes I remove the “+” and replace it with “00”. That’s Europe specific…

exten => _.,1,ExecIf($[ "${CALLERID(name):0:3}" = "+43" ]?Set(CALLERID(name)=0${CALLERID(name):3}))
exten => _.,n,ExecIf($[ "${CALLERID(num):0:3}" = "+43" ]?Set(CALLERID(num)=0${CALLERID(num):3}))
exten => _.,n,ExecIf($[ "${CALLERID(name):0:2}" = "01" ]?Set(CALLERID(name)=${CALLERID(name):2}))
exten => _.,n,ExecIf($[ "${CALLERID(num):0:2}" = "01" ]?Set(CALLERID(num)=${CALLERID(num):2}))
exten => _.,n,ExecIf($[ "${CALLERID(name):0:1}" = "+" ]?Set(CALLERID(name)=00${CALLERID(name):1}))
exten => _.,n,ExecIf($[ "${CALLERID(num):0:1}" = "+" ]?Set(CALLERID(num)=00${CALLERID(num):1}))
exten => _.,n,goto(from-trunk,${EXTEN},1)

(system) closed #9

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