mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-09 14:36:48 +00:00
res_pjsip: Add AMI action 'PJSIPShowAors'
Add an AMI action which provides information on all configured AORs. ASTERISK-27537 Change-Id: If8b990a00909e5b6c0f04a3b8dccd9903dc445eb
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -43,6 +43,11 @@ app_queue
|
||||
When set the wrapuptime on the member is used instead of the wrapuptime
|
||||
defined for the queue itself.
|
||||
|
||||
res_pjsip
|
||||
------------------
|
||||
* A new AMI action, PJSIPShowAors, has been added which displays information
|
||||
about all configured PJSIP AORs.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
--- Functionality changes from Asterisk 15.1.0 to Asterisk 15.2.0 ------------
|
||||
------------------------------------------------------------------------------
|
||||
|
@@ -2266,6 +2266,49 @@
|
||||
</parameter>
|
||||
</syntax>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
<managerEvent language="en_US" name="AorList">
|
||||
<managerEventInstance class="EVENT_FLAG_COMMAND">
|
||||
<synopsis>Provide details about an Address of Record (AoR) section.</synopsis>
|
||||
<syntax>
|
||||
<parameter name="ObjectType">
|
||||
<para>The object's type. This will always be 'aor'.</para>
|
||||
</parameter>
|
||||
<parameter name="ObjectName">
|
||||
<para>The name of this object.</para>
|
||||
</parameter>
|
||||
<parameter name="MinimumExpiration">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='minimum_expiration']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="MaximumExpiration">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='maximum_expiration']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="DefaultExpiration">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='default_expiration']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="QualifyFrequency">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='qualify_frequency']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="AuthenticateQualify">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='authenticate_qualify']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="MaxContacts">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='max_contacts']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="RemoveExisting">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='remove_existing']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="Mailboxes">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='mailboxes']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="OutboundProxy">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='outbound_proxy']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
<parameter name="SupportPath">
|
||||
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='support_path']/synopsis/node())"/></para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
<managerEvent language="en_US" name="ContactStatusDetail">
|
||||
<managerEventInstance class="EVENT_FLAG_COMMAND">
|
||||
@@ -2426,6 +2469,34 @@
|
||||
</managerEvent>
|
||||
</responses>
|
||||
</manager>
|
||||
<manager name="PJSIPShowAors" language="en_US">
|
||||
<synopsis>
|
||||
Lists PJSIP AORs.
|
||||
</synopsis>
|
||||
<syntax />
|
||||
<description>
|
||||
<para>
|
||||
Provides a listing of all AORs. For each AOR an <literal>AorList</literal> event
|
||||
is raised that contains relevant attributes and status information. Once all
|
||||
aors have been listed an <literal>AorListComplete</literal> event is issued.
|
||||
</para>
|
||||
</description>
|
||||
<responses>
|
||||
<list-elements>
|
||||
<xi:include xpointer="xpointer(/docs/managerEvent[@name='AorList'])" />
|
||||
</list-elements>
|
||||
<managerEvent language="en_US" name="AorListComplete">
|
||||
<managerEventInstance class="EVENT_FLAG_COMMAND">
|
||||
<synopsis>Provide final information about an aor list.</synopsis>
|
||||
<syntax>
|
||||
<parameter name="EventList"/>
|
||||
<parameter name="ListItems"/>
|
||||
</syntax>
|
||||
</managerEventInstance>
|
||||
</managerEvent>
|
||||
</responses>
|
||||
</manager>
|
||||
|
||||
***/
|
||||
|
||||
#define MOD_DATA_CONTACT "contact"
|
||||
|
@@ -1179,6 +1179,67 @@ static int cli_aor_print_body(void *obj, void *arg, int flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ao2_container *cli_get_aors(void)
|
||||
{
|
||||
struct ao2_container *aors;
|
||||
|
||||
aors = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "aor",
|
||||
AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
|
||||
|
||||
return aors;
|
||||
}
|
||||
|
||||
static int format_ami_aorlist_handler(void *obj, void *arg, int flags)
|
||||
{
|
||||
struct ast_sip_aor *aor = obj;
|
||||
struct ast_sip_ami *ami = arg;
|
||||
struct ast_str *buf;
|
||||
|
||||
buf = ast_sip_create_ami_event("AorList", ami);
|
||||
if (!buf) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
sip_aor_to_ami(aor, &buf);
|
||||
|
||||
astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));
|
||||
ami->count++;
|
||||
|
||||
ast_free(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ami_show_aors(struct mansession *s, const struct message *m)
|
||||
{
|
||||
struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), };
|
||||
struct ao2_container *aors;
|
||||
|
||||
aors = cli_get_aors();
|
||||
if (!aors) {
|
||||
astman_send_error(s, m, "Could not get AORs\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ao2_container_count(aors)) {
|
||||
astman_send_error(s, m, "No AORs found\n");
|
||||
ao2_ref(aors, -1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
astman_send_listack(s, m, "A listing of AORs follows, presented as AorList events",
|
||||
"start");
|
||||
|
||||
ao2_callback(aors, OBJ_NODATA, format_ami_aorlist_handler, &ami);
|
||||
|
||||
astman_send_list_complete_start(s, m, "AorListComplete", ami.count);
|
||||
astman_send_list_complete_end(s);
|
||||
|
||||
ao2_ref(aors, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_commands[] = {
|
||||
AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Aors",
|
||||
.command = "pjsip list aors",
|
||||
@@ -1317,6 +1378,10 @@ int ast_sip_initialize_sorcery_location(void)
|
||||
ast_sip_register_cli_formatter(aor_formatter);
|
||||
ast_cli_register_multiple(cli_commands, ARRAY_LEN(cli_commands));
|
||||
|
||||
if (ast_manager_register_xml("PJSIPShowAors", EVENT_FLAG_SYSTEM, ami_show_aors)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset StatsD gauges in case we didn't shut down cleanly.
|
||||
* Note that this must done here, as contacts will create the contact_status
|
||||
@@ -1335,6 +1400,7 @@ int ast_sip_destroy_sorcery_location(void)
|
||||
ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
|
||||
ast_sip_unregister_cli_formatter(contact_formatter);
|
||||
ast_sip_unregister_cli_formatter(aor_formatter);
|
||||
ast_manager_unregister("PJSIPShowAors");
|
||||
|
||||
internal_sip_unregister_endpoint_formatter(&endpoint_aor_formatter);
|
||||
|
||||
|
Reference in New Issue
Block a user