[asterisk-dev] [Code Review]: ConfbridgeExecAction AMI Command
Matt Jordan
reviewboard at asterisk.org
Thu May 17 15:47:45 CDT 2012
> On May 17, 2012, 12:34 p.m., opticron wrote:
> > /trunk/main/bridging.c, line 66
> > <https://reviewboard.asterisk.org/r/1902/diff/4/?file=27898#file27898line66>
> >
> > *Deferreds
Fixed!
> On May 17, 2012, 12:34 p.m., opticron wrote:
> > /trunk/main/bridging.c, line 812
> > <https://reviewboard.asterisk.org/r/1902/diff/4/?file=27898#file27898line812>
> >
> > According to the documentation above, bridge_channel needs to be locked prior to calling this function.
Always good when I break my own documentation :-\
Thanks for catching this - I should have the locking shuffle between the bridge and the bridge_channel correct now.
> On May 17, 2012, 12:34 p.m., opticron wrote:
> > /trunk/main/bridging.c, line 827
> > <https://reviewboard.asterisk.org/r/1902/diff/4/?file=27898#file27898line827>
> >
> > Ditto.
Changed
> On May 17, 2012, 12:34 p.m., opticron wrote:
> > /trunk/main/bridging.c, line 1061
> > <https://reviewboard.asterisk.org/r/1902/diff/4/?file=27898#file27898line1061>
> >
> > On two back to back deferreds, this condition will be false and the channel will exit the bridge unexpectedly.
That shouldn't be possible.
When a deferred is actually serviced by this loop, the state (unless the channel is hung up) is set back to AST_BRIDGE_CHANNEL_STATE_WAIT. Each deferred that is serviced can, at most, change the state a single time; only a single deferred request is executed at a time.
Since the deferred no longer changes the bridge_channel->state explicitly but instead requests a state change, executing any number of deferred requests back to back will not break the loop. When a deferred requests a state change, that change is obtained in one of the *_join methods (multithreaded or single), and processed before a new one is pulled off of the queue. The act of processing should either break the loop intentionally due to a hangup, or set the state back to AST_BRIDGE_CHANNEL_STATE_WAIT.
You should be able to queue up n deferred actions and have this process them as it can, and not have any race conditions on the value of state (at least with respect to setting the state value).
- Matt
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1902/#review6241
-----------------------------------------------------------
On May 14, 2012, 9:51 p.m., Matt Jordan wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1902/
> -----------------------------------------------------------
>
> (Updated May 14, 2012, 9:51 p.m.)
>
>
> Review request for Asterisk Developers and Joshua Colp.
>
>
> Summary
> -------
>
> Currently, most actions that are executed upon a channel in a conference (increasing/decreasing listening volume, playing back a sound on a channel, etc.) are handled via DTMF menus associated with a user profile. While this suffices for scenarios where a user initiates an action upon themselves, it does not account for scenarios where a third party application wants to interact with the channels in a ConfBridge. While there are a handful of AMI commands that allow for external interaction with the channels in the conference, they are currently limited to a subset of the defined actions.
>
> Rather then add individual AMI commands for each confbridge action, this patch adds a single new AMI command for ConfBridge, ConfbridgeExecAction. The command lets you execute any of the ConfBridge actions on a channel in the conference.
>
> In order to facilitate this, a new mechanism has been added to the bridging layer to allow for a callback function to be executed at the next convenient moment on a bridged channel's thread. This lets a user of the bridging layer defer execution of some function until such a time that the bridging layer determines that it is safe to execute that action on the channel's thread.
>
> Example Usage:
>
> Action: ConfbridgeExecAction
> Conference: 1
> Channel: Local/blah at foo
> Actions: increase_listening_volume,playback(tt-monkeys)
>
> This would playback monkeys to the offending channel. Very loudly.
>
>
> Diffs
> -----
>
> /trunk/CHANGES 366506
> /trunk/apps/app_confbridge.c 366506
> /trunk/apps/confbridge/conf_config_parser.c 366506
> /trunk/apps/confbridge/include/confbridge.h 366506
> /trunk/include/asterisk/bridging.h 366506
> /trunk/main/bridging.c 366506
>
> Diff: https://reviewboard.asterisk.org/r/1902/diff
>
>
> Testing
> -------
>
> Initial testing using a test in the Asterisk Test Suite verified proper behavior of the AMI command. The channel was properly suspended from the bridging layer, the playback confbridge action was executed, and the channel was placed back into the bridging layer. All of this was similar to what would occur if the same action was triggered using a DTMF menu.
>
> Note that a test case is being written to handle the various actions, but will be posted under a separate review.
>
>
> Thanks,
>
> Matt
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120517/2f7995c0/attachment-0001.htm>
More information about the asterisk-dev
mailing list