呼叫断开连接以获取星号 [英] Call disconnect for asterisk

查看:288
本文介绍了呼叫断开连接以获取星号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用PHPAGI捕获星号的呼叫断开连接? 例如如果用户断开呼叫,则调用哪个事件?如何捕获它?

How to capture call disconnect for asterisk using PHPAGI ? For e.g. if user disconnects the call which event is invoked ? How to capture it ?

推荐答案

您可以检查PHP-AGI API调用的返回结果, 例如, stream_file 在挂断时返回-1.

You can check the Return Results of your PHP-AGI API calls, for example stream_file returns -1 on hangup.

您还可以在Dialplan的h扩展名上调用另一个AGI脚本.

You could also invoke another AGI Script on the h Extension in the Dialplan.

如果您需要清理某些内容,还可以注册关闭功能.

If you have to clean up something, you could also register a Shutdown function.

另一种方法是注册信号处理程序,该方法在edmund长期在博客中描述过. PCNTL是PHP的扩展,用于启用PCNTL用--enable-pcntl重新编译PHP.

Another Approach is to register a Signal Handler which edmund long described in his blog. PCNTL is a PHP extension, to enable PCNTL recompile PHP with --enable-pcntl.

<?php
declare(ticks=1);

function sig_handler($signo)
{   //Do some stuff in here
    exit(0);
}

//Register the hangup handler
if (function_exists('pcntl_signal'))
{
      pcntl_signal(SIGHUP,  "sig_handler");
}

这篇关于呼叫断开连接以获取星号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆