mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +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:
@@ -515,6 +515,54 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/channels/{channelId}/move",
|
||||
"description": "Move the channel from one Stasis application to another.",
|
||||
"operations": [
|
||||
{
|
||||
"httpMethod": "POST",
|
||||
"summary": "Move the channel from one Stasis application to another.",
|
||||
"nickname": "move",
|
||||
"responseClass": "void",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "channelId",
|
||||
"description": "Channel's id",
|
||||
"paramType": "path",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "app",
|
||||
"description": "The channel will be passed to this Stasis application.",
|
||||
"paramType": "query",
|
||||
"required": true,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
},
|
||||
{
|
||||
"name": "appArgs",
|
||||
"description": "The application arguments to pass to the Stasis application provided by 'app'.",
|
||||
"paramType": "query",
|
||||
"required": false,
|
||||
"allowMultiple": false,
|
||||
"dataType": "string"
|
||||
}
|
||||
],
|
||||
"errorResponses": [
|
||||
{
|
||||
"code": "404",
|
||||
"reason": "Channel not found"
|
||||
},
|
||||
{
|
||||
"code": "409",
|
||||
"reason": "Channel not in a Stasis application"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/channels/{channelId}/redirect",
|
||||
"description": "Inform the channel that it should redirect itself to a different location. Note that this will almost certainly cause the channel to exit the application.",
|
||||
|
@@ -159,6 +159,7 @@
|
||||
"RecordingStarted",
|
||||
"RecordingFinished",
|
||||
"RecordingFailed",
|
||||
"ApplicationMoveFailed",
|
||||
"ApplicationReplaced",
|
||||
"BridgeCreated",
|
||||
"BridgeDestroyed",
|
||||
@@ -335,6 +336,25 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ApplicationMoveFailed": {
|
||||
"id": "ApplicationMoveFailed",
|
||||
"description": "Notification that trying to move a channel to another Stasis application failed.",
|
||||
"properties": {
|
||||
"channel": {
|
||||
"required": true,
|
||||
"type": "Channel"
|
||||
},
|
||||
"destination": {
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
"args": {
|
||||
"required": true,
|
||||
"type": "List[string]",
|
||||
"description": "Arguments to the application"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ApplicationReplaced": {
|
||||
"id": "ApplicationReplaced",
|
||||
"description": "Notification that another WebSocket has taken over for an application.\n\nAn application may only be subscribed to by a single WebSocket at a time. If multiple WebSockets attempt to subscribe to the same application, the newer WebSocket wins, and the older one receives this event.",
|
||||
|
Reference in New Issue
Block a user