Module: kamailio
Branch: 4.3
Commit: 6e6f679c7d7894bd0e268581022ed111c33384c5
URL:
https://github.com/kamailio/kamailio/commit/6e6f679c7d7894bd0e268581022ed11…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2015-07-16T09:19:40+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/6e6f679c7d7894bd0e268581022ed11…
Patch:
https://github.com/kamailio/kamailio/commit/6e6f679c7d7894bd0e268581022ed11…
---
diff --git a/modules/pua_reginfo/usrloc_cb.c b/modules/pua_reginfo/usrloc_cb.c
index 0c68cec..95ec762 100644
--- a/modules/pua_reginfo/usrloc_cb.c
+++ b/modules/pua_reginfo/usrloc_cb.c
@@ -101,10 +101,14 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c,
int type) {
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) {
@@ -115,7 +119,9 @@ str* build_reginfo_full(urecord_t * record, str uri, ucontact_t* c,
int type) {
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");