How to connect Asterisk 13 CDR PHP

im try to connect Asterisk 13 with PHP based CRM software, i need to access CDR real time with my PHP based software, is there any way for it or any solution for that.

For incomplete calls, read them using AMI by reading the relevant function value as though it was a channel variable. For complete calls, store them in a database and access the database, or store them in a file and then write code that tracks the end of the file.

do you know any way to connect AMI using PHP…? if you know that can you send that code…?

PHP is probably the most common platform used for AMI, so simply Google for class libraries. The protocol is also quite simple, so you could implement from first principles.

oky i’ll try it…! thank you for support

and i also want to Know my CDR not update until disconnect the call or reject it. is there any way to config CDR to update it’s record when come a incoming call…?

Once a CDR is written it is cannot be changed, so,whilst you can force out CDRs early, by doing so explicitly, they would, in you case, show a call that was of zero length and not answered.

You probably want Call Event Logging, instead.

ok. then how can i access to Call event log and is it possible to join it with php programme…?

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=5242932

I can’t see why not.

im able access CEL with CMD but can i insert that data into a mysql data base…? if it’s already been saved can i know the location of that database…?

There are various modules which allow placing CEL data into the database. It isn’t done by default. You can see what modules are supported and their configuration files by looking at the sample configuration files. Anything starting with “cel” is for CEL. For example cel_odbc.conf.sample is the sample configuration file for the cel_odbc module, which stores CEL using ODBC.

1 Like

im new to Asterisk so can i know how to configure that module in Asterisk 13…? if you can give a sample code it 's very easy to understand.

And is there any my sql module just like ODBC module…?

I don’t have sample code, but the sample configuration files exist in the source code in the configs/samples directory which include configuration files for CEL. I don’t believe there is a MySQL module for it, no. You may also be able to find a guide online.

1 Like

thanks jcolp. i’ll try