Module: kamailio
Branch: 4.1
Commit: 10c1c00ed184fc3d13a0b244618a32151ec403ed
URL: 
https://github.com/kamailio/kamailio/commit/10c1c00ed184fc3d13a0b244618a32151ec403ed

Author: Victor Seva <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2015-07-16T09:21:00+02:00

pua_reginfo: use ruid to fix comparation of contact

(ptr == c) is always false. Using ruid instead.

(cherry picked from commit 7d31d78e3ac861cddfcb70c9940242ec7f3f0dbc)

---

Modified: modules/pua_reginfo/usrloc_cb.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/10c1c00ed184fc3d13a0b244618a32151ec403ed.diff
Patch: 
https://github.com/kamailio/kamailio/commit/10c1c00ed184fc3d13a0b244618a32151ec403ed.patch

---

diff --git a/modules/pua_reginfo/usrloc_cb.c b/modules/pua_reginfo/usrloc_cb.c
index 8c45763..d4e9d5f 100644
--- a/modules/pua_reginfo/usrloc_cb.c
+++ b/modules/pua_reginfo/usrloc_cb.c
@@ -102,10 +102,14 @@ str* build_reginfo_full(urecord_t * record, str uri, 
ucontact_t* c, int type) {
        buf_len = snprintf(buf, sizeof(buf), "%p", record);
        xmlNewProp(registration_node, BAD_CAST "id", BAD_CAST buf);
 
+       LM_DBG("Updated Contact %.*s[%.*s]\n", c->c.len, c->c.s,
+               c->ruid.len, c->ruid.s);
+
        ptr = record->contacts;
        while (ptr) {
                if (VALID_CONTACT(ptr, cur_time)) {
-                       LM_DBG("Contact %.*s, %p\n", ptr->c.len, ptr->c.s, ptr);
+                       LM_DBG("Contact %.*s[%.*s]\n", ptr->c.len, ptr->c.s,
+                               ptr->ruid.len, ptr->ruid.s);
                        /* Contact-Node */
                        contact_node =xmlNewChild(registration_node, NULL, 
BAD_CAST "contact", NULL) ;
                        if( contact_node ==NULL) {
@@ -116,7 +120,9 @@ str* build_reginfo_full(urecord_t * record, str uri, 
ucontact_t* c, int type) {
                        buf_len = snprintf(buf, sizeof(buf), "%p", ptr);
                        xmlNewProp(contact_node, BAD_CAST "id", BAD_CAST buf);
                        /* Check, if this is the modified contact: */
-                       if (ptr == c) {
+                       if ((c->ruid.len == ptr->ruid.len) &&
+                               !memcmp(c->ruid.s, ptr->ruid.s, c->ruid.len))
+                       {
                                if ((type & UL_CONTACT_INSERT) || (type & 
UL_CONTACT_UPDATE)) {
                                        reg_active = 1;
                                        xmlNewProp(contact_node, BAD_CAST 
"state", BAD_CAST "active");


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to