Module: kamailio
Branch: master
Commit: 7d31d78e3ac861cddfcb70c9940242ec7f3f0dbc
URL:
https://github.com/kamailio/kamailio/commit/7d31d78e3ac861cddfcb70c9940242e…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2015-07-15T16:00:03+02:00
pua_reginfo: use ruid to fix comparation of contact
(ptr == c) is always false. Using ruid instead.
---
Modified: modules/pua_reginfo/usrloc_cb.c
---
Diff:
https://github.com/kamailio/kamailio/commit/7d31d78e3ac861cddfcb70c9940242e…
Patch:
https://github.com/kamailio/kamailio/commit/7d31d78e3ac861cddfcb70c9940242e…
---
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");