summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2017-02-22 23:26:13 -0600
committerRichard Mudgett <rmudgett@digium.com>2017-03-17 09:52:00 -0600
commit8cb4f9cea1f8a34d2383551a971a86d3be02c4fd (patch)
treea10ec28350890602a765524ea8300fcb841634ac /funcs
parent732367e8066539a6551e22f75fbf280fed780e9d (diff)
CHANNEL(callid): Give dialplan access to the callid.
* 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
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_channel.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 27e9f41bf..eb3ceddb4 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -233,6 +233,10 @@
<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;