summaryrefslogtreecommitdiff
path: root/channels/pjsip
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-01-05 17:53:42 +0000
committerJoshua Colp <jcolp@digium.com>2015-01-05 17:53:42 +0000
commitf7cf988a82c02d835cc4fcc7f81011319d7ef643 (patch)
treee95c076e6e65081c7991be8e74326aa22dd406ca /channels/pjsip
parent8d059c3808e89338ddb5380379784ef722ff3dce (diff)
pjsip: Add 'PJSIP_AOR' and 'PJSIP_CONTACT' dialplan functions.
The PJSIP_AOR dialplan function allows inspection of configured AORs including what contacts are currently bound to them. The PJSIP_CONTACT dialplan function allows inspection of contacts in existence. These can include both externally added (by way of registration) or permanent ones. ASTERISK-24341 Reported by: xrobau Review: https://reviewboard.asterisk.org/r/4308/ ........ Merged revisions 430179 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/pjsip')
-rw-r--r--channels/pjsip/dialplan_functions.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index 018b1e6c1..704f6a4b2 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -298,6 +298,18 @@
Use the <replaceable>PJSIP_ENDPOINT</replaceable> function to obtain
further endpoint related information.</para>
</enum>
+ <enum name="contact">
+ <para>R/O The name of the contact associated with this channel.
+ Use the <replaceable>PJSIP_CONTACT</replaceable> function to obtain
+ further contact related information. Note this may not be present and if so
+ is only available on outgoing legs.</para>
+ </enum>
+ <enum name="aor">
+ <para>R/O The name of the AOR associated with this channel.
+ Use the <replaceable>PJSIP_AOR</replaceable> function to obtain
+ further AOR related information. Note this may not be present and if so
+ is only available on outgoing legs.</para>
+ </enum>
<enum name="pjsip">
<para>R/O Obtain information about the current PJSIP channel and its
session.</para>
@@ -671,6 +683,28 @@ static int read_pjsip(void *data)
return -1;
}
snprintf(func_args->buf, func_args->len, "%s", ast_sorcery_object_get_id(pvt->session->endpoint));
+ } else if (!strcmp(func_args->param, "contact")) {
+ struct ast_sip_channel_pvt *pvt = ast_channel_tech_pvt(func_args->chan);
+
+ if (!pvt) {
+ ast_log(AST_LOG_WARNING, "Channel %s has no pvt!\n", ast_channel_name(func_args->chan));
+ return -1;
+ }
+ if (!pvt->session || !pvt->session->contact) {
+ return 0;
+ }
+ snprintf(func_args->buf, func_args->len, "%s", ast_sorcery_object_get_id(pvt->session->contact));
+ } else if (!strcmp(func_args->param, "aor")) {
+ struct ast_sip_channel_pvt *pvt = ast_channel_tech_pvt(func_args->chan);
+
+ if (!pvt) {
+ ast_log(AST_LOG_WARNING, "Channel %s has no pvt!\n", ast_channel_name(func_args->chan));
+ return -1;
+ }
+ if (!pvt->session || !pvt->session->aor) {
+ return 0;
+ }
+ snprintf(func_args->buf, func_args->len, "%s", ast_sorcery_object_get_id(pvt->session->aor));
} else if (!strcmp(func_args->param, "pjsip")) {
func_args->ret = channel_read_pjsip(func_args->chan, func_args->type,
func_args->field, func_args->buf,