mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 20:56:39 +00:00
ARI: The bridges play and record APIs now handle sample rates > 8K correctly.
The bridge play and record APIs were forcing the Announcer/Recorder channel to slin8 which meant that if you played or recorded audio with a sample rate > 8K, it was downsampled to 8K limiting the bandwidth. * The /bridges/play REST APIs have a new "announcer_format" parameter that allows the caller to explicitly set the format on the "Announcer" channel through which the audio is played into the bridge. If not specified, the default depends on how many channels are currently in the bridge. If a single channel is in the bridge, then the Announcer channel's format will be set to the same as that channel's. If multiple channels are in the bridge, the channels will be scanned to find the one with the highest sample rate and the Announcer channel's format will be set to the slin format that has an equal to or greater than sample rate. * The /bridges/record REST API has a new "recorder_format" parameter that allows the caller to explicitly set the format on the "Recorder" channel from which audio is retrieved to write to the file. If not specified, the Recorder channel's format will be set to the format that was requested to save the audio in. Resolves: #1479 DeveloperNote: The ARI /bridges/play and /bridges/record REST APIs have new parameters that allow the caller to specify the format to be used on the "Announcer" and "Recorder" channels respecitvely.
This commit is contained in:
@@ -1044,6 +1044,10 @@ int ast_ari_bridges_play_parse_body(
|
||||
args->media[0] = ast_json_string_get(field);
|
||||
}
|
||||
}
|
||||
field = ast_json_object_get(body, "announcer_format");
|
||||
if (field) {
|
||||
args->announcer_format = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "lang");
|
||||
if (field) {
|
||||
args->lang = ast_json_string_get(field);
|
||||
@@ -1128,6 +1132,9 @@ static void ast_ari_bridges_play_cb(
|
||||
args.media[j] = (vals[j]);
|
||||
}
|
||||
} else
|
||||
if (strcmp(i->name, "announcer_format") == 0) {
|
||||
args.announcer_format = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "lang") == 0) {
|
||||
args.lang = (i->value);
|
||||
} else
|
||||
@@ -1164,6 +1171,7 @@ static void ast_ari_bridges_play_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Bridge not found */
|
||||
case 409: /* Bridge not in a Stasis application */
|
||||
case 422: /* The format specified is unknown on this system */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1223,6 +1231,10 @@ int ast_ari_bridges_play_with_id_parse_body(
|
||||
args->media[0] = ast_json_string_get(field);
|
||||
}
|
||||
}
|
||||
field = ast_json_object_get(body, "announcer_format");
|
||||
if (field) {
|
||||
args->announcer_format = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "lang");
|
||||
if (field) {
|
||||
args->lang = ast_json_string_get(field);
|
||||
@@ -1303,6 +1315,9 @@ static void ast_ari_bridges_play_with_id_cb(
|
||||
args.media[j] = (vals[j]);
|
||||
}
|
||||
} else
|
||||
if (strcmp(i->name, "announcer_format") == 0) {
|
||||
args.announcer_format = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "lang") == 0) {
|
||||
args.lang = (i->value);
|
||||
} else
|
||||
@@ -1339,6 +1354,7 @@ static void ast_ari_bridges_play_with_id_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Bridge not found */
|
||||
case 409: /* Bridge not in a Stasis application */
|
||||
case 422: /* The format specified is unknown on this system */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1377,6 +1393,10 @@ int ast_ari_bridges_record_parse_body(
|
||||
if (field) {
|
||||
args->format = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "recorder_format");
|
||||
if (field) {
|
||||
args->recorder_format = ast_json_string_get(field);
|
||||
}
|
||||
field = ast_json_object_get(body, "maxDurationSeconds");
|
||||
if (field) {
|
||||
args->max_duration_seconds = ast_json_integer_get(field);
|
||||
@@ -1428,6 +1448,9 @@ static void ast_ari_bridges_record_cb(
|
||||
if (strcmp(i->name, "format") == 0) {
|
||||
args.format = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "recorder_format") == 0) {
|
||||
args.recorder_format = (i->value);
|
||||
} else
|
||||
if (strcmp(i->name, "maxDurationSeconds") == 0) {
|
||||
args.max_duration_seconds = atoi(i->value);
|
||||
} else
|
||||
|
Reference in New Issue
Block a user