I have done a Web site using php and which asterisk is used as a Voip system.Now the problem is I want to get the call duration of each call after 'HANG UP'.I googled alot and got an asterisk variable named ${ANSWEREDTIME},but don't know how I can get the value from it and how I can initiate it. Please Help and consider me as new bee to PHP AGI scripting...! Thanks in advance.
views:
452answers:
2
A:
If I remember correctly, the database has a billsec field which I believe is the call length
Phill Pafford
2009-10-09 20:00:36
Yes I know that there is a field in it.I have also checked it in the log file of the table CDR.But it is returning an empty set after the Hang Up of any of the call done through asterisk.Please help !
Nishant Shrivastava
2009-10-10 10:17:43
+2
A:
Voip-info has a great example of how to write an AGI in PHP. If you look at the function on that page described by the signature 'function execute_agi($command)', you'll see how to make a generic php function to issue commands to asterisk and receive data back.
Once you've done that, you can just put the following code after your Dial statement has returned: $callduration = execute_agi("GET VARIABLE ANSWEREDTIME");
Alternatively, if you build your php script on a PHP asterisk Library (a few are listed here at VOIP-Info) you can use an already tested and feature-filled PHP interface to talk to Asterisk. Good luck!
Dan Carlson
2009-10-22 15:42:04