Asterisk CEL cid_name,cid_num,cid_ani number parsing

Hello, yesterday I got a call with identified 8xxxxxxxxx00=0=0=0=0= number. I looked up my cel and cdr tables. Detail about this call stored as below

in cel table:(cid_name,cid_num,cid_ani)=(8999,=0=0=0=0=,8xxxxxxxxx00=0=0=0=0=)
in cdr table:(clid,src)=(“8999” <8xxxxxxxxx00=0=0=0=0=>,8xxxxxxxxx00=0=0=0=0=)

In normal situation these tables content likes below:
in cel table:(cid_name,cid_num,cid_ani)=(8999,xxxxxxxxx,8xxxxxxxxx)
in cdr table:(clid,src)=(“8999” <8xxxxxxxxx>,8xxxxxxxxx)

My question does asterisk look only last 9 characters when writing to cel table? If yes can I configure this and change?

No, Asterisk doesn’t just look at some n characters when determining Caller ID. That’s for a lot of valid reasons, not the least of which that not everyone has the same n digits that make up their telephone numbers.

Looking at your example, it looks like someone provided a bad Caller ID to Asterisk, i.e., it included other characters that you didn’t want - 0=0=0=0=0=. Asterisk is going to look for the location between the brackets < > and - for the most part - leave what is in there alone.

If you want to massage/sanitize the Caller ID further, you can do that in the dialplan yourself using the CALLERID function.

thanks for your reply. But if does not take n characters why show only last 9 characters? in my example between brackets I have <8xxxxxxxxx00=0=0=0=0=> but asterisk shows only last 9 characters as caller id

Without seeing the full call log, dialplan, and message traffic, I’m not sure why things would be condensed down to that.

Looking at how Asterisk parses caller ID, it will shrink the location information between the brackets by stripping out some invalid characters and brackets, but generally it’s going to keep whatever is between the brackets. It doesn’t have a maximum length baked into it by default.

this my asterisk log

[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:1] Answer(“SIP/yyy-0000a271”, “”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:2] Verbose(“SIP/yyy-0000a271”, “8xxxxxxxxx00=0=0=0=0=”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] app_verbose.c: 8xxxxxxxxx00=0=0=0=0=
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:3] GotoIf(“SIP/yyy-0000a271”, “1?modify_9:check_8”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Goto (incoming,yyy,4)
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:4] Set(“SIP/yyy-0000a271”, “CALLERID(num)==0=0=0=0=”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:5] GotoIf(“SIP/yyy-0000a271”, “0?modify_8:check_7”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Goto (incoming,yyy,7)
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:7] GotoIf(“SIP/yyy-0000a271”, “0?modify_7:continue”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Goto (incoming,yyy,9)
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] pbx.c: – Executing [yyy@incoming:9] Verbose(“SIP/yyy-0000a271”, “=0=0=0=0=”) in new stack
[Dec 7 10:18:08] VERBOSE[23138][C-00006b45] app_verbose.c: =0=0=0=0=

@mjordan thank for your help. I found the cause. The previous programmer takes last 9 characters when incoming call. He configured this in extensions.cnf file.

Whoops :grinning:

Glad to hear it was in extensions.conf. Was starting to wonder what would have caused us to parse the Caller ID differently.