[Asterisk-Users] Asterisk Perl AGI, bug with stream_file() ?

Benoît Mérouze benoit.merouze at ipercom.com
Thu Dec 1 10:29:39 MST 2005


Benoît Mérouze wrote:
> Hello,
>
> On http://www.voip-info.org/tiki-index.php?page=Asterisk%20perl%20agi, 
> it's said that stream_file() might returns "-1 on error or hangup, 0 
> if playback completes without a digit being pressed, or the ASCII 
> numerical value of the digit if a digit was pressed".
>
> But actually when I hangup my phone stream_file returns 0 and the AGI 
> is stopped even if I have a callback function, set with setcallback(), 
> to catch the hangup signal and exit properly the AGI.
> In the Asterisk logs, instead of having "AGI Script myagi.agi 
> completed, returning 0", I have "Spawn extension (default, 777, 2) 
> exited non-zero on 'IAX2/70000-5'" ...
>
> (777 is the extension to launch myagi.agi, and 70000 is my phone's 
> username/number).
>
> Is that a bug?
>
After reading some documentations, I discovered it was possible to 
handle the 'hup' signal.

I still have to use the setcallback method to use my callback function 
when the user hangs up, but I've also added "$SIG{HUP} = \&callback;" to 
call this function when the user hangs up during the execution of 
stream_file().

Then I guess I need to use both $SIG{HUP} and $AGI->setcallback() 
methods to catch any hungup.
Am I right ?

-- 
Benoit Merouze
Ingenieur Developpement d'Application Reseau
benoit.merouze at ipercom.com




More information about the asterisk-users mailing list