Merge "ARI: Add duplicate channel ID checking for channel creation."
This commit is contained in:
commit
0af69e4454
|
@ -1828,7 +1828,12 @@ void ast_ari_channels_create(struct ast_variable *headers,
|
||||||
ao2_cleanup(request_cap);
|
ao2_cleanup(request_cap);
|
||||||
|
|
||||||
if (!chan_data->chan) {
|
if (!chan_data->chan) {
|
||||||
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_channel_cleanup(originator);
|
ast_channel_cleanup(originator);
|
||||||
chan_data_destroy(chan_data);
|
chan_data_destroy(chan_data);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -386,6 +386,7 @@ static void ast_ari_channels_create_cb(
|
||||||
break;
|
break;
|
||||||
case 500: /* Internal Server Error */
|
case 500: /* Internal Server Error */
|
||||||
case 501: /* Not Implemented */
|
case 501: /* Not Implemented */
|
||||||
|
case 409: /* Channel with given unique ID already exists. */
|
||||||
is_valid = 1;
|
is_valid = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -217,6 +217,12 @@
|
||||||
"allowMultiple": false,
|
"allowMultiple": false,
|
||||||
"dataType": "string"
|
"dataType": "string"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"errorResponses": [
|
||||||
|
{
|
||||||
|
"code": 409,
|
||||||
|
"reason": "Channel with given unique ID already exists."
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue