]> git.ipfire.org Git - thirdparty/asterisk.git/commit
ARI: Detect duplicate channel IDs 55/4155/3
authorMark Michelson <mmichelson@digium.com>
Mon, 17 Oct 2016 19:18:57 +0000 (14:18 -0500)
committerMark Michelson <mmichelson@digium.com>
Thu, 20 Oct 2016 17:59:06 +0000 (12:59 -0500)
commite459b8dadf42a3a015b312dfa9aadf507b4c85d9
tree283ece75c7142c563e26a85e616a7cb50a91d5ca
parente03364c40aa073b69ca8c6652fd17a91908b9aaf
ARI: Detect duplicate channel IDs

ARI and AMI allow for an explicit channel ID to be specified
when originating channels. Unfortunately, there is nothing in
place to prevent someone from using the same ID for multiple
channels. Further complicating things, adding ID validation to channel
allocation makes it impossible for ARI to discern why channel allocation
failed, resulting in a vague error code being returned.

The fix for this is to institute a new method for channel errors to be
discerned. The method mirrors errno, in that when an error occurs, the
caller can consult the channel errno value to determine what the error
was. This initial iteration of the feature only introduces "unknown" and
"channel ID exists" errors. However, it's possible to add more errors as
needed.

ARI uses this feature to determine why channel allocation failed and can
return a 409 error during origination to show that a channel with the
given ID already exists.

ASTERISK-26421

Change-Id: Ibba7ae68842dab6df0c2e9c45559208bc89d3d06
include/asterisk/channel.h
include/asterisk/channel_internal.h
main/channel.c
main/channel_internal_api.c
res/ari/resource_channels.c
res/res_ari_channels.c
rest-api/api-docs/channels.json