ARI: Add the ability to intercept hold and raise an event

For some applications - such as SLA - a phone pressing hold should not behave
in the fashion that the Asterisk core would like it to. Instead, the hold
action has some application specific behaviour associated with it - such as
disconnecting the channel that initiated the hold; only playing MoH to channels
in the bridge if the channels are of a particular type, etc.

One way of accomplishing this is to use a framehook to intercept the
hold/unhold frames, raise an event, and eat the frame. Tasty. This patch
accomplishes that using a new dialplan function, HOLD_INTERCEPT.

In addition, some general cleanup of raising hold/unhold Stasis messages was
done, including removing some RAII_VAR usage.

Review: https://reviewboard.asterisk.org/r/4549/

ASTERISK-24922 #close
........

Merged revisions 434216 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2015-04-07 15:22:42 +00:00
parent af4d802773
commit c2f50ba6f4
8 changed files with 325 additions and 10 deletions

View File

@@ -808,6 +808,24 @@ int ast_ari_validate_channel_hangup_request(struct ast_json *json);
*/
ari_validator ast_ari_validate_channel_hangup_request_fn(void);
/*!
* \brief Validator for ChannelHold.
*
* A channel initiated a media hold.
*
* \param json JSON object to validate.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ast_ari_validate_channel_hold(struct ast_json *json);
/*!
* \brief Function pointer to ast_ari_validate_channel_hold().
*
* See \ref ast_ari_model_validators.h for more details.
*/
ari_validator ast_ari_validate_channel_hold_fn(void);
/*!
* \brief Validator for ChannelLeftBridge.
*
@@ -880,6 +898,24 @@ int ast_ari_validate_channel_talking_started(struct ast_json *json);
*/
ari_validator ast_ari_validate_channel_talking_started_fn(void);
/*!
* \brief Validator for ChannelUnhold.
*
* A channel initiated a media unhold.
*
* \param json JSON object to validate.
* \returns True (non-zero) if valid.
* \returns False (zero) if invalid.
*/
int ast_ari_validate_channel_unhold(struct ast_json *json);
/*!
* \brief Function pointer to ast_ari_validate_channel_unhold().
*
* See \ref ast_ari_model_validators.h for more details.
*/
ari_validator ast_ari_validate_channel_unhold_fn(void);
/*!
* \brief Validator for ChannelUserevent.
*
@@ -1393,6 +1429,11 @@ ari_validator ast_ari_validate_application_fn(void);
* - cause: int
* - channel: Channel (required)
* - soft: boolean
* ChannelHold
* - type: string (required)
* - application: string (required)
* - timestamp: Date
* - channel: Channel (required)
* ChannelLeftBridge
* - type: string (required)
* - application: string (required)
@@ -1415,6 +1456,11 @@ ari_validator ast_ari_validate_application_fn(void);
* - application: string (required)
* - timestamp: Date
* - channel: Channel (required)
* ChannelUnhold
* - type: string (required)
* - application: string (required)
* - timestamp: Date
* - channel: Channel (required)
* ChannelUserevent
* - type: string (required)
* - application: string (required)