I’m in the UK (+44) so the standard context (from-pstn-e164-us) doesn’t work for me. Thanks to several other posts on this forum I came up with the following, which I have added to /etc/asterisk/extensions_custom.conf. It first substitutes 0 for +44, if found, and then looks for a single + (assumed a non-UK country) which is substituted with 00 (UK international exit code).
Then I set the context in our trunk from from-pstn to from-pstn-remove-plus
[from-pstn-remove-plus]
exten => _X!,1,GotoIf($["${CALLERID(num):0:3}" != “+44”]?noukplusatstart)
exten => _X!,n,Set(CALLERID(num)=0${CALLERID(num):3})
exten => _X!,n(noukplusatstart),GotoIf($["${CALLERID(num):0:1}" != “+”]?noplusatstart)
exten => _X!,n,Set(CALLERID(num)=00${CALLERID(num):1})
exten => _X!,n(noplusatstart),Goto(from-pstn,${EXTEN},1)
I’m sure there are more elegant ways but this worked for me and I hope is useful for others.
Ed