QUESTION Strip off country code from Incoming Call

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
Hi, i would like to remove the country code from an incoming local call. This is not a number in the States. So what and how should i do it?

Thanks
Adam
 

safa0786

New Member
Joined
Mar 4, 2012
Messages
11
Reaction score
1
Write a context on extensions_custom.conf
Code:

[custom-inbound]
exten => s,1,ExecIf($[ "${CALLERID(num):0:1}" = "Country Code" & "${LEN(${CALLERID(num)})}" = "14" ]?Set(CALLERID(num)=${CALLERID(num):1}))
exten => s,n,Goto(from-zaptel,s,1) ( depends what you use T1/E1 or analouge .)

I have used a length of 14 digits, since you have not provide any Country Info.

2) Edit chan_dahdi.conf and change the context for your channels, from from-zaptel to custom-inbound

3) Execute:
asterisk -rx "module reload"
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
thanks safa0786, i'll give it a try. It's a 8 digit and i am using SIP trunk. Is this the correct entry?

Code:
[custom-inbound]
exten => s,1,ExecIf($[ "${CALLERID(num):0:1}" = "Country Code" & "${LEN(${CALLERID(num)})}" = "8" ]?Set(CALLERID(num)=${CALLERID(num):1}))
exten => s,n,Goto(from-trunk,s,1)

As for point 2, i don't quite understand as i never use dahdi and zaptel. care to help me on this?

Adam
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
lgaetz: We need to know what format your CID is in, and what format(s) the country code is in order to figure out what specific dialplan you want?

Me: The country code is +65 and i would like to see NXXXXXXX in the callerID instead of 65NXXXXXXX
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
lgaetz and safa0786: thank you both!

I've tried and this context works well. I will test further if the SIP provider does send + in the callerID.

Code:
[custom-inbound]
exten => _./_65NXXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _./_NXXXXXXX,2,Goto(from-pstn,${EXTEN},1)
exten => _.,1,Goto(from-pstn,${EXTEN},1)
exten => s,1,Goto(from-pstn,${EXTEN},1)

But in CDR Report and Yealink T28, i can see that the CallerID name does not remove 65 while the CallerID number does remove the country code. How can i remove in CallerID name too?

Code:
VERBOSE[32267][C-000060b5] pbx.c: -- Executing [s@macro-user-callerid:29] Set("SIP/Trunk-8008-00000516", "CALLERID(number)=NXXXXXXX") in new stack
VERBOSE[32267][C-000060b5] pbx.c: -- Executing [s@macro-user-callerid:30] Set("SIP/Trunk-8008-00000516", "CALLERID(name)=65NXXXXXXX") in new stack
VERBOSE[32267][C-000060b5] pbx.c: -- Executing [s@macro-user-callerid:31] Set("SIP/Trunk-8008-00000516", "CDR(cnum)=NXXXXXXX") in new stack
VERBOSE[32267][C-000060b5] pbx.c: -- Executing [s@macro-user-callerid:32] Set("SIP/Trunk-8008-00000516", "CDR(cnam)=65NXXXXXXX") in new stack
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
briankelly63: i did this and it does not work. here is the error.

Code:
[custom-inbound1]
exten => _X!,1,Set(CALLERID(num)=${CALLERID(num):3:10})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

Error
Code:
VERBOSE[1372][C-000060e2] netsock2.c: == Using SIP RTP TOS bits 184
VERBOSE[1372][C-000060e2] netsock2.c: == Using SIP RTP CoS mark 5
NOTICE[1372][C-000060e2] chan_sip.c: Call from 'sip83090' (200.00.000.00:5060) to extension 'sip83090' rejected because extension not found in context 'custom-inbound1'.
 
Joined
Nov 14, 2008
Messages
1,398
Reaction score
320
Not sure why that is.. may be a version issue.... EXTEN is case sensitive. Check for typo
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
hey guys, i wasn't aware there was a reply. my apologies. I tried to add the missing entry and the stripping is working properly. I changed from-pstn to from-trunk and it's still working. thanks a lot.

Any idea how can i change this thread to Answered?
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
i added mobile number to follow Me today. Since i've strip off the country code in incoming call, the local number on iPhone does not reflect as a local number. there is a prepend 65 for anyone dialling 8 digit number in trunk manipulation rules. is there a way to add only for follow me?
 

Adam Kayden

Member
Joined
Dec 28, 2013
Messages
53
Reaction score
3
i no longer use follow me but today we set up ring group where one of the number is a mobile number. As the incoming strip off the country code, the number shown on receiving mobile caller ID is from another country.

how can i do this?

Incoming Call Number
65NXXXXXXX

Ring Group List
500# (ext)
501# (ext)
659123456789# (mobile)

1. strip off first 2 out of 10 digit from an incoming call <done>
2. show the 8 digit number on the two extensions in ring group list
3. Prepend the first 2 digit back again before making an outbound call from the ring group list
 

Members online

No members online now.

Forum statistics

Threads
25,782
Messages
167,509
Members
19,202
Latest member
pbxnewguy
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top