Remove plus from CallerID - solved


(Ed Paine) #1

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


(Dave Burgess) #2

isn’t there a standard context called “from-pstn-e164-gb” that does this? Maybe there should be? A feature request might be a good idea to solve this for the next guy…


(Ed Paine) #3

There is no context called from-pstn-e164-gb. Great idea, I’ve added a feature request.