summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorAndre Nazario <samoied@users.sourceforge.net>2017-08-25 23:06:10 -0300
committerAndre Nazario <samoied@users.sourceforge.net>2017-08-30 07:49:55 -0500
commitcebfad9dcb2f0125b03cc8863235ccecae57dfea (patch)
tree83c4e3089037e8b84d8bbd6fc7e3f6fe3ed2ee75 /channels
parent9bce4d0670ae69acc4745c00cfe6938c6674b20d (diff)
chan_pjsip: Add tag info in CHANNEL function
Create local_tag and remote_tag in CHANNEL info to get tag from From and To headers of a SIP dialog. ASTERISK-27220 Change-Id: I59b16c4b928896fcbde02ad88f0e98922b15d524
Diffstat (limited to 'channels')
-rw-r--r--channels/pjsip/dialplan_functions.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index 857684af6..ff1b9b78f 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -393,9 +393,15 @@
<enum name="local_uri">
<para>The local URI.</para>
</enum>
+ <enum name="local_tag">
+ <para>Tag in From header</para>
+ </enum>
<enum name="remote_uri">
<para>The remote URI.</para>
</enum>
+ <enum name="remote_tag">
+ <para>Tag in To header</para>
+ </enum>
<enum name="t38state">
<para>The current state of any T.38 fax on this channel.</para>
<enumlist>
@@ -691,10 +697,18 @@ static int channel_read_pjsip(struct ast_channel *chan, const char *type, const
pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, dlg->local.info->uri, buf, buflen);
buf_copy = ast_strdupa(buf);
ast_escape_quoted(buf_copy, buf, buflen);
+ } else if (!strcmp(type, "local_tag")) {
+ ast_copy_pj_str(buf, &dlg->local.info->tag, buflen);
+ buf_copy = ast_strdupa(buf);
+ ast_escape_quoted(buf_copy, buf, buflen);
} else if (!strcmp(type, "remote_uri")) {
pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, dlg->remote.info->uri, buf, buflen);
buf_copy = ast_strdupa(buf);
ast_escape_quoted(buf_copy, buf, buflen);
+ } else if (!strcmp(type, "remote_tag")) {
+ ast_copy_pj_str(buf, &dlg->remote.info->tag, buflen);
+ buf_copy = ast_strdupa(buf);
+ ast_escape_quoted(buf_copy, buf, buflen);
} else if (!strcmp(type, "t38state")) {
ast_copy_string(buf, t38state_to_string[channel->session->t38state], buflen);
} else if (!strcmp(type, "local_addr")) {