From: Tilghman Lesher Date: Tue, 7 Sep 2010 21:14:03 +0000 (+0000) Subject: Add CHANNEL(checkhangup) to check whether a channel is in the process of being hanged up. X-Git-Tag: 1.8.0-rc1~3^2~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbe6dde6da5e9d0df7dcac6ae3f967258146ce0e;p=thirdparty%2Fasterisk.git Add CHANNEL(checkhangup) to check whether a channel is in the process of being hanged up. (closes issue #17652) Reported by: kobaz Patches: func_channel.patch uploaded by kobaz (license 834) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@285373 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/funcs/func_channel.c b/funcs/func_channel.c index 729bdf45b2..1416efc399 100644 --- a/funcs/func_channel.c +++ b/funcs/func_channel.c @@ -88,6 +88,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") R/O technology used for channel. + + 1/0 whether the channel is hanging up + R/W language for sounds played. @@ -298,7 +301,11 @@ static int func_channel_read(struct ast_channel *chan, const char *function, locked_copy_string(chan, buf, chan->tech->type, len); else if (!strcasecmp(data, "accountcode")) locked_copy_string(chan, buf, chan->accountcode, len); - else if (!strcasecmp(data, "peeraccount")) + else if (!strcasecmp(data, "checkhangup")) { + ast_channel_lock(chan); + ast_copy_string(buf, ast_check_hangup(chan) ? "1" : "0", len); + ast_channel_unlock(chan); + } else if (!strcasecmp(data, "peeraccount")) locked_copy_string(chan, buf, chan->peeraccount, len); else if (!strcasecmp(data, "hangupsource")) locked_copy_string(chan, buf, chan->hangupsource, len);