[Asterisk-code-review] pjsip options: handle modification of qualify frequency in r... (asterisk[13])

Alexei Gradinari asteriskteam at digium.com
Tue May 22 16:27:45 CDT 2018


Alexei Gradinari has uploaded this change for review. ( https://gerrit.asterisk.org/9033


Change subject: pjsip_options: handle modification of qualify_frequency in realtime
......................................................................

pjsip_options: handle modification of qualify_frequency in realtime

Currentrly pjsip_options code does not handle the situation when the
qualify_frequency was changed in realtime database.
Only 'module reload res_pjsip' helps.

This patch add a check on contact update observer if the contact's
qualify_frequency is different that aor's qualify_frequency.
If the qualify_frequency was modified then synchronize
the pjsip_options AOR local state.

ASTERISK-27872

Change-Id: Id55210a18e62ed5d35a88e408d5fe84a3c513c62
---
M res/res_pjsip/pjsip_options.c
1 file changed, 23 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/9033/1

diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index d05d7bd..0f9d46e 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -2206,6 +2206,7 @@
 static void contact_observer_updated(const void *obj)
 {
 	struct sip_options_contact_observer_task_data *task_data;
+	int is_qualify_changed=0;
 
 	task_data = ast_malloc(sizeof(*task_data));
 	if (!task_data) {
@@ -2216,6 +2217,28 @@
 	task_data->aor_options = ao2_find(sip_options_aors, task_data->contact->aor,
 		OBJ_SEARCH_KEY);
 	if (!task_data->aor_options) {
+		if (task_data->contact->qualify_frequency) {
+			is_qualify_changed=1;
+		}
+	} else if (task_data->contact->qualify_frequency != task_data->aor_options->qualify_frequency) {
+	    is_qualify_changed=1;
+	}
+
+	if (is_qualify_changed) {
+		struct ast_sip_aor *aor;
+
+		aor = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "aor",
+			task_data->contact->aor);
+		if (aor) {
+			ast_debug(3, "AOR's '%s' qualify frequency has been modified. Synchronize an AOR local state\n",
+				task_data->contact->aor);
+			ast_sip_push_task_wait_serializer(management_serializer,
+				sip_options_aor_observer_modified_task, (void *) aor);
+			ao2_ref(aor, -1);
+		}
+	}
+
+	if (!task_data->aor_options) {
 		ast_free(task_data);
 		return;
 	}

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id55210a18e62ed5d35a88e408d5fe84a3c513c62
Gerrit-Change-Number: 9033
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180522/0fed54e9/attachment.html>


More information about the asterisk-code-review mailing list