mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user