<p>sungtae kim has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7771">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Added AMI action PJSIPShowAors<br><br>- #27537<br>- Added AMI action, PJSIPShowAors.<br>- It return all of aors info.<br><br>Change-Id: If8b990a00909e5b6c0f04a3b8dccd9903dc445eb<br>---<br>M res/res_pjsip.c<br>M res/res_pjsip/location.c<br>2 files changed, 136 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/71/7771/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip.c b/res/res_pjsip.c<br>index c08e15b..cdcfa6e 100644<br>--- a/res/res_pjsip.c<br>+++ b/res/res_pjsip.c<br>@@ -2267,6 +2267,49 @@<br> </syntax><br> </managerEventInstance><br> </managerEvent><br>+ <managerEvent language="en_US" name="AorList"><br>+ <managerEventInstance class="EVENT_FLAG_COMMAND"><br>+ <synopsis>Provide details about an Address of Record (AoR) section.</synopsis><br>+ <syntax><br>+ <parameter name="ObjectType"><br>+ <para>The object's type. This will always be 'aor'.</para><br>+ </parameter><br>+ <parameter name="ObjectName"><br>+ <para>The name of this object.</para><br>+ </parameter><br>+ <parameter name="MinimumExpiration"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='minimum_expiration']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="MaximumExpiration"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='maximum_expiration']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="DefaultExpiration"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='default_expiration']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="QualifyFrequency"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='qualify_frequency']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="AuthenticateQualify"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='authenticate_qualify']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="MaxContacts"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='max_contacts']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="RemoveExisting"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='remove_existing']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="Mailboxes"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='mailboxes']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="OutboundProxy"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='outbound_proxy']/synopsis/node())"/></para><br>+ </parameter><br>+ <parameter name="SupportPath"><br>+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='aor']/configOption[@name='support_path']/synopsis/node())"/></para><br>+ </parameter><br>+ </syntax><br>+ </managerEventInstance><br>+ </managerEvent><br> <managerEvent language="en_US" name="ContactStatusDetail"><br> <managerEventInstance class="EVENT_FLAG_COMMAND"><br> <synopsis>Provide details about a contact's status.</synopsis><br>@@ -2426,6 +2469,34 @@<br> </managerEvent><br> </responses><br> </manager><br>+ <manager name="PJSIPShowAors" language="en_US"><br>+ <synopsis><br>+ Lists PJSIP aors.<br>+ </synopsis><br>+ <syntax /><br>+ <description><br>+ <para><br>+ Provides a listing of all aors. For each aor an <literal>AorList</literal> event<br>+ is raised that contains relevant attributes and status information. Once all<br>+ aors have been listed an <literal>AorListComplete</literal> event is issued.<br>+ </para><br>+ </description><br>+ <responses><br>+ <list-elements><br>+ <xi:include xpointer="xpointer(/docs/managerEvent[@name='AorList'])" /><br>+ </list-elements><br>+ <managerEvent language="en_US" name="AorListComplete"><br>+ <managerEventInstance class="EVENT_FLAG_COMMAND"><br>+ <synopsis>Provide final information about an aor list.</synopsis><br>+ <syntax><br>+ <parameter name="EventList"/><br>+ <parameter name="ListItems"/><br>+ </syntax><br>+ </managerEventInstance><br>+ </managerEvent><br>+ </responses><br>+ </manager><br>+<br> ***/<br> <br> #define MOD_DATA_CONTACT "contact"<br>diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c<br>index 7483a5b..04cfe6c 100644<br>--- a/res/res_pjsip/location.c<br>+++ b/res/res_pjsip/location.c<br>@@ -1179,6 +1179,67 @@<br> return 0;<br> }<br> <br>+static struct ao2_container *ast_sip_get_aors(void)<br>+{<br>+ struct ao2_container *aors;<br>+<br>+ aors = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "aor",<br>+ AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);<br>+<br>+ return aors;<br>+}<br>+<br>+static int format_ami_aorlist_handler(void *obj, void *arg, int flags)<br>+{<br>+ struct ast_sip_aor *aor = obj;<br>+ struct ast_sip_ami *ami = arg;<br>+ struct ast_str *buf;<br>+ int total_contacts;<br>+ int num_permanent;<br>+<br>+ buf = ast_sip_create_ami_event("AorList", ami);<br>+ if (!buf) {<br>+ return -1;<br>+ }<br>+<br>+ sip_aor_to_ami(aor, &buf);<br>+<br>+ astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));<br>+ ami->count++;<br>+<br>+ ast_free(buf);<br>+<br>+ return 0;<br>+}<br>+<br>+static int ami_show_aors(struct mansession *s, const struct message *m)<br>+{<br>+ struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), };<br>+ RAII_VAR(struct ao2_container *, aors, NULL, ao2_cleanup);<br>+ int num;<br>+<br>+ aors = ast_sip_get_aors();<br>+ if (!aors) {<br>+ astman_send_error(s, m, "Could not get aors\n");<br>+ return 0;<br>+ }<br>+<br>+ if (!(num = ao2_container_count(aors))) {<br>+ astman_send_error(s, m, "No aors found\n");<br>+ return 0;<br>+ }<br>+<br>+ astman_send_listack(s, m, "A listing of Aors follows, presented as AorList events",<br>+ "start");<br>+<br>+ ao2_callback(aors, OBJ_NODATA, format_ami_aorlist_handler, &ami);<br>+<br>+ astman_send_list_complete_start(s, m, "AorListComplete", ami.count);<br>+ astman_send_list_complete_end(s);<br>+<br>+ return 0;<br>+}<br>+<br> static struct ast_cli_entry cli_commands[] = {<br> AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Aors",<br> .command = "pjsip list aors",<br>@@ -1237,6 +1298,10 @@<br> struct ast_sorcery *sorcery = ast_sip_get_sorcery();<br> int i;<br> <br>+ if (ast_manager_register_xml("PJSIPShowAors", EVENT_FLAG_SYSTEM, ami_show_aors)) {<br>+ return -1;<br>+ }<br>+<br> ast_pjproject_get_buildopt("PJ_MAX_HOSTNAME", "%d", &pj_max_hostname);<br> /* As of pjproject 2.4.5, PJSIP_MAX_URL_SIZE isn't exposed yet but we try anyway. */<br> ast_pjproject_get_buildopt("PJSIP_MAX_URL_SIZE", "%d", &pjsip_max_url_size);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7771">change 7771</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7771"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: If8b990a00909e5b6c0f04a3b8dccd9903dc445eb </div>
<div style="display:none"> Gerrit-Change-Number: 7771 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>