[asterisk-dev] [Code Review]: Clean up AsyncAGI command loop.

rmudgett reviewboard at asterisk.org
Thu Dec 20 17:46:01 CST 2012



> On Dec. 20, 2012, 3:21 p.m., Sean Bright wrote:
> > /branches/1.8/res/res_agi.c, lines 1190-1226
> > <https://reviewboard.asterisk.org/r/1183/diff/1/?file=16168#file16168line1190>
> >
> >     This code is old and committed already, but this doesn't handle the situation where you want to call multiple AGIs in the 'h' extension:
> >     
> >     exten => h,1,AGI(agi:async://whatever)
> >     exten => h,2,AGI(agi:async://whatever2)
> >     
> >     The second AGI will never be called because the hangup frame will be read during the first call.  This is different than the behavior of the other AGI methods and I have yet to find a workaround.

The problem would not be with this function but its caller: launch_asyncagi().

It looks like launch_asyncagi() will not execute any AsyncAGI commands if the channel is hung up either.

AsyncAGI does not have a defined means to switch from executing AGI commands on a channel to executing commands on a hungup channel.

Another oddity with AsyncAGI is that you can queue AGI commands that stay with the channel even if the AsyncAGI execution stops.  The commands then get executed on the next invocation of AsyncAGI on that channel.  I did not flush any leftover commands when launch_asyncagi() started because I did not know if the behavior was intentional or not.

This is better discussed on the -dev list than on an old review that has been committed.


- rmudgett


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1183/#review7568
-----------------------------------------------------------


On April 14, 2011, 5:09 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1183/
> -----------------------------------------------------------
> 
> (Updated April 14, 2011, 5:09 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> The AsyncAGI command loop is lax in the value it returns for the return status.
> 
> This patch does the following:
> 
> * Return correct status: SUCCESS/FAILED/HANGUP.  Previously, abnormal exits from the command loop such as hangup would return SUCCESS.
> 
> * The "asyncagi break" command now returns SUCCESS and is now the only way to break the command loop with that status.  Previously, it returned FAILED.
> 
> * The AMI event AsyncAGI End is no longer sent if the AsyncAGI Start event is not sent.  Previously, this happened because of an error setting up the AGI pipes.
> 
> * All executed AGI commands now get an AsyncAGI Exec result event.  Previously, if the command returned failure (because of hangup), the command loop just exited with FAILURE and did not send the AsyncAGI Exec result event.
> 
> * Makes sure that the channel frame queue is empty on hangup.
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/res/res_agi.c 313821 
> 
> Diff: https://reviewboard.asterisk.org/r/1183/diff
> 
> 
> Testing
> -------
> 
> Manually sent the following AGI commands from the CLI:
> wait for digit -1
> exec background tt-monkeys
> asyncagi break
> 
> Got the expected return values and bahaviour when executed or hungup while executed.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121220/3677152e/attachment-0001.htm>


More information about the asterisk-dev mailing list