[Asterisk-code-review] CHANNEL(callid): Give dialplan access to the callid. (asterisk[14])

Richard Mudgett asteriskteam at digium.com
Thu Mar 16 00:27:20 CDT 2017


Richard Mudgett has uploaded a new change for review. ( https://gerrit.asterisk.org/5223 )

Change subject: CHANNEL(callid): Give dialplan access to the callid.
......................................................................

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
---
M CHANGES
M funcs/func_channel.c
2 files changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/23/5223/1

diff --git a/CHANGES b/CHANGES
index 5f3a51f..8314f39 100644
--- a/CHANGES
+++ b/CHANGES
@@ -41,6 +41,13 @@
  * 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_transport_websocket
 ------------------
  * Removed non-secure websocket support.  Firefox and Chrome have not allowed
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index e816dca..26ef1b2 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -235,6 +235,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>
@@ -452,6 +456,16 @@
 		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;

-- 
To view, visit https://gerrit.asterisk.org/5223
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c97ebd928b6f3c5bc80c5729e4d3c07f453049f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list