From 298faf7c500175307f2707897997024859c6f514 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Sat, 18 Apr 2015 12:36:19 -0600 Subject: 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 --- funcs/func_pjsip_contact.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'funcs') diff --git a/funcs/func_pjsip_contact.c b/funcs/func_pjsip_contact.c index fc65ae922..e9737049d 100644 --- a/funcs/func_pjsip_contact.c +++ b/funcs/func_pjsip_contact.c @@ -147,15 +147,9 @@ static int pjsip_contact_function_read(struct ast_channel *chan, contact_status = ast_sorcery_retrieve_by_id(pjsip_sorcery, CONTACT_STATUS, ast_sorcery_object_get_id(contact_obj)); if (!strcmp(args.field_name, "status")) { - if (!contact_status) { - ast_str_set(buf, len, "%s", "Unknown"); - } else if (contact_status->status == UNAVAILABLE) { - ast_str_set(buf, len, "%s", "Unreachable"); - } else if (contact_status->status == AVAILABLE) { - ast_str_set(buf, len, "%s", "Reachable"); - } + ast_str_set(buf, len, "%s", ast_sip_get_contact_status_label(contact_status->status)); } else if (!strcmp(args.field_name, "rtt")) { - if (!contact_status) { + if (contact_status->status == UNKNOWN) { ast_str_set(buf, len, "%s", "N/A"); } else { ast_str_set(buf, len, "%" PRId64, contact_status->rtt); -- cgit v1.2.3