[asterisk-commits] res/res pjsip location: Delete contact status object when co... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 28 09:02:20 CST 2015


Joshua Colp has submitted this change and it was merged.

Change subject: res/res_pjsip_location: Delete contact_status object when contact is deleted
......................................................................


res/res_pjsip_location: Delete contact_status object when contact is deleted

In 450579e908, a change was made that removed the deletion of the
'contact_status' object when a 'contact' object is deleted in sorcery.
This unfortunately means that the 'contact_status' object persists, even when
something has explicitly removed a contact. The result is that the state of
the contact will not be regenerated if that contact is re-created, and the
stale state will be reported/used for that contact. It also results in
no ContactStatusChanged events being generated for either ARI or AMI.

This patch restores the deletion logic that was removed. Doing so now
results in the expected events being generated again.

Change-Id: I28789a112e845072308b5b34522690e3faf58f07
---
M res/res_pjsip/location.c
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 2908f6f..a34e5cd 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -322,6 +322,14 @@
 
 int ast_sip_location_delete_contact(struct ast_sip_contact *contact)
 {
+	void *contact_status_obj;
+
+	contact_status_obj = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), CONTACT_STATUS, ast_sorcery_object_get_id(contact));
+	if (contact_status_obj) {
+		ast_sorcery_delete(ast_sip_get_sorcery(), contact_status_obj);
+		ao2_ref(contact_status_obj, -1);
+	}
+
 	return ast_sorcery_delete(ast_sip_get_sorcery(), contact);
 }
 

-- 
To view, visit https://gerrit.asterisk.org/1853
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I28789a112e845072308b5b34522690e3faf58f07
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list