[Asterisk-code-review] channels/pjsip/dialplan functions: Add an option for extract... (asterisk[13])

Matt Jordan asteriskteam at digium.com
Sat Sep 5 15:24:37 CDT 2015


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/1204

Change subject: channels/pjsip/dialplan_functions: Add an option for extracting the SIP call-id
......................................................................

channels/pjsip/dialplan_functions: Add an option for extracting the SIP call-id

This patch adds a new option to the CHANNEL function that allows for the
extraction of the SIP call-id. It is used in conjunction with the 'pjsip'
option, and will return the Call-ID of the INVITE request that established
the PJSIP channel.

ASTERISK-25352

Change-Id: I278d1f8bcfe3a53c5aa1dadebc14e92b0abd476a
---
M CHANGES
M channels/pjsip/dialplan_functions.c
2 files changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/04/1204/1

diff --git a/CHANGES b/CHANGES
index ec5c8a9..c249195 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,17 @@
 ==============================================================================
 
 ------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 13.5.0 to Asterisk 13.6.0 ------------
+------------------------------------------------------------------------------
+
+Dialplan Functions
+------------------
+ * The CHANNEL function, when used on a PJSIP channel, now exposes a 'call-id'
+   extraction option when using with the 'pjsip' signalling option. It will
+   return the SIP Call-ID associated with the INVITE request that established
+   the PJSIP channel.
+
+------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13.4.0 to Asterisk 13.5.0 ------------
 ------------------------------------------------------------------------------
 
diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index 9c52456..eb6def6 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -318,6 +318,9 @@
 				<literal>type</literal> parameter must be provided. It specifies
 				which signalling parameter to read.</para>
 				<enumlist>
+					<enum name="call-id">
+						<para>The SIP call-id.</para>
+					</enum>
 					<enum name="secure">
 						<para>Whether or not the signalling uses a secure transport.</para>
 						<enumlist>
@@ -594,6 +597,8 @@
 	if (ast_strlen_zero(type)) {
 		ast_log(LOG_WARNING, "You must supply a type field for 'pjsip' information\n");
 		return -1;
+	} else if (!strcmp(type, "call-id")) {
+		snprintf(buf, buflen, "%.*s", (int) pj_strlen(&dlg->call_id->id), pj_strbuf(&dlg->call_id->id));
 	} else if (!strcmp(type, "secure")) {
 #ifdef HAVE_PJSIP_GET_DEST_INFO
 		pjsip_host_info dest;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I278d1f8bcfe3a53c5aa1dadebc14e92b0abd476a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list