summaryrefslogtreecommitdiff
path: root/channels/pjsip
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-01-05 17:51:59 +0000
committerJoshua Colp <jcolp@digium.com>2015-01-05 17:51:59 +0000
commita7c38428af5da34b99334ad384976c1330c9b569 (patch)
treef882149799acd33a262d89d6875862bb77a713ba /channels/pjsip
parentcca262e7d32944ae5b0b6f8e0de080be1149bf74 (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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430179 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 2cc4f9c74..03e4cbe1f 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,