Asterisk 1.8 CALL-ID

Hi guys
is there any way how to get call-id from asterisk, I want logging it to mysql???


There is little point in logging it unless you have some other system that is also logging them, as they are opaque references. However I did answer it on one of the forums in the last few days. If you want caller ID, use core show functions, at the CLI prompt, or look in the Appendices of one of the Asterisk books, to find the appropriate function.

THX David, I got it is ${SIPCALLID} variable…is there any way how can i add this variable to my CDR table for each calls???


I would have gone for the generic way, by fetching the header. Unless someone has done exactly what you want, they may not be aware of specific variables.

Please note that normal calls have two call-IDs, as Asterisk is a back to back user agent. The easy one to get is that for the incoming side.

There is a user field in CDRs. You can also have custom CDRs, but they are not supported by all CDR back ends.

For anything non-trivial, CDRs will give you confusing call durations, and you need to use CEL instead.

Call-ID is a part of SIP Header, is a unique for every call and it’s same on server and client…I want add “Call_ID” column to my CDR table in MySql where will be stored ${SIPCALLID} for each call.


It is unique for every call leg, not for every call. Most calls have two legs.

OK, I just need add new variable to MySQL CDR table, i add this in my extensions conf

and add to cdr_mysql.conf this:


but it’s not working it add plane text to CDR table…