mirror of https://github.com/sipwise/kamailio.git
Change-Id: Id5dc44d54cbaf8a81ced6e439fdfa6257f36c504changes/72/2172/1
parent
3891413f76
commit
f5b58c9d49
@ -0,0 +1,54 @@
|
||||
From 63bd356cc3c7aa64d64361283f630f88b8db88af Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Thu, 28 May 2015 18:26:08 +0200
|
||||
Subject: [PATCH] pua_reginfo: use ul.get_urecord_by_ruid instead of
|
||||
ul.get_urecord
|
||||
|
||||
---
|
||||
modules/pua_reginfo/usrloc_cb.c | 14 ++++++--------
|
||||
1 file changed, 6 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/modules/pua_reginfo/usrloc_cb.c b/modules/pua_reginfo/usrloc_cb.c
|
||||
index 6b8cd68..0c68cec 100644
|
||||
--- a/modules/pua_reginfo/usrloc_cb.c
|
||||
+++ b/modules/pua_reginfo/usrloc_cb.c
|
||||
@@ -218,9 +218,9 @@ void reginfo_usrloc_cb(ucontact_t* c, int type, void* param) {
|
||||
str content_type;
|
||||
udomain_t * domain;
|
||||
urecord_t * record;
|
||||
+ ucontact_t* _c = NULL;
|
||||
int res;
|
||||
str uri = {NULL, 0};
|
||||
- str user = {NULL, 0};
|
||||
|
||||
char* at = NULL;
|
||||
char id_buf[512];
|
||||
@@ -245,9 +245,6 @@ void reginfo_usrloc_cb(ucontact_t* c, int type, void* param) {
|
||||
LM_ERR("Unknown Type %i\n", type);
|
||||
return;
|
||||
}
|
||||
- /* make a local copy of the AOR */
|
||||
- user.len = c->aor->len;
|
||||
- user.s = c->aor->s;
|
||||
|
||||
/* Get the UDomain for this account */
|
||||
res = ul.get_udomain(c->domain->s, &domain);
|
||||
@@ -256,10 +253,11 @@ void reginfo_usrloc_cb(ucontact_t* c, int type, void* param) {
|
||||
return;
|
||||
}
|
||||
|
||||
- /* Get the URecord for this AOR */
|
||||
- res = ul.get_urecord(domain, &user, &record);
|
||||
- if (res > 0) {
|
||||
- LM_ERR("' %.*s (%.*s)' Not found in usrloc\n", c->aor->len, c->aor->s, c->domain->len, c->domain->s);
|
||||
+ /* Get the URecord for this ruid */
|
||||
+ res = ul.get_urecord_by_ruid(domain, ul.get_aorhash(c->aor), &(c->ruid),
|
||||
+ &record, &_c);
|
||||
+ if (res < 0) {
|
||||
+ LM_ERR("'%.*s (%.*s)' Not found in usrloc\n", c->aor->len, c->aor->s, c->domain->len, c->domain->s);
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.1.4
|
||||
|
@ -0,0 +1,44 @@
|
||||
From 7d31d78e3ac861cddfcb70c9940242ec7f3f0dbc Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Wed, 15 Jul 2015 16:00:03 +0200
|
||||
Subject: [PATCH] pua_reginfo: use ruid to fix comparation of contact
|
||||
|
||||
(ptr == c) is always false. Using ruid instead.
|
||||
---
|
||||
modules/pua_reginfo/usrloc_cb.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
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");
|
||||
--
|
||||
2.1.4
|
||||
|
Loading…
Reference in new issue