]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip/contacts/statsd: Make contact lifecycle events more consistent 67/1767/3
authorGeorge Joseph <george.joseph@fairview5.com>
Fri, 4 Dec 2015 22:23:21 +0000 (15:23 -0700)
committerGeorge Joseph <george.joseph@fairview5.com>
Fri, 4 Dec 2015 23:50:17 +0000 (16:50 -0700)
commit450579e908279e664cb4364a2e7dd1cfd6a90396
tree903448b17a0f9cf94732b11c7e1b2c3aef67431d
parent9c0aaf06096c8f6b16eb98283916f91823ea14eb
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
res/res_pjsip/location.c
res/res_pjsip/pjsip_configuration.c
res/res_pjsip/pjsip_options.c