Hello, I've noticed my AGI, in Perl, was always returning 0 even if exit from it with something else than 0. On http://www.voip-info.org/wiki/view/Asterisk+cmd+AGI, it's said : "[AGI] Returns -1 on hangup or if application requested hangup, or 0 on non-hangup exit." But I tried also to hang up during the execution of the AGI and it's the same. I also tried to use setcallback like that: ----------------------------------------------------------------------------- # send callback reference $AGI->setcallback(\&callback); # our callback function sub callback(){ my ($returncode) = @_; warn "The call has ended ($returncode)\n"; exit($returncode); } ----------------------------------------------------------------------------- The $returncode is set to -1 when I hung up my phone, but in Asterisk logs there is still "AGI Script pps.agi completed, returning 0". Is that the normal behavior of Asterisk? Or is it possible to get -1 or any other code when finishing the execution of an AGI? Thanks, Benoit -- Benoit Merouze Network Software Developer benoit.merouze@ipercom.com
I have that problem also when trying to use perl agi scripts.. although not with php scripts. What would the output be if problem with perl? Beno?t M?rouze wrote:> Hello, > > I've noticed my AGI, in Perl, was always returning 0 even if exit from > it with something else than 0. > On http://www.voip-info.org/wiki/view/Asterisk+cmd+AGI, it's said : > "[AGI] Returns -1 on hangup or if application requested hangup, or 0 > on non-hangup exit." But I tried also to hang up during the execution > of the AGI and it's the same. > > I also tried to use setcallback like that: > ----------------------------------------------------------------------------- > > # send callback reference > $AGI->setcallback(\&callback); > > # our callback function > sub callback(){ > my ($returncode) = @_; > warn "The call has ended ($returncode)\n"; > > exit($returncode); > } > ----------------------------------------------------------------------------- > > The $returncode is set to -1 when I hung up my phone, but in Asterisk > logs there is still "AGI Script pps.agi completed, returning 0". > > Is that the normal behavior of Asterisk? Or is it possible to get -1 > or any other code when finishing the execution of an AGI? > > Thanks, > Benoit >