Strip off Country and Area Code from incoming Caller ID (name)

There are good technical reasons NOT to use the context, from-pstn-custom in this way. I recommend that you change your trunk context to something like from-pstn-de then modify your code to:

[from-pstn-de]
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}" = "02961" ]?Set(CALLERID(name)=${CALLERID(name):5}))
exten => _.,n,ExecIf($[ "${CALLERID(num):0:5}" = "02961" ]?Set(CALLERID(num)=${CALLERID(num):5}))
exten => _.,n,goto(from-pstn,${EXTEN},1)
1 Like