0
votes

I'm using Asterisk to route calls. The logic of my application is rather complex, therefore I'm using PHPAGI.

I would like to execute Dial command and track several things:

  1. Has the call been answered?
  2. How many time it took for callee to answer the call?
  3. How many time did take the talk?

All I have now is the $agi->exec('Dial', ...) function. The Dial command allows me to specify a macro, that is being called when the callee answers the call. But how can I specify any php callback instead of this? How can I track the answer moment in my phpagi script?

Thank you!

1

1 Answers

1
votes

You can do macro like this

[macro-dial]
exten => s,1,System(/full/path/php_callback_on_answer.php ${ID})

For callback on hangup use h-extension or just parse cdrs in mysql.

You can record in variable time when call started and calculate time before answer.