summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-09-09 16:14:02 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-09-09 16:14:02 +0000
commit9183416fe2e37652507fdedefb826f5fc83eb122 (patch)
treed2f5acf81250b13bbc13e6e7a5420642792bacf6 /funcs
parentbaf99dffac4ce2c445f649701ea19ef9548d84c2 (diff)
func_channel: Add CHANNEL(onhold) item to get the current hold status of the channel.
It would be useful to get the current hold status of a channel. Added CHANNEL(onhold) item that returns 1 (onhold) and 0 (not-onhold) for the hold status of a channel. ASTERISK-24038 Reported by: Matt Jordan AFS-113 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/3983/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_channel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 0ebab2a3e..8eefd6492 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -156,6 +156,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
and exten are supplied by the channel pushing the handler
before it is pushed.</para>
</enum>
+ <enum name="onhold">
+ <para>R/O Whether or not the channel is onhold. (1/0)</para>
+ </enum>
<enum name="language">
<para>R/W language for sounds played.</para>
</enum>
@@ -475,7 +478,10 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
locked_copy_string(chan, buf, ast_channel_parkinglot(chan), len);
else if (!strcasecmp(data, "state"))
locked_copy_string(chan, buf, ast_state2str(ast_channel_state(chan)), len);
- else if (!strcasecmp(data, "channeltype"))
+ else if (!strcasecmp(data, "onhold")) {
+ locked_copy_string(chan, buf,
+ ast_channel_hold_state(chan) == AST_CONTROL_HOLD ? "1" : "0", len);
+ } else if (!strcasecmp(data, "channeltype"))
locked_copy_string(chan, buf, ast_channel_tech(chan)->type, len);
else if (!strcasecmp(data, "accountcode"))
locked_copy_string(chan, buf, ast_channel_accountcode(chan), len);