我有一个语音应用程序,我想在其中保存录制的声音文件。我的代码是:
$record_file= $dir_path . "recordfile_".$file_count;
$this->obj_agi->exec("Record","$record_file.wav,5,$maxsecs");
每当我在录制过程中挂断时,录制应用程序无法执行并挂断电话。
有人知道如何在挂断时管理此记录功能吗?
答案 0 :(得分:1)
即使您挂断,记录应用程序也会正常处理记录。
但是,在AGI内部,捕获挂断的最佳方法是将从Asterisk发送的信号捕获到AGI进程。 通过捕获您的SIGHUP,您可以执行任何操作(计费,触摸文件,插入数据库等)。
默认情况下,会发送一个SIGHUP。
获取更多信息,这是核心节目应用程序AGI(来自CLI)的输出
A locally executed AGI script will receive SIGHUP
on hangup from the channel except when using DeadAGI. A fast AGI server will
correspondingly receive a HANGUP inline with the command dialog. Both of theses
signals may be disabled by setting the ${AGISIGHUP} channel variable to 'no'
before executing the AGI application. Alternatively, if you would like the
AGI application to exit immediately after a channel hangup is detected, set
the ${AGIEXITONHANGUP} variable to 'yes'.