diff options
author | George Joseph <george.joseph@fairview5.com> | 2015-04-18 12:36:19 -0600 |
---|---|---|
committer | George Joseph <george.joseph@fairview5.com> | 2015-04-19 18:45:39 -0600 |
commit | 63169e00ff21d528e40568dec6dcfd0114b55c48 (patch) | |
tree | 1b47b1390e4dfb184e0fc7cf399656d6134f1e8a /funcs | |
parent | e05b0768278a4d697f8b02d1fb81a8c602fc6516 (diff) |
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
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_pjsip_contact.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/funcs/func_pjsip_contact.c b/funcs/func_pjsip_contact.c index 0f5a204b8..005f29bf9 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); |