简体   繁体   English

PhpAgi Dial:当被叫方接听电话时如何呼叫回叫

[英]PhpAgi Dial: How to call a callback when callee answers the call

I'm using Asterisk to route calls. 我正在使用Asterisk路由呼叫。 The logic of my application is rather complex, therefore I'm using PHPAGI. 我的应用程序的逻辑相当复杂,因此我正在使用PHPAGI。

I would like to execute Dial command and track several things: 我想执行Dial命令并跟踪几件事:

  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. 我现在所拥有的只是$ agi-> exec('Dial',...)函数。 The Dial command allows me to specify a macro, that is being called when the callee answers the call. Dial命令允许我指定一个宏,当被叫方应答呼叫时将被调用。 But how can I specify any php callback instead of this? 但是,我该如何指定任何php回调函数呢? How can I track the answer moment in my phpagi script? 如何在phpagi脚本中跟踪答案时刻?

Thank you! 谢谢!

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. 对于挂断回调,请使用h-extension或仅在mysql中解析cdrs。

You can record in variable time when call started and calculate time before answer. 您可以在通话开始时以可变时间记录并计算接听前的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM