pjsip_options: Fix non-qualified contacts showing as unavailable

The "Add qualify_timeout processing and eventing" patch introduced
an issue where contacts that had qualify_frequency set to 0 were
showing Unavailable instead Unknown.  This patch checks for
qualify_frequency=0 and create an "Unknown"  contact_status
with an RTT = 0.

Previously, the lack of contact_status implied Unknown but since
we're now changing endpoint state based on contact_status, I've
had to add new UNKNOWN status so that changes could trigger the
appropriate contact_status observers.

ASTERISK-24977: #close

Change-Id: Ifcbc01533ce57f0e4e584b89a395326e098b8fe7
This commit is contained in:
George Joseph
2015-04-18 12:36:19 -06:00
parent e05b076827
commit 63169e00ff
5 changed files with 51 additions and 41 deletions

View File

@@ -86,7 +86,7 @@ static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
contact_status = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(),
CONTACT_STATUS, contact_id);
if (contact_status && contact_status->status == AVAILABLE) {
if (contact_status && contact_status->status != UNAVAILABLE) {
state = AST_ENDPOINT_ONLINE;
}
ao2_cleanup(contact_status);
@@ -184,10 +184,10 @@ static void persistent_endpoint_contact_status_observer(const void *object)
"Contact: %s\r\n"
"Status: %s",
ast_sorcery_object_get_id(contact_status),
(contact_status->status == AVAILABLE ? "Available" : "Unavailable"));
ast_sip_get_contact_status_label(contact_status->status));
ast_verb(1, "Contact %s/%s is now %s\n", aor, contact,
contact_status->status == AVAILABLE ? "Available" : "Unavailable");
ast_sip_get_contact_status_label(contact_status->status));
ao2_callback(persistent_endpoints, OBJ_NODATA, persistent_endpoint_update_state, aor);
}