Browse code

uac: exposed reg_use_domain via modparam

- control if the lookup over username uses also domain

Daniel-Constantin Mierla authored on 10/05/2021 07:34:47
Showing 2 changed files
... ...
@@ -114,6 +114,7 @@ static int child_init(int rank);
114 114
 
115 115
 extern int reg_timer_interval;
116 116
 extern int _uac_reg_gc_interval;
117
+extern int _uac_reg_use_domain;
117 118
 
118 119
 static pv_export_t mod_pvs[] = {
119 120
 	{ {"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[] = {
184 185
 	{"reg_random_delay",	INT_PARAM,			&reg_random_delay      },
185 186
 	{"reg_active",	INT_PARAM,			&reg_active_param      },
186 187
 	{"reg_gc_interval",		INT_PARAM,	&_uac_reg_gc_interval	},
187
-	{"reg_hash_size",	INT_PARAM,			&reg_htable_size      },
188
+	{"reg_hash_size",	INT_PARAM,		&reg_htable_size      },
189
+	{"reg_use_domain",	PARAM_INT,		&_uac_reg_use_domain  },
188 190
 	{"default_socket",	PARAM_STR, &uac_default_socket},
189 191
 	{"event_callback",	PARAM_STR,	&uac_event_callback},
190 192
 	{0, 0, 0}
... ...
@@ -116,7 +116,7 @@ static reg_ht_t *_reg_htable = NULL;
116 116
 static reg_ht_t *_reg_htable_gc = NULL;
117 117
 static gen_lock_t *_reg_htable_gc_lock = NULL;
118 118
 
119
-int reg_use_domain = 0;
119
+int _uac_reg_use_domain = 0;
120 120
 int reg_timer_interval = 90;
121 121
 int reg_retry_interval = 0;
122 122
 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)
1630 1630
 			LM_ERR("failed to parse uri\n");
1631 1631
 			return -2;
1632 1632
 		}
1633
-		reg = reg_ht_get_byuser(&puri.user, (reg_use_domain)?&puri.host:NULL);
1633
+		reg = reg_ht_get_byuser(&puri.user, (_uac_reg_use_domain)?&puri.host:NULL);
1634 1634
 		if(reg==NULL)
1635 1635
 		{
1636 1636
 			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)
1673 1673
 			LM_ERR("failed to parse uri\n");
1674 1674
 			return -1;
1675 1675
 		}
1676
-		reg = reg_ht_get_byuser(&puri.user, (reg_use_domain)?&puri.host:NULL);
1676
+		reg = reg_ht_get_byuser(&puri.user, (_uac_reg_use_domain)?&puri.host:NULL);
1677 1677
 		if(reg==NULL)
1678 1678
 		{
1679 1679
 			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)
1717 1717
 			reg = reg_ht_get_byuuid(src);
1718 1718
 			break;
1719 1719
 		case 1:
1720
-			if(reg_use_domain)
1720
+			if(_uac_reg_use_domain)
1721 1721
 			{
1722 1722
 				if (parse_uri(src->s, src->len, &puri)!=0)
1723 1723
 				{