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....
LVL 53
_agx_Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
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.
_agx_Author Commented:
>> 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...
arnoldCommented:
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.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

_agx_Author Commented:
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.
arnoldCommented:
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?
_agx_Author Commented:
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>
arnoldCommented:
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.
_agx_Author Commented:
So are you saying it's purely arbitrary?
arnoldCommented:
It is not arbitrary, different locals have their own variation on phone number display.
_agx_Author Commented:
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 ?
arnoldCommented:
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.
arnoldCommented:
The Wikipedia page has some information on the standard used to convey/transmit this information...

https://en.m.wikipedia.org/wiki/Caller_ID

It addresses how the data is .......
It does not include the formatting.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
_agx_Author Commented:
Ok, thanks.  Let me read up on the wiki article and I'll post back tomorrow.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Voice Over IP

From novice to tech pro — start learning today.