[sr-dev] git:master:29d09b38: presence: keep first dialog node reference to compare name with next nodes

Daniel-Constantin Mierla miconda at gmail.com
Fri Feb 16 09:05:57 CET 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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;
 			}




More information about the sr-dev mailing list