channel: Add ability to request an outgoing channel with stream topology.

This change extends the ast_request functionality by adding another
function and callback to create an outgoing channel with a requested
stream topology. Fallback is provided by either converting the
requested stream topology into a format capabilities structure if
the channel driver does not support streams or by converting the
requested format capabilities into a stream topology if the channel
driver does support streams.

The Dial application has also been updated to request an outgoing
channel with the stream topology of the calling channel.

ASTERISK-26959

Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
This commit is contained in:
Joshua Colp
2017-04-24 15:59:44 +00:00
parent dc6654d969
commit 2b22c3c84b
6 changed files with 230 additions and 47 deletions

View File

@@ -392,6 +392,32 @@ struct ast_stream_topology *ast_stream_topology_create_from_format_cap(
return topology;
}
struct ast_format_cap *ast_format_cap_from_stream_topology(
struct ast_stream_topology *topology)
{
struct ast_format_cap *caps;
int i;
ast_assert(topology != NULL);
caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
if (!caps) {
return NULL;
}
for (i = 0; i < AST_VECTOR_SIZE(&topology->streams); i++) {
struct ast_stream *stream = AST_VECTOR_GET(&topology->streams, i);
if (!stream->formats) {
continue;
}
ast_format_cap_append_from_cap(caps, stream->formats, AST_MEDIA_TYPE_UNKNOWN);
}
return caps;
}
struct ast_stream *ast_stream_topology_get_first_stream_by_type(
const struct ast_stream_topology *topology,
enum ast_media_type type)