[sr-dev] git:master:5ad2d87c: tsilo: added use_domain parameter

Federico Cabiddu federico.cabiddu at gmail.com
Wed Nov 4 15:48:34 CET 2015


Module: kamailio
Branch: master
Commit: 5ad2d87cae69e73c7081ac8fa383fec5336ef820
URL: https://github.com/kamailio/kamailio/commit/5ad2d87cae69e73c7081ac8fa383fec5336ef820

Author: Federico Cabiddu <federico.cabiddu at gmail.com>
Committer: Federico Cabiddu <federico.cabiddu at gmail.com>
Date: 2015-11-04T15:47:16+01:00

tsilo: added use_domain parameter

---

Modified: modules/tsilo/ts_append.c
Modified: modules/tsilo/ts_store.c
Modified: modules/tsilo/tsilo.c
Modified: modules/tsilo/tsilo.h

---

Diff:  https://github.com/kamailio/kamailio/commit/5ad2d87cae69e73c7081ac8fa383fec5336ef820.diff
Patch: https://github.com/kamailio/kamailio/commit/5ad2d87cae69e73c7081ac8fa383fec5336ef820.patch

---

diff --git a/modules/tsilo/ts_append.c b/modules/tsilo/ts_append.c
index 4e8f172..3c47663 100644
--- a/modules/tsilo/ts_append.c
+++ b/modules/tsilo/ts_append.c
@@ -41,12 +41,23 @@ int ts_append(struct sip_msg* msg, str *ruri, char *table) {
 	ts_urecord_t* _r;
 	ts_transaction_t* ptr;
 
+	struct sip_uri p_uri;
+	str *t_uri;
+
 	int res;
 	int appended;
 
 	lock_entry_by_ruri(ruri);
 
-	res = get_ts_urecord(ruri, &_r);
+	if (use_domain) {
+		t_uri = ruri;
+	}
+	else {
+		parse_uri(ruri->s, ruri->len, &p_uri);
+		t_uri = &p_uri.user;
+	}
+
+	res = get_ts_urecord(t_uri, &_r);
 
 	if (res != 0) {
 		LM_ERR("failed to retrieve record for %.*s\n", ruri->len, ruri->s);
diff --git a/modules/tsilo/ts_store.c b/modules/tsilo/ts_store.c
index 8c10b08..b0eb96d 100644
--- a/modules/tsilo/ts_store.c
+++ b/modules/tsilo/ts_store.c
@@ -65,7 +65,11 @@ int ts_store(struct sip_msg* msg, str *puri) {
 				suri.s);
 		return -1;
 	}
-	aor = suri;
+
+	if (use_domain)
+		aor = suri;
+	else
+		aor = ruri.user;
 
 	t = _tmb.t_gett();
 	if (!t || t==T_UNDEFINED) {
diff --git a/modules/tsilo/tsilo.c b/modules/tsilo/tsilo.c
index f25db8c..2cd6b4f 100644
--- a/modules/tsilo/tsilo.c
+++ b/modules/tsilo/tsilo.c
@@ -50,6 +50,7 @@ registrar_api_t _regapi;
 
 /** parameters */
 static int hash_size = 2048;
+int use_domain = 0;
 
 /** module functions */
 static int mod_init(void);
@@ -86,6 +87,7 @@ static cmd_export_t cmds[]={
 
 static param_export_t params[]={
 	{"hash_size",	INT_PARAM,	&hash_size},
+	{"use_domain",	INT_PARAM,	&use_domain},
 	{0,0,0}
 };
 
diff --git a/modules/tsilo/tsilo.h b/modules/tsilo/tsilo.h
index 1daf4d4..70492c9 100644
--- a/modules/tsilo/tsilo.h
+++ b/modules/tsilo/tsilo.h
@@ -30,4 +30,5 @@ extern struct tm_binds _tmb;
 extern registrar_api_t _regapi;
 /** USRLOC BIND **/
 
+extern int use_domain;
 #endif




More information about the sr-dev mailing list