[sr-dev] git:master:6d0f8994: presence: test if event is dialog to avoid unnecessary xml parsing

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 1 10:23:50 CET 2018


Module: kamailio
Branch: master
Commit: 6d0f8994611b50faa7ef7d1299acf0c390a2eed1
URL: https://github.com/kamailio/kamailio/commit/6d0f8994611b50faa7ef7d1299acf0c390a2eed1

Author: Claudiu Boriga <paul.boriga at 1and1.ro>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-03-01T10:23:44+01:00

presence: test if event is dialog to avoid unnecessary xml parsing

---

Modified: src/modules/presence/presentity.c

---

Diff:  https://github.com/kamailio/kamailio/commit/6d0f8994611b50faa7ef7d1299acf0c390a2eed1.diff
Patch: https://github.com/kamailio/kamailio/commit/6d0f8994611b50faa7ef7d1299acf0c390a2eed1.patch

---

diff --git a/src/modules/presence/presentity.c b/src/modules/presence/presentity.c
index 785c58546d..497bfa95ea 100644
--- a/src/modules/presence/presentity.c
+++ b/src/modules/presence/presentity.c
@@ -734,17 +734,18 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
 					goto error;
 				}
 			}
+			if (presentity->event->evp->type == EVENT_DIALOG) {
+				check_if_dialog(*body, &is_dialog, &dialog_id);
+				if (dialog_id) {
+					if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
+						free(dialog_id);
+						dialog_id = NULL;
+						goto error;
+					}
 
-			check_if_dialog(*body, &is_dialog, &dialog_id);
-			if ( dialog_id ) {
-				if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
 					free(dialog_id);
 					dialog_id = NULL;
-					goto error;
 				}
-
-				free(dialog_id);
-				dialog_id = NULL;
 			}
 			LM_DBG("inserting %d cols into table\n",n_query_cols);
 




More information about the sr-dev mailing list