[Home]

Summary:ASTERISK-11835: AGISTATUS is not set to the correct value
Reporter:Fabian Mueller (fmueller)Labels:
Date Opened:2008-04-12 14:25:07Date Closed:2011-06-07 14:07:51
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I call this context:

[default]
exten => 69,1,Answer()
exten => 69,2,DeadAGI(deadagi-test.php)
exten => 69,3,NoOp(foo)
exten => 69,4,Hangup()
exten => h,1,NoOp(${AGISTATUS})

The source code for deadagi-test.php is this:

#!/usr/local/bin/php
<?php
sleep(7);
?>

I hangup while the script is sleeping. According to the documentation that is given by the command 'show application AGI' I expected that the value of AGISTATUS is  HANGUP but the following line is written to the CLI:

Executing [h@default:1] NoOp("SIP/111-08201fb8", "SUCCESS") in new stack

Doing the same with AGI instead of DeadAGI I get what I expected:
Executing [h@default:1] NoOp("SIP/111-08200328", "HANGUP") in new stack

This is a bug, right?
Back to DeadAGI. I again use the context mentioned at the beginning but change the source code of deadagi-test.php to this:

#!/usr/local/bin/php
<?php
while (($line = fgets(STDIN)) != "\n") {}
echo("STREAM FILE demo-congrats \"\"\n");
flush(STDOUT);
fgets(STDIN);
?>

When I hangup while the sound file is beeing played back the following is written to the CLI:

-- AGI Script deadagi-test.php completed, returning -1
-- Executing [h@default:1] NoOp("SIP/111-08191378", "") in new stack

This means that AGISTATUS is not set which is a bug, isnĀ“t it? Also note the "returning -1". When you change the line
echo("STREAM FILE demo-congrats \"\"\n");
to
echo("GET DATA demo-congrats 5000 1\n");
in the script above and again hangup while the sound file is beeing played back the following is written to the CLI:

-- AGI Script deadagi-test.php completed, returning 0
-- Executing [h@default:1] NoOp("SIP/111-08191378", "SUCCESS") in new stack

So this time we have "returning 0" and AGISTATUS set to SUCCESS. I do not think that the AGISTATUS variable and the number returned (0 or -1) should depend on what command you use (STREAM FILE or GET DATA). What do you think about this?
Thank you for your feedback.
Comments:By: Tilghman Lesher (tilghman) 2008-04-13 12:28:27

Correct.  You are NOT supposed to use DeadAGI on a live call.  There are all sorts of problems that that can cause.  Do not use DeadAGI in an improper way, and you'll be fine.