mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
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:
@@ -107,6 +107,58 @@ int control_prestart_dispatch_all(struct stasis_app_control *control,
|
||||
*/
|
||||
struct stasis_app *control_app(struct stasis_app_control *control);
|
||||
|
||||
/*!
|
||||
* \brief Set the application the control object belongs to
|
||||
*
|
||||
* \param control The control for the channel
|
||||
* \param app The application this control will now belong to
|
||||
*
|
||||
* \note This will unref control's previous app by 1, and bump app by 1
|
||||
*/
|
||||
void control_set_app(struct stasis_app_control *control, struct stasis_app *app);
|
||||
|
||||
/*!
|
||||
* \brief Returns the name of the application we are moving to
|
||||
*
|
||||
* \param control The control for the channel
|
||||
*
|
||||
* \return The name of the application we are moving to
|
||||
*/
|
||||
char *control_next_app(struct stasis_app_control *control);
|
||||
|
||||
/*!
|
||||
* \brief Free any memory that was allocated for switching applications via
|
||||
* /channels/{channelId}/move
|
||||
*
|
||||
* \param control The control for the channel
|
||||
*/
|
||||
void control_move_cleanup(struct stasis_app_control *control);
|
||||
|
||||
/*!
|
||||
* \brief Returns the list of arguments to pass to the application we are moving to
|
||||
*
|
||||
* \note If you wish to get the size of the list, control_next_app_args_size should be
|
||||
* called before this, as this function will steal the elements from the string vector
|
||||
* and set the size to 0.
|
||||
*
|
||||
* \param control The control for the channel
|
||||
*
|
||||
* \return The arguments to pass to the application we are moving to
|
||||
*/
|
||||
char **control_next_app_args(struct stasis_app_control *control);
|
||||
|
||||
/*!
|
||||
* \brief Returns the number of arguments to be passed to the application we are moving to
|
||||
*
|
||||
* \note This should always be called before control_next_app_args, as calling that function
|
||||
* will steal all elements from the string vector and set the size to 0.
|
||||
*
|
||||
* \param control The control for the channel
|
||||
*
|
||||
* \return The number of arguments to be passed to the application we are moving to
|
||||
*/
|
||||
int control_next_app_args_size(struct stasis_app_control *control);
|
||||
|
||||
/*!
|
||||
* \brief Command callback for adding a channel to a bridge
|
||||
*
|
||||
|
Reference in New Issue
Block a user