Merge "ARI: Detect duplicate channel IDs" into 13

This commit is contained in:
Joshua Colp
2016-10-24 18:20:33 -05:00
committed by Gerrit Code Review
7 changed files with 101 additions and 6 deletions

View File

@@ -1109,7 +1109,12 @@ static void ari_channels_handle_originate_with_id(const char *args_endpoint,
}
if (ast_dial_prerun(dial, other, format_cap)) {
ast_ari_response_alloc_failed(response);
if (ast_channel_errno() == AST_CHANNEL_ERROR_ID_EXISTS) {
ast_ari_response_error(response, 409, "Conflict",
"Channel with given unique ID already exists");
} else {
ast_ari_response_alloc_failed(response);
}
ast_dial_destroy(dial);
ast_free(origination);
ast_channel_cleanup(other);

View File

@@ -253,6 +253,7 @@ static void ast_ari_channels_originate_cb(
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
case 400: /* Invalid parameters for originating a channel. */
case 409: /* Channel with given unique ID already exists. */
is_valid = 1;
break;
default:
@@ -483,6 +484,7 @@ static void ast_ari_channels_originate_with_id_cb(
case 500: /* Internal Server Error */
case 501: /* Not Implemented */
case 400: /* Invalid parameters for originating a channel. */
case 409: /* Channel with given unique ID already exists. */
is_valid = 1;
break;
default: