Recorded files lost when user hangs up in Asterisk

≯℡__Kan透↙ 提交于 2019-12-10 11:49:55

问题


I have one voice application in which I want to save a recorded sound file. My code is:

$record_file= $dir_path . "recordfile_".$file_count;
$this->obj_agi->exec("Record","$record_file.wav,5,$maxsecs");

Whenever I hang up during recording, the recording application can not execute and hangup the call.

Does anyone have any idea how to manage this record function while hanging up?


回答1:


The record application process the record normally even when you hangup.

However, inside AGI, the best way to trap hangup is to trap the signal sent from Asterisk to your AGI process. By trapping your SIGHUP, you can do whatever you want (billing, touch files, insert in DB, etc).

By default, a SIGHUP will be sent.

to get more infos, here's an output from the core show application AGI (from the 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'.


来源:https://stackoverflow.com/questions/13338657/recorded-files-lost-when-user-hangs-up-in-asterisk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!