From 86b02228f514982a962b572c7baf43ffb617299b Mon Sep 17 00:00:00 2001 From: Matt Jordan Date: Sat, 5 Sep 2015 14:58:41 -0500 Subject: [PATCH] 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 --- CHANGES | 12 ++++++++++++ channels/pjsip/dialplan_functions.c | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/CHANGES b/CHANGES index 322419d4c1..8c8329cb0c 100644 --- a/CHANGES +++ b/CHANGES @@ -177,6 +177,18 @@ cdr_adaptive_odbc names. This setting is configurable for cdr_adaptive_odbc via the quoted_identifiers in configuration file cdr_adaptive_odbc.conf. + +------------------------------------------------------------------------------ +--- 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 24daac8dcf..b86cfad536 100644 --- a/channels/pjsip/dialplan_functions.c +++ b/channels/pjsip/dialplan_functions.c @@ -318,6 +318,9 @@ type parameter must be provided. It specifies which signalling parameter to read. + + The SIP call-id. + Whether or not the signalling uses a secure transport. @@ -594,6 +597,8 @@ static int channel_read_pjsip(struct ast_channel *chan, const char *type, const 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;