Module: kamailio
Branch: 4.3
Commit: 24b347a5fca61d13a0765dbf1b3c8207caf3b45d
URL:
https://github.com/kamailio/kamailio/commit/24b347a5fca61d13a0765dbf1b3c820…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: 2015-09-10T12:46:53+01:00
dmq_usrloc: implement deleted contact replication
(cherry picked from commit edc25d7373f9560d09a35640ab19741f19b97040)
---
Modified: modules/dmq_usrloc/usrloc_sync.c
---
Diff:
https://github.com/kamailio/kamailio/commit/24b347a5fca61d13a0765dbf1b3c820…
Patch:
https://github.com/kamailio/kamailio/commit/24b347a5fca61d13a0765dbf1b3c820…
---
diff --git a/modules/dmq_usrloc/usrloc_sync.c b/modules/dmq_usrloc/usrloc_sync.c
index f5ef20f..e4a9ed7 100644
--- a/modules/dmq_usrloc/usrloc_sync.c
+++ b/modules/dmq_usrloc/usrloc_sync.c
@@ -95,6 +95,30 @@ static int add_contact(str aor, ucontact_info_t* ci)
return -1;
}
+static int delete_contact(str aor, ucontact_info_t* ci)
+{
+ udomain_t* _d;
+ urecord_t* r;
+ ucontact_t* c;
+
+ dmq_ul.get_udomain("location", &_d);
+
+ if (dmq_ul.get_urecord_by_ruid(_d, dmq_ul.get_aorhash(&aor),
+ &ci->ruid, &r, &c) != 0) {
+ LM_WARN("AOR/Contact not found\n");
+ return -1;
+ }
+ if (dmq_ul.delete_ucontact(r, c) != 0) {
+ dmq_ul.unlock_udomain(_d, &aor);
+ LM_WARN("could not delete contact\n");
+ return -1;
+ }
+ dmq_ul.release_urecord(r);
+ dmq_ul.unlock_udomain(_d, &aor);
+
+ return 0;
+}
+
void usrloc_get_all_ucontact(dmq_node_t* node)
{
int rval, len=0;
@@ -364,6 +388,7 @@ int usrloc_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp,
dmq_node_t*
break;
case DMQ_RM:
LM_DBG("Received DMQ_RM. Delete contact info...\n");
+ delete_contact(aor, &ci);
break;
case DMQ_SYNC:
LM_DBG("Received DMQ_SYNC. Sending all contacts...\n");
@@ -517,8 +542,7 @@ void dmq_ul_cb_contact(ucontact_t* ptr, int type, void* param)
usrloc_dmq_send_contact(ptr, aor, DMQ_UPDATE, 0);
break;
case UL_CONTACT_DELETE:
- //usrloc_dmq_send_contact(ptr, aor, DMQ_RM);
- LM_DBG("Contact <%.*s> deleted\n", aor.len, aor.s);
+ usrloc_dmq_send_contact(ptr, aor, DMQ_RM, 0);
break;
case UL_CONTACT_EXPIRE:
//usrloc_dmq_send_contact(ptr, aor, DMQ_UPDATE);