res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command

The PJSIPShowRegistrationsInbound AMI command was just dumping out
all AORs which was pretty useless and resource heavy since it had
to get all endpoints, then all aors for each endpoint, then all
contacts for each aor.

PJSIPShowRegistrationInboundContactStatuses sends ContactStatusDetail
events which meets the intended purpose of the other command and has
significantly less overhead.  Also, some additional fields that were
added to Contact since the original creation of the ContactStatusDetail
event have been added to the end of the event.

For compatibility purposes, PJSIPShowRegistrationsInbound is left
intact.

ASTERISK-26644 #close

Change-Id: I326f12c9ecb52bf37ba03f0748749de4da01490a
This commit is contained in:
George Joseph
2016-12-06 13:54:25 -07:00
parent 1067b9add3
commit 79b09b5f18
5 changed files with 122 additions and 10 deletions

View File

@@ -1217,7 +1217,7 @@ static void qualify_and_schedule_all(void)
}
static int format_contact_status(void *obj, void *arg, int flags)
int ast_sip_format_contact_ami(void *obj, void *arg, int flags)
{
struct ast_sip_contact_wrapper *wrapper = obj;
struct ast_sip_contact *contact = wrapper->contact;
@@ -1256,7 +1256,15 @@ static int format_contact_status(void *obj, void *arg, int flags)
ast_str_append(&buf, 0, "RoundtripUsec: %" PRId64 "\r\n", status->rtt);
}
ast_str_append(&buf, 0, "EndpointName: %s\r\n",
ast_sorcery_object_get_id(endpoint));
endpoint ? ast_sorcery_object_get_id(endpoint) : S_OR(contact->endpoint_name, ""));
ast_str_append(&buf, 0, "ID: %s\r\n", ast_sorcery_object_get_id(contact));
ast_str_append(&buf, 0, "AuthenticateQualify: %d\r\n", contact->authenticate_qualify);
ast_str_append(&buf, 0, "OutboundProxy: %s\r\n", contact->outbound_proxy);
ast_str_append(&buf, 0, "Path: %s\r\n", contact->path);
ast_str_append(&buf, 0, "QualifyFrequency: %u\r\n", contact->qualify_frequency);
ast_str_append(&buf, 0, "QualifyTimeout: %.3f\r\n", contact->qualify_timeout);
astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));
ami->count++;
@@ -1269,7 +1277,7 @@ static int format_contact_status_for_aor(void *obj, void *arg, int flags)
{
struct ast_sip_aor *aor = obj;
return ast_sip_for_each_contact(aor, format_contact_status, arg);
return ast_sip_for_each_contact(aor, ast_sip_format_contact_ami, arg);
}
static int format_ami_contact_status(const struct ast_sip_endpoint *endpoint,