summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2015-04-07 15:21:17 +0000
committerMatthew Jordan <mjordan@digium.com>2015-04-07 15:21:17 +0000
commitab803ec3422e5377b5aa4769fbcc6b315d167d8b (patch)
treed86d3c961bbd420fd8f99952660159391d956fc6 /main/channel.c
parent488f093e97b52a1337c7f480aac16f27bf3908b1 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index 5efa11870..552f4e0f8 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1193,8 +1193,8 @@ int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
{
- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HOLD };
+ struct ast_json *blob = NULL;
int res;
if (!ast_strlen_zero(musicclass)) {
@@ -1209,6 +1209,8 @@ int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
res = ast_queue_frame(chan, &f);
+ ast_json_unref(blob);
+
return res;
}