Incoming Call +49 to 0

Hello, is it possible that the +49 in the beginning from an incomming call automaticly changed to 0?

In the file /etc/asterisk/extensions.conf, you’ll find a context from-pstn-e164-us.

Using that as a guide, create from-pstn-e164-de and put that in /etc/asterisk/extensions_custom.conf (in addition to anything that may already be there).

I assume that you want e.g. +493022222222 -> 03022222222 and +33122222222 -> 0033122222222.

Note that if you forward calls to external numbers and wish to send the number of the original caller as caller ID, you’ll need a hook to change the number back to E.164 format.

e.g. something like this

[from-trunk-sip-YourTrunksName-in]
exten => _.,1,ExecIf($[ β€œ${CALLERID(name):0:3}” = β€œ+49” ]?Set(CALLERID(name)=0${CALLERID(name):3}))
exten => _.,n,ExecIf($[ β€œ${CALLERID(num):0:3}” = β€œ+49” ]?Set(CALLERID(num)=0${CALLERID(num):3}))
exten => _.,n,ExecIf($[ β€œ${CALLERID(name):0:5}” = β€œ01234” ]?Set(CALLERID(name)=${CALLERID(name):5}))
exten => _.,n,ExecIf($[ β€œ${CALLERID(num):0:5}” = β€œ01234” ]?Set(CALLERID(num)=${CALLERID(num):5}))
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-pstn,${EXTEN},1)

thats the section in my extensions_custom.cfg

First it removes +49 and replaces it with 0
than it removes the areacode of my hometown (5 digits in my case, including the leading 0)
finally it removes the + in case it is a call from a foreign European country and adds 00
you have to adapt it to your needs…

…if you use a pjsip trunk, change sip to pjsip…

you can use the freePBX config edit module!

1 Like

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