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

Author: Claudiu Boriga <paul.bor...@1and1.ro>
Committer: Daniel-Constantin Mierla <mico...@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);
 


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to