mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
ari/resource_channels: Add 'formats' to channel create/originate
If you create a local channel and don't specify an originator channel to take capabilities from, we automatically add all audio formats to the new channel's capabilities. When we try to make the channel compatible with another, the "best format" functions pick the best format available, which in this case will be slin192. While this is great for preserving quality, it's the worst for performance and overkill for the vast majority of applications. In the absense of any other information, adding all formats is the correct thing to do and it's not always possible to supply an originator so a new parameter 'formats' has been added to the channel create/originate functions. It's just a comma separated list of formats to make availalble for the channel. Example: "ulaw,slin,slin16". 'formats' and 'originator' are mutually exclusive. To facilitate determination of format names, the format name has been added to "core show codecs". ASTERISK-26070 #close Change-Id: I091b23ecd41c1b4128d85028209772ee139f604b
This commit is contained in:
@@ -157,6 +157,10 @@ int ast_ari_channels_originate_parse_body(
|
||||
if (field) {
|
||||
args->originator = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "formats");
|
||||
if (field) {
|
||||
args->formats = ast_json_string_get(field);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -217,6 +221,9 @@ static void ast_ari_channels_originate_cb(
|
||||
if (strcmp(i->name, "originator") == 0) {
|
||||
args.originator = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "formats") == 0) {
|
||||
args.formats = (i->value);
|
||||
} else
|
||||
{}
|
||||
}
|
||||
/* Look for a JSON request entity */
|
||||
@@ -298,6 +305,10 @@ int ast_ari_channels_create_parse_body(
|
||||
if (field) {
|
||||
args->originator = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "formats");
|
||||
if (field) {
|
||||
args->formats = ast_json_string_get(field);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -340,6 +351,9 @@ static void ast_ari_channels_create_cb(
|
||||
if (strcmp(i->name, "originator") == 0) {
|
||||
args.originator = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "formats") == 0) {
|
||||
args.formats = (i->value);
|
||||
} else
|
||||
{}
|
||||
}
|
||||
/* Look for a JSON request entity */
|
||||
@@ -502,6 +516,10 @@ int ast_ari_channels_originate_with_id_parse_body(
|
||||
if (field) {
|
||||
args->originator = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "formats");
|
||||
if (field) {
|
||||
args->formats = ast_json_string_get(field);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -559,6 +577,9 @@ static void ast_ari_channels_originate_with_id_cb(
|
||||
if (strcmp(i->name, "originator") == 0) {
|
||||
args.originator = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "formats") == 0) {
|
||||
args.formats = (i->value);
|
||||
} else
|
||||
{}
|
||||
}
|
||||
for (i = path_vars; i; i = i->next) {
|
||||
|
Reference in New Issue
Block a user