我有一个语音应用程序,我想在其中保存录制的声音文件。我的代码是:
$record_file= $dir_path . "recordfile_".$file_count;
$this->obj_agi->exec("Record","$record_file.wav,5,$maxsecs");
每当我在录音过程中挂断电话时,录音应用程序就无法执行并挂断电话。
有谁知道如何在挂机时管理此记录功能?
即使您挂断,录音应用程序也会正常处理录音。
然而,在 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'.