Module: kamailio
Branch: master
Commit: b747d469e6c9d12be5e4541c41346b73f9bc1199
URL:
https://github.com/kamailio/kamailio/commit/b747d469e6c9d12be5e4541c41346b7…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: 2016-09-26T16:00:42+01:00
Add modparam to specify the usrloc domain to synchronize.
- TODO: allow multiple comma-separated domains
---
Modified: modules/dmq_usrloc/dmq_usrloc.c
Modified: modules/dmq_usrloc/usrloc_sync.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b747d469e6c9d12be5e4541c41346b7…
Patch:
https://github.com/kamailio/kamailio/commit/b747d469e6c9d12be5e4541c41346b7…
---
diff --git a/modules/dmq_usrloc/dmq_usrloc.c b/modules/dmq_usrloc/dmq_usrloc.c
index 6000b2a..d026cd2 100644
--- a/modules/dmq_usrloc/dmq_usrloc.c
+++ b/modules/dmq_usrloc/dmq_usrloc.c
@@ -38,6 +38,7 @@ int dmq_usrloc_enable = 0;
int _dmq_usrloc_sync = 1;
int _dmq_usrloc_batch_size = 0;
int _dmq_usrloc_batch_usleep = 0;
+str _dmq_usrloc_domain = str_init("location");
usrloc_api_t dmq_ul;
@@ -48,6 +49,7 @@ static param_export_t params[] = {
{"sync", INT_PARAM, &_dmq_usrloc_sync},
{"batch_size", INT_PARAM, &_dmq_usrloc_batch_size},
{"batch_usleep", INT_PARAM, &_dmq_usrloc_batch_usleep},
+ {"usrloc_domain", PARAM_STR, &_dmq_usrloc_domain},
{0, 0, 0}
};
diff --git a/modules/dmq_usrloc/usrloc_sync.c b/modules/dmq_usrloc/usrloc_sync.c
index 86e34ac..c256af4 100644
--- a/modules/dmq_usrloc/usrloc_sync.c
+++ b/modules/dmq_usrloc/usrloc_sync.c
@@ -47,6 +47,7 @@ int usrloc_dmq_send_contact(ucontact_t* ptr, str aor, int action,
dmq_node_t* no
extern int _dmq_usrloc_sync;
extern int _dmq_usrloc_batch_size;
extern int _dmq_usrloc_batch_usleep;
+extern str _dmq_usrloc_domain;
static int add_contact(str aor, ucontact_info_t* ci)
{
@@ -56,7 +57,7 @@ static int add_contact(str aor, ucontact_info_t* ci)
str contact;
int res;
- if (dmq_ul.get_udomain("location", &_d) < 0) {
+ if (dmq_ul.get_udomain(_dmq_usrloc_domain.s, &_d) < 0) {
LM_ERR("Failed to get domain\n");
return -1;
}
@@ -109,7 +110,7 @@ static int delete_contact(str aor, ucontact_info_t* ci)
urecord_t* r;
ucontact_t* c;
- if (dmq_ul.get_udomain("location", &_d) < 0) {
+ if (dmq_ul.get_udomain(_dmq_usrloc_domain.s, &_d) < 0) {
LM_ERR("Failed to get domain\n");
return -1;
}
@@ -159,7 +160,7 @@ void usrloc_get_all_ucontact(dmq_node_t* node)
goto done;
}
- if (dmq_ul.get_udomain("location", &_d) < 0) {
+ if (dmq_ul.get_udomain(_dmq_usrloc_domain.s, &_d) < 0) {
LM_ERR("Failed to get domain\n");
goto done;
}