Module: kamailio
Branch: master
Commit: 29d09b38fab5a1ee8d7f6f82818e3d3446d4dd8b
URL: 
https://github.com/kamailio/kamailio/commit/29d09b38fab5a1ee8d7f6f82818e3d3446d4dd8b

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2018-02-16T09:04:14+01:00

presence: keep first dialog node reference to compare name with next nodes

- there can be intermediary nodes of other type making the match fail
- related to GH #1425

---

Modified: src/modules/presence/presentity.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/29d09b38fab5a1ee8d7f6f82818e3d3446d4dd8b.diff
Patch: 
https://github.com/kamailio/kamailio/commit/29d09b38fab5a1ee8d7f6f82818e3d3446d4dd8b.patch

---

diff --git a/src/modules/presence/presentity.c 
b/src/modules/presence/presentity.c
index 4674f0ad49..785c58546d 100644
--- a/src/modules/presence/presentity.c
+++ b/src/modules/presence/presentity.c
@@ -313,6 +313,7 @@ int ps_match_dialog_state_from_body(str body, int 
*is_dialog, char *vstate)
 {
        xmlDocPtr doc;
        xmlNodePtr node;
+       xmlNodePtr fnode;
        xmlNodePtr childNode;
        char *tmp_state;
        int rmatch = 0;
@@ -326,7 +327,7 @@ int ps_match_dialog_state_from_body(str body, int 
*is_dialog, char *vstate)
                return -1;
        }
 
-       node = xmlNodeGetChildByName(doc->children, "dialog");
+       fnode = node = xmlNodeGetChildByName(doc->children, "dialog");
 
        while(node != NULL)
        {
@@ -349,7 +350,7 @@ int ps_match_dialog_state_from_body(str body, int 
*is_dialog, char *vstate)
                /* search for next dialog node */
                do {
                        if(node->next != NULL && node->next->name != NULL
-                                       && xmlStrcmp(node->name, 
node->next->name) == 0) {
+                                       && xmlStrcmp(fnode->name, 
node->next->name) == 0) {
                                node = node->next;
                                break;
                        }


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

Reply via email to