summaryrefslogtreecommitdiff
path: root/res/res_pjsip/pjsip_options.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2014-10-30 17:17:27 +0000
committerKevin Harwell <kharwell@digium.com>2014-10-30 17:17:27 +0000
commitfed9d0deb064469e07cac51d26d1c7e122aaddf2 (patch)
tree53013f8a44a3c6bb2cf85317e79cdb0afd422c84 /res/res_pjsip/pjsip_options.c
parent3f31b73f5412c05587a149b2e3bfb198e1bd08ac (diff)
res_pjsip: incorrect qualify statistics after disabling for contact
When removing the qualify_frequency from an AoR or a contact the statistics shown when issuing "pjsip show aors" from the CLI are incorrect. This patch deletes the contact's status object from sorcery, disassociating it from the contact, if the qualify_freqency is removed from configuration. ASTERISK-24462 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4116/ ........ Merged revisions 426755 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@426757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip/pjsip_options.c')
-rw-r--r--res/res_pjsip/pjsip_options.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index 150f43fea..300f851ef 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -85,6 +85,19 @@ static struct ast_sip_contact_status *find_or_create_contact_status(const struct
return status;
}
+static void delete_contact_status(const struct ast_sip_contact *contact)
+{
+ struct ast_sip_contact_status *status = ast_sorcery_retrieve_by_id(
+ ast_sip_get_sorcery(), CONTACT_STATUS, ast_sorcery_object_get_id(contact));
+
+ if (!status) {
+ return;
+ }
+
+ ast_sorcery_delete(ast_sip_get_sorcery(), status);
+ ao2_ref(status, -1);
+}
+
/*!
* \internal
* \brief Update an ast_sip_contact_status's elements.
@@ -470,6 +483,8 @@ static void qualify_and_schedule(struct ast_sip_contact *contact)
}
schedule_qualify(contact);
+ } else {
+ delete_contact_status(contact);
}
}