Strip 1 from incoming numbers

I receive a call from 12033331234 instead of 2033331234 . Suggestion? Testing on Call Centric

Use the context from-pstn-e164-us on the trunk. Should strip off the 1.

I have
context=from-pstn-toheader
if I change that I stop getting calls… any advice?

. . .toheader != . . . e164-us but if you need . . .from-header, merge the two together in your new custom context

context=from-pstn-toheader!=from-pstn-e164-us
or
context=from-pstn-toheader&from-pstn-e164-us
stops incoming calls :confused:

This from extensions.conf

[from-pstn-toheader]
exten =>  _.,1,NoOp(Attempting to extract DID from SIP To header)
exten =>  _.,n,gotoif($["${CHANNEL(channeltype)}"="SIP"]?SIP)
exten =>  _.,n,gotoif($["${CHANNEL(channeltype)}"="PJSIP"]?PJSIP)
exten =>  _.,n,NoOp(Unable to determine SIP channel type)
exten =>  _.,n,goto(from-pstn,${EXTEN},1))
exten =>  _.,n(SIP),Goto(from-pstn,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
exten =>  _.,n(PJSIP),Goto(from-pstn,${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)},1)

and

[from-pstn-e164-us]
exten => _+1NXXNXXXXXX/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _+1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _+1NXXNXXXXXX/_011NX.,n,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:2},1)
exten => _[0-9+]./_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _[0-9+]./_1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):1})
exten => _[0-9+]./_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => _[0-9+]./_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _[0-9+]./_011NX.,n,Goto(from-pstn,${EXTEN},1)
exten => _[0-9+].,1,Goto(from-pstn,${EXTEN},1)
exten => s/_+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => s/_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => s/_+NX.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => s/_011NX.,n,Goto(from-pstn,${EXTEN},1)
exten => s,1,Goto(from-pstn,${EXTEN},1)

try replacing ell the Goto’s from the first context (from-pstn) with (from-pstn-e164-us) in your custom-context

You need the from-header for your vsp you can chain that to the e164 one to strip the initial 1.

1 Like

oh dear… can’t do it… need more coffees I guess :confused:

Post your complete [custom-context . . .]

1 Like

Do I need a module? lost

This is what he said.

[from-pstn-toheader-e164-us]
exten =>  _.,1,NoOp(Attempting to extract DID from SIP To header)
exten =>  _.,n,gotoif($["${CHANNEL(channeltype)}"="SIP"]?SIP)
exten =>  _.,n,gotoif($["${CHANNEL(channeltype)}"="PJSIP"]?PJSIP)
exten =>  _.,n,NoOp(Unable to determine SIP channel type)
exten =>  _.,n,goto(from-pstn,${EXTEN},1))
exten =>  _.,n(SIP),Goto(from-pstn-e164-us,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
exten =>  _.,n(PJSIP),Goto(from-pstn-e164-us,${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)},1)

Just add that to extensions.conf in Admin → Config Edit
image

Then change your trunk to from-pstn-toheader-e164-us

1 Like

You need to create your own context to preprocess calls: Context for scripts (incoming calls) - #16 by lgaetz

It will look like this:

[from-pstn-preprocess]
exten =>  _.,1,NoOp(Entering user defined context from-pstn-preprocess)
exten =>  _.,n,gotoif($["${CHANNEL(channeltype)}"="SIP"]?SIP)
exten =>  _.,n,gotoif($["${CHANNEL(channeltype)}"="PJSIP"]?PJSIP)
exten =>  _.,n,NoOp(Unable to determine SIP channel type)
exten =>  _.,n,goto(from-pstn,${EXTEN},1))
exten =>  _.,n(SIP),Goto(from-pstn-e164-us,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)
exten =>  _.,n(PJSIP),Goto(from-pstn-e164-us,${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)},1)
3 Likes

Silly name. Use consistent naming.

2 Likes

One liner from a console

grep  -B 10 -A 9 from-pstn-toheader  /etc/asterisk/extensions.conf|sed 's/from-pstn/from-pstn-e164-us/g'>> /etc/asterisk/extensions_custom.conf;fwconsole chown

Change the trunk context to

from-pstn-e164-us-toheader

1 Like

MAGIC! Thank you all

Thank you everyone

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