Link to home
Start Free TrialLog in
Avatar of _agx_
_agx_Flag for United States of America

asked on

Asterisk - What is the format of CDR(clid)?

The Asterisk function documentation is a bit sparse. It says only that CDR(clid) provides the Caller ID. What is the format of that value? Is it possible to identify the caller country from this (or any other value)?

Sorry if this is a very basic question, but searching hasn't turned up anything useful so far....
Avatar of arnold
arnold
Flag of United States of America image

You would need to look at the format of the CallerID. Yes, so long as the provider includes all the data from the phone, you can determine.

Depending on where you are not a "local" number will have significantly more digits in the number.
Avatar of _agx_

ASKER

>> You would need to look at the format of the CallerID.

So there isn't a standard format, it depends on what the provider sends? All I've been able to find is that CDR(clid) usually returns numbers only, but nothing about how those numbers are derived or whether the format varies depending on other factors.

>> includes all the data from the phone, you can determine.
What do you mean by "all the data" ?  

EDIT:
Sorry if these are basic questions, just trying to understand what data is generally standard and what can vary depending on caller,provider, etc...
country code, area, phone number are /should be included.

The provider repeats the sata originated on the caller side, prepended with originators ....
I.e. Calling locally, the originator only includes the number, going international, the originator + international connector would reflect originating country code plus originating callers phone number.

Do you have the setup, visually inspect what us being recorded in the log and proceed from there.

Usually you would gave to pattern match, number length based determination.
I.e. If your local dialing consists of 6 digits, then if the callerID is 6 digits it is lost likely a local call. If it is 8 number it might be that it is within the same country but from a different dialing are.  And you expand outward that way.

If however, you are using a provider that gas local numbers all over the world, they may prefix the incoming callerID with the appropriate country,area as applicable.
Avatar of _agx_

ASKER

Hm... took another look and it appears  CDR(clid) is a mixture of text and number, ie "Display Name" <XXXXXXXXXX>.  So I looked at other fields that seem to contain just numbers and "+", ie CDR(src), CDR(cnum), .... but it doesn't seem like there's any standard format.  

The src and cnum fields contain a variety of values.   Most are 10 or 11 digits

           1NPANXXXXXX     <=== looks like NANP phone number
           011XXXXXXXXX     <=== "X" is arbitrary series of numbers
           +XXXXXXXXXXX

... but some are 12 to 17 digits.   Not sure what to make of those.
Not sure I understand, there are different locals that transmit/format their numbers differently.
I think Europe has the +xx xxxxxxx formatting.

Do you have an existing setup that you would like to get some information from?
Avatar of _agx_

ASKER

I guess I'm asking what determines the format of the phone number returned by the CDR?

* Are the phone numbers always in some standard format like E123, E164, etc....  or is there some set of reliable rules, based on which country the caller is from? ...

* Or is it just arbitrary...  in other words, does Asterisk simply extract whatever number is sent within the caller ID string, regardless of whether it's likely to be a valid phone number or not.  For example, "19995554321555464877" probably isn't a valid phone number

         "Some Name" <19995554321555464877>
Yes, The data is returned based on what is being furnished by the carrier who is relaying information from the callers side.

Your side is simply the output.
Avatar of _agx_

ASKER

So are you saying it's purely arbitrary?
It is not arbitrary, different locals have their own variation on phone number display.
Avatar of _agx_

ASKER

Yes, I understand there are different conventions for different countries - but that's not quite the same as a "standard" like E123,E164, etc...  Is there any guaranteed format ?
It depends on the where you are and what your provider passes to you
Caller => provider => interchange=> recipients provider=> recipient
              Adds caller      Adds interchange          

If caller number is 123456 that is what the provider sets. If it crosses areas, the interchange will add the originating areas prefix to the number I.e. XX123456.


I am unfamiliar with the E123,164 you referenced.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of _agx_

ASKER

Ok, thanks.  Let me read up on the wiki article and I'll post back tomorrow.