mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 02:48:29 +00:00
Split Hold event into Hold/Unhold, and move it into core.
(closes issue ASTERISK-21487) Review: https://reviewboard.asterisk.org/r/2565/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1353,9 +1353,11 @@ static void publish_channel_blob(struct ast_channel *chan,
|
||||
struct stasis_message_type *type, struct ast_json *blob)
|
||||
{
|
||||
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
|
||||
if (blob) {
|
||||
message = ast_channel_blob_create(chan, type, blob);
|
||||
if (!blob) {
|
||||
blob = ast_json_null();
|
||||
}
|
||||
|
||||
message = ast_channel_blob_create(chan, type, blob);
|
||||
if (message) {
|
||||
stasis_publish(ast_channel_topic(chan), message);
|
||||
}
|
||||
@@ -1405,6 +1407,39 @@ int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
|
||||
{
|
||||
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
||||
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HOLD };
|
||||
int res;
|
||||
|
||||
if (!ast_strlen_zero(musicclass)) {
|
||||
f.data.ptr = (void *) musicclass;
|
||||
f.datalen = strlen(musicclass) + 1;
|
||||
|
||||
blob = ast_json_pack("{s: s}",
|
||||
"musicclass", musicclass);
|
||||
}
|
||||
|
||||
publish_channel_blob(chan, ast_channel_hold_type(), blob);
|
||||
|
||||
res = ast_queue_frame(chan, &f);
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_queue_unhold(struct ast_channel *chan)
|
||||
{
|
||||
RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_UNHOLD };
|
||||
int res;
|
||||
|
||||
publish_channel_blob(chan, ast_channel_unhold_type(), NULL);
|
||||
|
||||
res = ast_queue_frame(chan, &f);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*! \brief Queue a control frame */
|
||||
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
|
||||
{
|
||||
@@ -6694,7 +6729,7 @@ static void masquerade_colp_transfer(struct ast_channel *transferee, struct xfer
|
||||
|
||||
/* Release any hold on the target. */
|
||||
if (colp->target_held) {
|
||||
ast_queue_control(transferee, AST_CONTROL_UNHOLD);
|
||||
ast_queue_unhold(transferee);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user