summaryrefslogtreecommitdiff
path: root/res/res_pjsip/pjsip_options.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2015-12-04 15:23:21 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2015-12-04 16:53:20 -0700
commit4be231e82f840fb1cb2329698ba2184d8b726f2c (patch)
tree05a05afd7b6527f27bb58b6e77146a007bc744f9 /res/res_pjsip/pjsip_options.c
parente26647cbac6f0d0243b8b3b76dac5fc6e04ddd22 (diff)
res_pjsip/contacts/statsd: Make contact lifecycle events more consistent
It will never be perfect or even pretty, mostly because of the differences between static and dynamic contacts. Created: Can't use the contact or contact_status alloc functions because the objects come and go regardless of the actual state. Can't use the contact_apply_handler, ast_sip_location_add_contact or a sorcery created handler because they only get called for dynamic contacts. Similarly, permanent_uri_handler only gets called for static contacts. So, Matt had it right. :) ast_res_pjsip_find_or_create_contact_status is the only place it can go and not have duplicated code. Both permanent_uri_handler and contact_apply_handler call find_or_create. Removed: Can't use the destructors for the same reason as above. The only place to put this is in persistent_endpoint_contact_deleted_observer which I believe is the "correct" place but even that will handle only dynamic contacts. This doesn't called on shutdown however. There is no hook to use for static contacts that may be removed because of a config change while asterisk is in operation. I moved the cleanup of contact_status from ast_sip_location_delete_contact to the handler as well. Status Change and RTT: Although they worked fine where they were (in update_contact_status) I moved them to persistent_endpoint_contact_status_observer to make it more consistent with removed. There was logic there already to detect a state change. Finally, fixed a nit in permanent_uri_handler rmudgett reported eralier. ASTERISK-25608 #close Change-Id: I4b56e7dfc3be3baaaf6f1eac5b2068a0b79e357d Reported-by: George Joseph Tested-by: George Joseph
Diffstat (limited to 'res/res_pjsip/pjsip_options.c')
-rw-r--r--res/res_pjsip/pjsip_options.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index 6762b754e..089703b26 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -174,22 +174,13 @@ static void update_contact_status(const struct ast_sip_contact *contact,
ast_string_field_set(update, uri, contact->uri);
update->last_status = status->status;
update->status = value;
- if (update->last_status != update->status) {
- ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE,
- "-1", 1.0, ast_sip_get_contact_status_label(update->last_status));
- ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE,
- "+1", 1.0, ast_sip_get_contact_status_label(update->status));
- }
/* if the contact is available calculate the rtt as
the diff between the last start time and "now" */
update->rtt = update->status == AVAILABLE && status->rtt_start.tv_sec > 0 ?
ast_tvdiff_us(ast_tvnow(), status->rtt_start) : 0;
-
update->rtt_start = ast_tv(0, 0);
- ast_statsd_log_full_va("PJSIP.contacts.%s.rtt", AST_STATSD_TIMER,
- update->rtt / 1000, 1.0, ast_sorcery_object_get_id(update));
ast_test_suite_event_notify("AOR_CONTACT_QUALIFY_RESULT",
"Contact: %s\r\n"
"Status: %s\r\n"