]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
CHANNEL(callid): Give dialplan access to the callid.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 23 Feb 2017 05:26:13 +0000 (23:26 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 17 Mar 2017 15:52:00 +0000 (09:52 -0600)
* Added CHANNEL(callid) to retrieve the call identifier log tag associated
with the channel.  Dialplan now has access to the call log search key
associated with the channel so it can be saved in case there is a problem
with the call.

ASTERISK-26878

Change-Id: I2c97ebd928b6f3c5bc80c5729e4d3c07f453049f

CHANGES
funcs/func_channel.c

diff --git a/CHANGES b/CHANGES
index e391d1e1749402037ea92bd7b1b3a8bc1a42bf5a..ea67101eaac92011fe5aa19d783f09857b637c59 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -118,6 +118,13 @@ app_voicemail
  * Added 'fromstring' field to the voicemail boxes. If set, it will override
    the global 'fromstring' field on a per-mailbox basis.
 
+func_channel
+------------------
+ * Added CHANNEL(callid) to retrieve the call log tag associated with the
+   channel.  e.g., [C-00000000]  Dialplan now has access to the call log
+   search key associated with the channel so it can be saved in case there
+   is a problem with the call.
+
 res_pjsip
 ------------------
  * A new transport parameter 'symmetric_transport' has been added.
index 27e9f41bf7d2f341b2d92336f4b180b3cfe4c1bf..eb3ceddb45aeae58a3adc6857905dcbad87e95e3 100644 (file)
                                        <enum name="max_forwards">
                                                <para>R/W The maximum number of forwards allowed.</para>
                                        </enum>
+                                       <enum name="callid">
+                                               <para>R/O Call identifier log tag associated with the channel
+                                               e.g., <literal>[C-00000000]</literal>.</para>
+                                       </enum>
                                </enumlist>
                                <xi:include xpointer="xpointer(/docs/info[@name='CHANNEL'])" />
                        </parameter>
@@ -450,6 +454,16 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
                ast_channel_lock(chan);
                snprintf(buf, len, "%d", ast_max_forwards_get(chan));
                ast_channel_unlock(chan);
+       } else if (!strcasecmp(data, "callid")) {
+               ast_callid callid;
+
+               buf[0] = '\0';
+               ast_channel_lock(chan);
+               callid = ast_channel_callid(chan);
+               if (callid) {
+                       ast_callid_strnprint(buf, len, callid);
+               }
+               ast_channel_unlock(chan);
        } else if (!ast_channel_tech(chan) || !ast_channel_tech(chan)->func_channel_read || ast_channel_tech(chan)->func_channel_read(chan, function, data, buf, len)) {
                ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n", data);
                ret = -1;