I was migrating a client to a new carrier when I found this old custom context on their system.
I had forgotten about setting this up. But it was quite useful at the time.
Thankfully most carriers, I deal with, now let you choose the format to have the calls delivered.
Drop this in extensions_custom.conf
and then set your trunk to from-pstn-us
. I believe the carrier was one called Vitelity. They don’t exist anymore (well bought/rebranded to Voyent).
They sent all inbound DID as 11 digit numbers, not E164 with the +.
;-------------------------------------------------------------------------------
[from-pstn-us]
; Copied from the beginning of [from-pstn-e164-us] with the + removed and EXTEN substring updated.
; used for trunk context of carrier that sends US DID as 11 digits.
exten => _1NXXNXXXXXX/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:1},1)
exten => _1NXXNXXXXXX/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _1NXXNXXXXXX/_011NX.,n,Goto(from-pstn,${EXTEN:1},1)
exten => _1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:1},1)
exten => s,1,Goto(from-pstn,${EXTEN},1)
;-------------------------------------------------------------------------------