summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2017-03-22 17:26:04 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-03-22 17:26:04 -0500
commit4fcb8d807e88bcf30aa6e2d410a88d1cfedcfe93 (patch)
treeff692096e587086efc8e1b66cdd978fbe690fce7
parentb79e67ba47a5ea0913704c4ca57cda06051c20e7 (diff)
parent60b372a883d97193a98e2eff7a50d1f8762c8dc6 (diff)
Merge "CHANNEL(callid): Give dialplan access to the callid." into 13
-rw-r--r--CHANGES7
-rw-r--r--funcs/func_channel.c15
2 files changed, 22 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 2304d09d7..86dfe76a1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -41,6 +41,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.
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 673de51d0..3273b78c4 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -232,6 +232,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<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>
@@ -446,6 +450,17 @@ 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")) {
+ struct ast_callid *callid;
+
+ buf[0] = '\0';
+ ast_channel_lock(chan);
+ callid = ast_channel_callid(chan);
+ if (callid) {
+ ast_callid_strnprint(buf, len, callid);
+ ast_callid_unref(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;