* Created chan_websocket which can exchange media over both inbound and
outbound websockets which the driver will frame and time.
See http://s.asterisk.net/mow for more information.
* res_http_websocket: Made defines for max message size public and converted
a few nuisance verbose messages to debugs.
* main/channel.c: Changed an obsolete nuisance error to a debug.
* ARI channels: Updated externalMedia to include chan_websocket as a supported
transport.
UserNote: A new channel driver "chan_websocket" is now available. It can
exchange media over both inbound and outbound websockets and will both frame
and re-time the media it receives.
See http://s.asterisk.net/mow for more information.
UserNote: The ARI channels/externalMedia API now includes support for the
WebSocket transport provided by chan_websocket.
(cherry picked from commit 07fd3af897)
/*! The "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } } */
/*! The "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } } */
structast_json*variables;
structast_json*variables;
/*! Hostname/ip:port of external host */
/*! Hostname/ip:port or websocket_client connection ID of external host. May be empty for a websocket server connection. */
constchar*external_host;
constchar*external_host;
/*! Payload encapsulation protocol */
/*! Payload encapsulation protocol. Must be 'none' for the websocket transport. */
constchar*encapsulation;
constchar*encapsulation;
/*! Transport protocol */
/*! Transport protocol */
constchar*transport;
constchar*transport;
/*! Connection type (client/server) */
/*! Connection type (client/server). 'server' is only valid for the websocket transport. */
constchar*connection_type;
constchar*connection_type;
/*! Format to encode audio in */
/*! Format to encode audio in */
constchar*format;
constchar*format;
@ -863,7 +863,7 @@ int ast_ari_channels_external_media_parse_body(
case409:/* Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
case409:/* Channel is not in a Stasis application; the channel is currently bridged with other channels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
case422:/* The format specified is unknown on this system */
case422:/* The format specified is unknown on this system */
@ -672,7 +666,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_read)(struct ast_websocket *session, cha
/* Now read the rest of the payload */
/* Now read the rest of the payload */
*payload=&session->buf[frame_size];/* payload will start here, at the end of the options, if any */
*payload=&session->buf[frame_size];/* payload will start here, at the end of the options, if any */
frame_size=frame_size+(*payload_len);/* final frame size is header + optional headers + payload data */
frame_size=frame_size+(*payload_len);/* final frame size is header + optional headers + payload data */
if(frame_size>MAXIMUM_FRAME_SIZE){
if(frame_size>AST_WEBSOCKET_MAX_RX_PAYLOAD_SIZE){
ast_log(LOG_WARNING,"Cannot fit huge websocket frame of %zu bytes\n",frame_size);
ast_log(LOG_WARNING,"Cannot fit huge websocket frame of %zu bytes\n",frame_size);
/* The frame won't fit :-( */
/* The frame won't fit :-( */
ast_websocket_close(session,1009);
ast_websocket_close(session,1009);
@ -992,7 +986,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_uri_cb)(struct ast_tcptls_session_instan
return0;
return0;
}
}
ast_verb(2,"WebSocket connection from '%s' for protocol '%s' accepted using version '%d'\n",ast_sockaddr_stringify(&ser->remote_address),protocol?:"",version);
ast_debug(3,"WebSocket connection from '%s' for protocol '%s' accepted using version '%d'\n",ast_sockaddr_stringify(&ser->remote_address),protocol?:"",version);
/* Populate the session with all the needed details */
/* Populate the session with all the needed details */
"reason":"Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail"
"reason":"Channel is not in a Stasis application; the channel is currently bridged with other channels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail"
},
},
{
{
"code":422,
"code":422,
@ -1870,7 +1870,7 @@
"17.1.0"
"17.1.0"
],
],
"summary":"Start an External Media session.",
"summary":"Start an External Media session.",
"notes":"Create a channel to an External Media source/sink.",
"notes":"Create a channel to an External Media source/sink. The combination of transport and encapsulation will select one of chan_rtp(udp/rtp), chan_audiosocket(tcp/audiosocket) or chan_websocket(websocket/none) channel drivers.",
"nickname":"externalMedia",
"nickname":"externalMedia",
"responseClass":"Channel",
"responseClass":"Channel",
"parameters":[
"parameters":[
@ -1900,15 +1900,15 @@
},
},
{
{
"name":"external_host",
"name":"external_host",
"description":"Hostname/ip:port of external host",
"description":"Hostname/ip:port or websocket_client connection ID of external host. May be empty for a websocket server connection.",
"paramType":"query",
"paramType":"query",
"required":true,
"required":false,
"allowMultiple":false,
"allowMultiple":false,
"dataType":"string"
"dataType":"string"
},
},
{
{
"name":"encapsulation",
"name":"encapsulation",
"description":"Payload encapsulation protocol",
"description":"Payload encapsulation protocol. Must be 'none' for the websocket transport.",
"paramType":"query",
"paramType":"query",
"required":false,
"required":false,
"allowMultiple":false,
"allowMultiple":false,
@ -1918,7 +1918,8 @@
"valueType":"LIST",
"valueType":"LIST",
"values":[
"values":[
"rtp",
"rtp",
"audiosocket"
"audiosocket",
"none"
]
]
}
}
},
},
@ -1934,13 +1935,14 @@
"valueType":"LIST",
"valueType":"LIST",
"values":[
"values":[
"udp",
"udp",
"tcp"
"tcp",
"websocket"
]
]
}
}
},
},
{
{
"name":"connection_type",
"name":"connection_type",
"description":"Connection type (client/server)",
"description":"Connection type (client/server). 'server' is only valid for the websocket transport.",