Browse Source

Add modparam to specify the usrloc domain to synchronize.

- TODO: allow multiple comma-separated domains
Charles Chance 9 years ago
parent
commit
b747d469e6
2 changed files with 6 additions and 3 deletions
  1. 2 0
      modules/dmq_usrloc/dmq_usrloc.c
  2. 4 3
      modules/dmq_usrloc/usrloc_sync.c

+ 2 - 0
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}
 };
 

+ 4 - 3
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;
 	}