res_stasis: Add ability to switch applications.

Added the ability to move between Stasis applications within Stasis.
This can be done by calling 'move' in an application, providing (at
minimum) the channel's id and the application to switch to. If the
application is not registered or active, nothing will happen and the
channel will remain in the current application, and an event will be
triggered to let the application know that the move failed. The event
name is "ApplicationMoveFailed", and provides the "destination" that the
channel was attempting to move to, as well as the usual channel
information. Optionally, a list of arguments can be passed to the
function call for the receiving application. A full example of a 'move'
call would look like this:

client.channels.move(channelId, app, appArgs)

The control object used to control the channel in Stasis can now switch
which application it belongs to, rather than belonging to one Stasis
application for its lifetime. This allows us to use the same control
object instead of having to tear down the current one and create
another.

ASTERISK-28267 #close

Change-Id: I43d12b10045a98a8d42541889b85695be26f288a
This commit is contained in:
Ben Ford
2019-03-07 07:52:20 -06:00
parent a32f525489
commit 6626df586e
12 changed files with 703 additions and 14 deletions

View File

@@ -501,6 +501,20 @@ void stasis_app_control_clear_roles(struct stasis_app_control *control);
*/
int stasis_app_control_continue(struct stasis_app_control *control, const char *context, const char *extension, int priority);
/*!
* \brief Exit \c res_stasis and move to another Stasis application.
*
* If the channel is no longer in \c res_stasis, this function does nothing.
*
* \param control Control for \c res_stasis
* \param app_name The name of the application to switch to
* \param app_args The list of arguments to pass to the application
*
* \return 0 for success
* \return -1 for error
*/
int stasis_app_control_move(struct stasis_app_control *control, const char *app_name, const char *app_args);
/*!
* \brief Redirect a channel in \c res_stasis to a particular endpoint
*