ARI: Correct error codes for bridge operations

This patch adds error checking to ARI bridge operations, when
adding/removing channels to/from bridges.

In general, the error codes fall out as follows:
 * Bridge not found - 404 Not Found
 * Bridge not in Stasis - 409 Conflict
 * Channel not found - 400 Bad Request
 * Channel not in Stasis - 422 Unprocessable Entity
 * Channel not in this bridge (on remove) - 422 Unprocessable Entity

(closes issue ASTERISK-22036)
Review: https://reviewboard.asterisk.org/r/2769/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David M. Lee
2013-08-23 17:19:02 +00:00
parent 9f4849724f
commit 7a581537e8
6 changed files with 90 additions and 34 deletions

View File

@@ -361,8 +361,10 @@ int stasis_app_bridge_moh_stop(
*
* \param control Control whose channel should be added to the bridge
* \param bridge Pointer to the bridge
* \return non-zero on failure
* \return zero on success
*/
void stasis_app_control_add_channel_to_bridge(
int stasis_app_control_add_channel_to_bridge(
struct stasis_app_control *control, struct ast_bridge *bridge);
/*!
@@ -370,10 +372,22 @@ void stasis_app_control_add_channel_to_bridge(
*
* \param control Control whose channel should be removed from the bridge
* \param bridge Pointer to the bridge
* \return non-zero on failure
* \return zero on success
*/
void stasis_app_control_remove_channel_from_bridge(
int stasis_app_control_remove_channel_from_bridge(
struct stasis_app_control *control, struct ast_bridge *bridge);
/*!
* \since 12
* \brief Gets the bridge currently associated with a control object.
*
* \param control Control object for the channel to query.
* \return Associated \ref ast_bridge.
* \return \c NULL if not associated with a bridge.
*/
struct ast_bridge *stasis_app_get_bridge(struct stasis_app_control *control);
/*!
* \brief Destroy the bridge.
*