Strip 1 from incoming numbers


(Leo) #1

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


(Bifur) #2

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


(Leo) #3

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


#4

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


(Leo) #5

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


#6

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.


(Leo) #7

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


#8

Post your complete [custom-context . . .]


(Leo) #9

Do I need a module? lost


(Jared Busch) #10

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


(Lorne Gaetz) #11

You need to create your own context to preprocess calls: Context for scripts (incoming calls)

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)

(Jared Busch) #12

Silly name. Use consistent naming.


#13

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


(Leo) #14

MAGIC! Thank you all


(Leo) #15

Thank you everyone


(system) closed #16

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