diff options
author | Matt Jordan <mjordan@digium.com> | 2015-09-05 14:58:41 -0500 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2015-09-05 15:25:44 -0500 |
commit | 86b02228f514982a962b572c7baf43ffb617299b (patch) | |
tree | 1d46b3d9212f6b7550e61811820ec7ea187e070d /channels/pjsip | |
parent | 6b8734fe6890dfa4754b07eceaab52a4712297a9 (diff) |
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
Diffstat (limited to 'channels/pjsip')
-rw-r--r-- | channels/pjsip/dialplan_functions.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c index 24daac8dc..b86cfad53 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 @@ 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; |