How to change incoming caller ID?

jack88
Posts: 25
Member Since:
2006-09-14

I'm running trixbox 2.2.4 and it's working like a charm except incoming caller ID.
The incoming caller ID should be displayed in my country is as followers:
1)local caller ID has seven or eight digits : ex. [2-8]XXXXXX or [2-8]XXXXXXX
2)long distance caller ID has ten digits leading with 0 : ex. 0[2-8]XXXXXXXX or 0[2-8]XXXXXXX
3)cell phone caller ID also has ten digits leading with 0 : ex. 09XXXXXXXX
4)international caller ID has fourteen digits : ex. 00XXXXXXXXXXXX or whatever.

The incoming caller ID including 1)local and 4)international displays properly except
2)long distance and 3)cell phone.

My problem is the incoming caller ID including 2)long distance and 3)cell phone only
displays nine digits without the leading digit "0". Why the leading digit "0" is stripped
off? I cannot not do a proper callback if the leading digit "0" is missing.

I have followed the documentation provided by FreePBX:
http://www.freepbx.org/support/documentation/howtos/how-to-change...
Edit etc/asterisk/extensions_custom.conf and add the following at the bottom of the file:
[from-trunk-custom]
exten => _X.,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

In that event all the incoming caller ID will be added the leading digit "0" to 1)2)3)4)
mentioned above. Although It will work for 2)long distance caller ID and 3)cell phone caller
ID, it will cause another problem because it is not necessary for me to add leading digit "0"
to 1)local callerID and 4)international caller ID.

How can I change this? Would you please help me to solve it step by step?
I deeply appreciate your kindness.

Jack



borispr
Posts: 59
Member Since:
2006-08-30
[from-trunk-custom]

[from-trunk-custom]
exten =>_X./[2-8]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./[2-8]XXXXXXXX,n,Goto(from-trunk,${EXTEN},1)
exten => _X./9XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./9XXXXXXXX,n,Goto(from-trunk,${EXTEN},1)
exten => _X.,n,Goto(from-trunk,${EXTEN},1)



jack88
Posts: 25
Member Since:
2006-09-14
Thanks for your quickly response.

Dear borispr,
Thanks for your quickly response.
I have tried your setting in [from-trunk-custom], but when I called in from my cell phone
it dropped after two or three rings that I heard from my cell phone and nothing happened in CLI. To make sure I checked my setting with yours and reboot the box but still the same.
My setting as yours:
[from-trunk-custom]
exten => _X./[2-8]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./[2-8]XXXXXXXX,n,Goto(from-trunk,${EXTEN},1)
exten => _X./9XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./9XXXXXXXX,n,Goto(from-trunk,${EXTEN},1)
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

Would you please help me to fix it?

Jack



borispr
Posts: 59
Member Since:
2006-08-30
I have lost _ in the

I have lost _ in the mask

[from-trunk-custom]
exten =>_X./_[2-8]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./_[2-8]XXXXXXXX,n,Goto(from-trunk,${EXTEN},1)
exten => _X./_9XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./_9XXXXXXXX,n,Goto(from-trunk,${EXTEN},1)
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

And be sure that 9XXXXXXXX is correct (for my country it shoud have 10 digits, 3 digits city code + 7 digits phone number)



jack88
Posts: 25
Member Since:
2006-09-14
I have added "_" in the mask

Hi,
I have added "_" in the mask but still no go. It only displayed in CLI as follows:
===========================================================
Verbosity is at least 3
-- Remote UNIX connection
-- Executing Set("SIP/192.168.8.251-087a4ca8", "CALLERID(num)=09XXXXXXXX") in new stack
asterisk1*CLI>

The "CALLERID(num)=09XXXXXXXX" displayed 10 digits leading with "0" properly.
That's what I need but dropped again after three rings from my cell phone.

Any suggestion? Thanks!

Jack



jack88
Posts: 25
Member Since:
2006-09-14
It works properly now.

Dear borispr,
I want to add a leading "0" to the Caller ID only if the received Caller ID
is exactly 8 or 9 digits long. I have changed the setting as below and it
works properly now.
[from-trunk-custom]
exten => _X./_[3-8]XXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./_[249]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./_X.,1,Set(CALLERID(num)=${CALLERID(num)})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

Thanks a million times!
Jack



borispr
Posts: 59
Member Since:
2006-08-30
Hm, I didn't expect that

1: exten => _X./_[3-8]XXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
2: exten => _X./_[249]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
3: exten => _X./_X.,1,Set(CALLERID(num)=${CALLERID(num)})
4: exten => _X.,n,Goto(from-trunk,${EXTEN},1)

I didn't expect that after line 1 it will continue at line 4. I thought it should have the same DID/CID as extension. Will know that :-)
IMHO line 3 is better be as exten => _X./_X.,1, Noop



jack88
Posts: 25
Member Since:
2006-09-14
I have another requirement to match an anonymous Caller ID

As a result of your help, the incoming Caller ID displays perfectly.
But I have another requirement to match an anonymous Caller ID.
How to change the setting in my [from-trunk-custom] mentioned
above to allow the call come in if incoming Caller ID is anonymous
(blank or unknown)?
Would you please to help me again?
Thanks a lot!



jack88
Posts: 25
Member Since:
2006-09-14
It works

It works for both anonymous and numeric Caller ID.
I just add "include => from-sip-external' as below:
[from-trunk-custom]
include => from-sip-external
exten => _X./_[3-8]XXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./_[249]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => _X./_X.,1, Noop
exten => _X.,n,Goto(from-trunk,${EXTEN},1)

Jack



jack88
Posts: 25
Member Since:
2006-09-14
If you need to make this change for your Zap trunk

If you need to make this change for your Zap trunk,
you can use nano to edit etc/asterisk/extensions_custom.conf
and add the following at the bottom of the file:
[from-zaptel-custom]
include => from-sip-external
exten => s/_[3-8]XXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => s/_[249]XXXXXXXX,1,Set(CALLERID(num)=0${CALLERID(num)})
exten => s/_X.,1, Noop
exten => s,n,Goto(from-zaptel,${EXTEN},1)

Use nano to edit etc/asterisk/zapata-auto.conf
You will see a "context=from-zaptel" line
and change it to "context=from-zaptel-custom"

Be aware that the zapata-auto.conf will be overwritten every time
you run genzaptelconf, so keep a backup copy of it.

After that reboot from command line(I prefer to use "reboot" than
"amportal restart").

It's my experience above, maybe it's rough but it works for me.
Or you can correct me, it will be appreciated.

Jack



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.