<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
Asterisk (after 1.4?) sends the AGI a HUP when the call hangs up. <br>
<br>
Try setting your script to ignore the HUP signal and make it fork
and go into the background so Asterisk thinks the process has
completed. <br>
<br>
In PHP ignore HUP: <br>
<br>
pcntl_signal(SIGHUP, SIG_IGN);<br>
<br>
In PHP fork and become a short lived daemon:<br>
<br>
$pid = pcntl_fork();<br>
if ($pid == -1) {<br>
die("could not fork");<br>
} elseif ($pid) {<br>
exit; // we are the parent<br>
}<br>
// we are the child<br>
// detatch from the controlling terminal so we don't become
a zombie when we die.<br>
if (posix_setsid() == -1) {<br>
die("could not detach from terminal");<br>
} <br>
<br>
<br>
<div class="moz-cite-prefix">On 01/18/2018 12:27 PM, Jonathan H
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAEebyNVn63ctPRLUb0U-DttA2Zk4HBXumYs4WORj6udm1WW4AA@mail.gmail.com">
<div dir="ltr">I know that hangup handlers (<a
href="https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers"
moz-do-not-send="true">https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers</a>)
have to finish quickly.
<div><br>
</div>
<div>So it's no surprise that my speech to text agi which takes
8 seconds gets killed.</div>
<div><br>
</div>
<div>However, can anyone think of a way round this? So, once the
caller has hung up, I need to take one of the channel
variables, and pass it to a python agi script which then does
speech to text.</div>
<div><br>
</div>
<div>In-call, it works fine. After hangup, it doesn't. Which is
correct, but any thoughts on ways round this?</div>
<div><br>
Thanks.</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>