Module: kamailio
Branch: master
Commit: 81d33005df808699a7e8068883ab76e30a299d0f
URL:
https://github.com/kamailio/kamailio/commit/81d33005df808699a7e8068883ab76e…
Author: Stefan Mititelu <stefan-cristian.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)govoip.ro>
Date: 2023-05-10T10:41:02+03:00
p_usrloc: Add use_domain_crc32 modparam
---
Modified: src/modules/p_usrloc/doc/p_usrloc_admin.xml
Modified: src/modules/p_usrloc/p_usrloc_mod.c
Modified: src/modules/p_usrloc/p_usrloc_mod.h
Modified: src/modules/p_usrloc/ul_db_handle.c
---
Diff:
https://github.com/kamailio/kamailio/commit/81d33005df808699a7e8068883ab76e…
Patch:
https://github.com/kamailio/kamailio/commit/81d33005df808699a7e8068883ab76e…
---
diff --git a/src/modules/p_usrloc/doc/p_usrloc_admin.xml
b/src/modules/p_usrloc/doc/p_usrloc_admin.xml
index 37c84bf20b1..0a8ba7be487 100644
--- a/src/modules/p_usrloc/doc/p_usrloc_admin.xml
+++ b/src/modules/p_usrloc/doc/p_usrloc_admin.xml
@@ -779,6 +779,27 @@ modparam("p_usrloc", "UTC_timestamps", 1)
</example>
</section>
+ <section>
+ <title><varname>use_domain_crc32</varname>(str)</title>
+ <para>
+ Enables or disables the crc32 of domain part for user@domain.
+ If disabled, will calculate crc32 only for user part.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>1</quote> (enabled).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>use_domain_crc32</varname>
parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("p_usrloc", "use_domain_crc32", "0")
+...
+</programlisting>
+ </example>
+ </section>
+
</section>
<section>
diff --git a/src/modules/p_usrloc/p_usrloc_mod.c b/src/modules/p_usrloc/p_usrloc_mod.c
index ac3c34775a7..20d4b13f7fb 100644
--- a/src/modules/p_usrloc/p_usrloc_mod.c
+++ b/src/modules/p_usrloc/p_usrloc_mod.c
@@ -147,6 +147,7 @@ str last_mod_col = str_init(LAST_MOD_COL); /*!< Name of column
containing t
str uniq_col = str_init(UNIQ_COL); /*!< Name of column containing the uniq
value*/
int db_mode = 3; /*!< Database sync scheme: 1-write through, 2-write back,
3-only db */
int use_domain = 0; /*!< Whether usrloc should use domain part of aor */
+int use_domain_crc32 = 1; /*!< Whether usrloc should use domain part of aor when
calculating crc32 */
int desc_time_order = 0; /*!< By default do not enable timestamp ordering */
int ul_fetch_rows = 2000; /*!< number of rows to fetch from result */
@@ -212,6 +213,7 @@ static param_export_t params[] = {
{"cflags_column", PARAM_STR, &cflags_col },
{"db_mode", INT_PARAM, &db_mode },
{"use_domain", INT_PARAM, &use_domain },
+ {"use_domain_crc32", INT_PARAM, &use_domain_crc32 },
{"desc_time_order", INT_PARAM, &desc_time_order },
{"user_agent_column", PARAM_STR, &user_agent_col},
{"received_column", PARAM_STR, &received_col },
diff --git a/src/modules/p_usrloc/p_usrloc_mod.h b/src/modules/p_usrloc/p_usrloc_mod.h
index 800a71851a8..a8b8c74dd98 100644
--- a/src/modules/p_usrloc/p_usrloc_mod.h
+++ b/src/modules/p_usrloc/p_usrloc_mod.h
@@ -88,6 +88,7 @@ extern str uniq_col;
extern int db_mode;
extern int use_domain;
+extern int use_domain_crc32;
extern int desc_time_order;
extern int cseq_delay;
extern int ul_fetch_rows;
diff --git a/src/modules/p_usrloc/ul_db_handle.c b/src/modules/p_usrloc/ul_db_handle.c
index 134dc32e599..4e4eab0848e 100644
--- a/src/modules/p_usrloc/ul_db_handle.c
+++ b/src/modules/p_usrloc/ul_db_handle.c
@@ -461,7 +461,7 @@ static int compute_id(str* first, str* second){
return -1;
}
- if(use_domain){
+ if(use_domain && use_domain_crc32) {
//compute crc32(user@domain)
LM_DBG("XDBGX: compute_id HAS second key : %.*s", first->len,
first->s);
if(!second){