Module: kamailio
Branch: master
Commit: cd2abf6e278539b31ebfd355acf841faf6121e25
URL:
https://github.com/kamailio/kamailio/commit/cd2abf6e278539b31ebfd355acf841f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-10T09:34:47+02:00
uac: exposed reg_use_domain via modparam
- control if the lookup over username uses also domain
---
Modified: src/modules/uac/uac.c
Modified: src/modules/uac/uac_reg.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cd2abf6e278539b31ebfd355acf841f…
Patch:
https://github.com/kamailio/kamailio/commit/cd2abf6e278539b31ebfd355acf841f…
---
diff --git a/src/modules/uac/uac.c b/src/modules/uac/uac.c
index 46503bf592..50873ef557 100644
--- a/src/modules/uac/uac.c
+++ b/src/modules/uac/uac.c
@@ -114,6 +114,7 @@ static int child_init(int rank);
extern int reg_timer_interval;
extern int _uac_reg_gc_interval;
+extern int _uac_reg_use_domain;
static pv_export_t mod_pvs[] = {
{ {"uac_req", sizeof("uac_req")-1}, PVT_OTHER, pv_get_uac_req,
pv_set_uac_req,
@@ -184,7 +185,8 @@ static param_export_t params[] = {
{"reg_random_delay", INT_PARAM, ®_random_delay },
{"reg_active", INT_PARAM, ®_active_param },
{"reg_gc_interval", INT_PARAM, &_uac_reg_gc_interval },
- {"reg_hash_size", INT_PARAM, ®_htable_size },
+ {"reg_hash_size", INT_PARAM, ®_htable_size },
+ {"reg_use_domain", PARAM_INT, &_uac_reg_use_domain },
{"default_socket", PARAM_STR, &uac_default_socket},
{"event_callback", PARAM_STR, &uac_event_callback},
{0, 0, 0}
diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c
index c36ee8ac82..1ea1b62135 100644
--- a/src/modules/uac/uac_reg.c
+++ b/src/modules/uac/uac_reg.c
@@ -116,7 +116,7 @@ static reg_ht_t *_reg_htable = NULL;
static reg_ht_t *_reg_htable_gc = NULL;
static gen_lock_t *_reg_htable_gc_lock = NULL;
-int reg_use_domain = 0;
+int _uac_reg_use_domain = 0;
int reg_timer_interval = 90;
int reg_retry_interval = 0;
int reg_htable_size = 4;
@@ -1630,7 +1630,7 @@ int uac_reg_lookup(struct sip_msg *msg, str *src, pv_spec_t *dst,
int mode)
LM_ERR("failed to parse uri\n");
return -2;
}
- reg = reg_ht_get_byuser(&puri.user, (reg_use_domain)?&puri.host:NULL);
+ reg = reg_ht_get_byuser(&puri.user, (_uac_reg_use_domain)?&puri.host:NULL);
if(reg==NULL)
{
LM_DBG("no user: %.*s\n", src->len, src->s);
@@ -1673,7 +1673,7 @@ int uac_reg_status(struct sip_msg *msg, str *src, int mode)
LM_ERR("failed to parse uri\n");
return -1;
}
- reg = reg_ht_get_byuser(&puri.user, (reg_use_domain)?&puri.host:NULL);
+ reg = reg_ht_get_byuser(&puri.user, (_uac_reg_use_domain)?&puri.host:NULL);
if(reg==NULL)
{
LM_DBG("no user: %.*s\n", src->len, src->s);
@@ -1717,7 +1717,7 @@ int uac_reg_request_to(struct sip_msg *msg, str *src, unsigned int
mode)
reg = reg_ht_get_byuuid(src);
break;
case 1:
- if(reg_use_domain)
+ if(_uac_reg_use_domain)
{
if (parse_uri(src->s, src->len, &puri)!=0)
{