MT#58795 refresh patches

Change-Id: I67ddff8f65f56c9224d5a330e74af54e3408de01
mr12.1
Victor Seva 1 year ago
parent 59355d1c81
commit 1bd36871b0

@ -7,7 +7,7 @@ Subject: no_lib64_on_64_bits
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/Makefile.defs b/src/Makefile.defs
index 287efec..59e80d3 100644
index 5d485bb..33b83ad 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -458,15 +458,7 @@ endif

@ -37,7 +37,6 @@ sipwise/sca-add-pai_avp-parameter.patch
sipwise/pv_headers-rework-pvh_remove_header_param-take-two.patch
upstream/pv_headers-compare-result-of-pvh_set_xavi-with-NULL-.patch
sipwise/pua_dialoginfo-fix-dlg_var-store-and-retrieval.patch
sipwise/presence-active_watcher-cleanup-timer.patch
### relevant for upstream
sipwise/dialplan-don-t-stop-loading-rules-on-error.patch
sipwise/cfgt-skip_unknown.patch
@ -53,10 +52,9 @@ sipwise/lcr-stats.patch
sipwise/lcr_read_id.patch
sipwise/dialog-support-profile_get_size-for-all-profiles.patch
sipwise/rtpengine-set-mime-content-length.patch
sipwise/pv_headers-pvh_xavi_get_child-fix-fallback-logic.patch
sipwise/presence_vqr.patch
### active development
sipwise/dialog-dlg_get_ttag.patch
### active development
### Don't just put stuff in any order
### use gbp pq import/export tooling to help maintain patches
###

@ -4,11 +4,11 @@ Subject: add_lcr_rate_module
---
src/Makefile.groups | 9 +-
src/core/mod_fix.c | 2 +
src/core/mod_fix.c | 3 +
src/core/mod_fix.h | 2 +
src/modules/lcr_rate/Makefile | 9 +
src/modules/lcr_rate/lcr_rate_mod.c | 473 ++++++++++++++++++++++++++++++++++++
5 files changed, 493 insertions(+), 2 deletions(-)
5 files changed, 494 insertions(+), 2 deletions(-)
create mode 100644 src/modules/lcr_rate/Makefile
create mode 100644 src/modules/lcr_rate/lcr_rate_mod.c
@ -47,10 +47,10 @@ index 15fec0d..87e624a 100644
### --- Groups defined for pacKaging ###
diff --git a/src/core/mod_fix.c b/src/core/mod_fix.c
index e9cf314..3e75e75 100644
index ecd870c..78245c9 100644
--- a/src/core/mod_fix.c
+++ b/src/core/mod_fix.c
@@ -605,6 +605,7 @@ int fixup_free_igp_spve(void** param, int param_no)
@@ -598,6 +598,7 @@ int fixup_free_igp_spve(void **param, int param_no)
FIXUP_F_SPVE_T(spve_spve, 1, 2, 2, 0)
FIXUP_F_SPVE_T(spve_uint, 1, 2, 1, FPARAM_INT)
FIXUP_F_SPVE_T(spve_str, 1, 2, 1, FPARAM_STR)
@ -58,27 +58,28 @@ index e9cf314..3e75e75 100644
FIXUP_F_SPVE_T(spve_null, 1, 1, 1, 0)
/** get the corresp. fixup_free* function.
@@ -634,6 +635,7 @@ free_fixup_function mod_fix_get_fixup_free(fixup_function f)
see above fixup_uint_null) */
if (f == fixup_spve_uint) return 0;
if (f == fixup_spve_str) return fixup_free_spve_str;
+ if (f == fixup_spve_str_str) return fixup_free_spve_str_str;
@@ -644,6 +645,8 @@ free_fixup_function mod_fix_get_fixup_free(fixup_function f)
return 0;
if(f == fixup_spve_str)
return fixup_free_spve_str;
+ if(f == fixup_spve_str_str)
+ return fixup_free_spve_str_str;
return 0;
}
diff --git a/src/core/mod_fix.h b/src/core/mod_fix.h
index 043b1e3..e2006df 100644
index a76d64f..e4fe17e 100644
--- a/src/core/mod_fix.h
+++ b/src/core/mod_fix.h
@@ -138,6 +138,8 @@ int fixup_spve_uint(void** param, int param_no);
int fixup_free_spve_uint(void** param, int param_no);
int fixup_spve_str(void** param, int param_no);
int fixup_free_spve_str(void** param, int param_no);
+int fixup_spve_str_str(void** param, int param_no);
+int fixup_free_spve_str_str(void** param, int param_no);
@@ -138,6 +138,8 @@ int fixup_spve_uint(void **param, int param_no);
int fixup_free_spve_uint(void **param, int param_no);
int fixup_spve_str(void **param, int param_no);
int fixup_free_spve_str(void **param, int param_no);
+int fixup_spve_str_str(void **param, int param_no);
+int fixup_free_spve_str_str(void **param, int param_no);
int fixup_spve_all(void** param, int param_no);
int fixup_free_spve_all(void** param, int param_no);
int fixup_spve_all(void **param, int param_no);
int fixup_free_spve_all(void **param, int param_no);
diff --git a/src/modules/lcr_rate/Makefile b/src/modules/lcr_rate/Makefile
new file mode 100644
index 0000000..9a3cee1

@ -11,8 +11,8 @@ Subject: add_presence_dfks_module
src/modules/presence_dfks/presence_dfks.c | 138 ++++++++++++++
src/modules/presence_dfks/presence_dfks.h | 18 ++
src/modules/pua/add_events.c | 13 ++
src/modules/pua/add_events.h | 1 +
src/modules/pua/hash.h | 7 +
src/modules/pua/add_events.h | 2 +
src/modules/pua/hash.h | 6 +
10 files changed, 543 insertions(+), 1 deletion(-)
create mode 100644 src/modules/presence_dfks/Makefile
create mode 100644 src/modules/presence_dfks/README.md
@ -592,10 +592,10 @@ index 0000000..d58301b
+
+#endif
diff --git a/src/modules/pua/add_events.c b/src/modules/pua/add_events.c
index 5c0e73b..582fc8c 100644
index e2fc78b..8e07a84 100644
--- a/src/modules/pua/add_events.c
+++ b/src/modules/pua/add_events.c
@@ -103,6 +103,13 @@ int pua_add_events(void)
@@ -107,6 +107,13 @@ int pua_add_events(void)
return -1;
}
@ -607,58 +607,58 @@ index 5c0e73b..582fc8c 100644
+ }
+
return 0;
}
@@ -399,3 +406,9 @@ int dlg_process_body(publ_info_t* publ, str** fin_body, int ver, str** tuple)
@@ -380,3 +387,9 @@ int dlg_process_body(publ_info_t *publ, str **fin_body, int ver, str **tuple)
*fin_body = publ->body;
return 0;
}
+int dfks_process_body(publ_info_t* publ, str** fin_body, int ver, str** tuple)
+
+int dfks_process_body(publ_info_t *publ, str **fin_body, int ver, str **tuple)
+{
+ *fin_body= publ->body;
+ *fin_body = publ->body;
+ return 0;
+}
+
diff --git a/src/modules/pua/add_events.h b/src/modules/pua/add_events.h
index 5dbf5e0..1f0d0f4 100644
index 25a17ac..d0cfb63 100644
--- a/src/modules/pua/add_events.h
+++ b/src/modules/pua/add_events.h
@@ -37,5 +37,6 @@ int bla_process_body (struct publ_info* publ, str** fin_body, int ver, str** tup
int mwi_process_body (struct publ_info* publ, str** fin_body, int ver, str** tuple);
int dlg_process_body (struct publ_info* publ, str** fin_body, int ver, str** tuple);
int reginfo_process_body (struct publ_info* publ, str** fin_body, int ver, str** tuple);
+int dfks_process_body (struct publ_info* publ, str** fin_body, int ver, str** tuple);
@@ -42,5 +42,7 @@ int dlg_process_body(
struct publ_info *publ, str **fin_body, int ver, str **tuple);
int reginfo_process_body(
struct publ_info *publ, str **fin_body, int ver, str **tuple);
+int dfks_process_body(
+ struct publ_info *publ, str **fin_body, int ver, str **tuple);
#endif
diff --git a/src/modules/pua/hash.h b/src/modules/pua/hash.h
index 454e4bb..9be6f81 100644
index 933d246..25799c7 100644
--- a/src/modules/pua/hash.h
+++ b/src/modules/pua/hash.h
@@ -41,6 +41,7 @@
#define DIALOG_EVENT 1<<5
#define REGINFO_EVENT 1<<6
#define XCAPDIFF_EVENT 1<<7
+#define DFKS_EVENT 1<<8
#define DIALOG_EVENT 1 << 5
#define REGINFO_EVENT 1 << 6
#define XCAPDIFF_EVENT 1 << 7
+#define DFKS_EVENT 1<<8
#define UL_PUBLISH 1<<0
#define BLA_PUBLISH 1<<1
#define UL_PUBLISH 1 << 0
#define BLA_PUBLISH 1 << 1
@@ -58,6 +59,8 @@
#define REGINFO_SUBSCRIBE 1<<13
#define XCAPDIFF_PUBLISH 1<<14
#define XCAPDIFF_SUBSCRIBE 1<<15
+#define DFKS_PUBLISH 1<<16
+#define DFKS_SUBSCRIBE 1<<17
#define REGINFO_SUBSCRIBE 1 << 13
#define XCAPDIFF_PUBLISH 1 << 14
#define XCAPDIFF_SUBSCRIBE 1 << 15
+#define DFKS_PUBLISH 1<<16
+#define DFKS_SUBSCRIBE 1<<17
#define NO_UPDATEDB_FLAG 1<<0
#define UPDATEDB_FLAG 1<<1
@@ -172,6 +175,10 @@ static inline int get_event_flag(str* event)
case 15:
if (strncmp(event->s, "message-summary", 15) == 0)
return MSGSUM_EVENT;
+ break;
+ case 16:
+ if (strncmp(event->s, "as-feature-event", 16) == 0)
+ return DFKS_EVENT;
}
#define NO_UPDATEDB_FLAG 1 << 0
#define UPDATEDB_FLAG 1 << 1
@@ -173,6 +176,9 @@ static inline int get_event_flag(str *event)
case 15:
if(strncmp(event->s, "message-summary", 15) == 0)
return MSGSUM_EVENT;
+ case 16:
+ if(strncmp(event->s, "as-feature-event", 16) == 0)
+ return DFKS_EVENT;
}
LM_ERR("Unknown event string\n");
LM_ERR("Unknown event string\n");

@ -10,7 +10,7 @@ Subject: cfgt: route log
4 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/src/modules/cfgt/cfgt_int.c b/src/modules/cfgt/cfgt_int.c
index ed29d29..21433a3 100644
index 15f0606..56e3376 100644
--- a/src/modules/cfgt/cfgt_int.c
+++ b/src/modules/cfgt/cfgt_int.c
@@ -1,6 +1,6 @@
@ -149,7 +149,7 @@ index 197e4bb..1564daa 100644
} cfgt_str_list_t, *cfgt_str_list_p;
diff --git a/src/modules/cfgt/cfgt_mod.c b/src/modules/cfgt/cfgt_mod.c
index 10b0889..1d004ef 100644
index 7dec36a..4809426 100644
--- a/src/modules/cfgt/cfgt_mod.c
+++ b/src/modules/cfgt/cfgt_mod.c
@@ -1,5 +1,5 @@
@ -176,7 +176,7 @@ index 10b0889..1d004ef 100644
};
diff --git a/src/modules/cfgt/doc/cfgt_admin.xml b/src/modules/cfgt/doc/cfgt_admin.xml
index 84d3df6..73f8565 100644
index b3af2de..4975a5c 100644
--- a/src/modules/cfgt/doc/cfgt_admin.xml
+++ b/src/modules/cfgt/doc/cfgt_admin.xml
@@ -163,6 +163,25 @@ modparam("cfgt", "callid_prefix", "TEST-ID%")

@ -7,7 +7,7 @@ Subject: cfgt: don't dump same node
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/modules/cfgt/cfgt_int.c b/src/modules/cfgt/cfgt_int.c
index 6314878..ed29d29 100644
index ed2204b..15f0606 100644
--- a/src/modules/cfgt/cfgt_int.c
+++ b/src/modules/cfgt/cfgt_int.c
@@ -32,6 +32,7 @@

@ -9,7 +9,7 @@ Subject: cfgt: skip_unknown
3 files changed, 36 insertions(+)
diff --git a/src/modules/cfgt/cfgt_int.c b/src/modules/cfgt/cfgt_int.c
index f484f02..6314878 100644
index 2509b3e..ed2204b 100644
--- a/src/modules/cfgt/cfgt_int.c
+++ b/src/modules/cfgt/cfgt_int.c
@@ -43,6 +43,7 @@ cfgt_hash_p _cfgt_uuid = NULL;
@ -62,7 +62,7 @@ index f484f02..6314878 100644
if(jobj == NULL) {
LM_ERR("cannot create json object\n");
diff --git a/src/modules/cfgt/cfgt_mod.c b/src/modules/cfgt/cfgt_mod.c
index 8806d0c..10b0889 100644
index 728d228..7dec36a 100644
--- a/src/modules/cfgt/cfgt_mod.c
+++ b/src/modules/cfgt/cfgt_mod.c
@@ -42,6 +42,7 @@ unsigned int init_flag = 0;
@ -82,7 +82,7 @@ index 8806d0c..10b0889 100644
};
diff --git a/src/modules/cfgt/doc/cfgt_admin.xml b/src/modules/cfgt/doc/cfgt_admin.xml
index 2a2b158..84d3df6 100644
index 920b1bf..b3af2de 100644
--- a/src/modules/cfgt/doc/cfgt_admin.xml
+++ b/src/modules/cfgt/doc/cfgt_admin.xml
@@ -143,6 +143,26 @@ modparam("cfgt", "mask", 12)

@ -3,15 +3,15 @@ Date: Wed, 12 May 2021 11:53:43 +0200
Subject: db_redis_graceful_scan
---
src/modules/db_redis/redis_dbase.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
src/modules/db_redis/redis_dbase.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 4dc4959..2569e0a 100644
index 0cf2791..1d8721d 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -754,7 +754,7 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con, const str *matc
int l;
@@ -824,7 +824,7 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
int l;
-#undef USE_SCAN
@ -19,44 +19,45 @@ index 4dc4959..2569e0a 100644
#ifdef USE_SCAN
@@ -762,6 +762,8 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con, const str *matc
unsigned long cursor = 0;
unsigned int match_count = match_count_start_val;
char match_count_str[16];
+ struct timeval start_tv, end_tv;
+ long tv_diff;
do {
snprintf(cursor_str, sizeof(cursor_str), "%lu", cursor);
@@ -796,7 +798,12 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con, const str *matc
goto err;
}
+ gettimeofday(&start_tv, NULL);
reply = db_redis_command_argv(con, query_v);
+ gettimeofday(&end_tv, NULL);
+ tv_diff = ((long long) end_tv.tv_sec * 1000LL + end_tv.tv_usec / 1000L)
+ - ((long long) start_tv.tv_sec * 1000LL + start_tv.tv_usec / 1000L);
@@ -832,6 +832,8 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
unsigned long cursor = 0;
unsigned int match_count = match_count_start_val;
char match_count_str[16];
+ struct timeval start_tv, end_tv;
+ long tv_diff;
do {
snprintf(cursor_str, sizeof(cursor_str), "%lu", cursor);
@@ -870,7 +872,13 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
goto err;
}
+ gettimeofday(&start_tv, NULL);
reply = db_redis_command_argv(con, query_v);
+ gettimeofday(&end_tv, NULL);
+ tv_diff = ((long long)end_tv.tv_sec * 1000LL + end_tv.tv_usec / 1000L)
+ - ((long long)start_tv.tv_sec * 1000LL
+ + start_tv.tv_usec / 1000L);
+
db_redis_key_free(&query_v);
db_redis_check_reply(con, reply, err);
if (reply->type != REDIS_REPLY_ARRAY) {
@@ -883,11 +890,15 @@ while ((node = nodeNext(&niter)) != NULL) {
}
db_redis_key_free(&query_v);
db_redis_check_reply(con, reply, err);
if(reply->type != REDIS_REPLY_ARRAY) {
@@ -966,11 +974,15 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
}
#ifdef USE_SCAN
- // exponential increase and falloff, hovering around 1000 results
- if (keys_list->elements > 1300 && match_count > 500)
+ // exponential increase and falloff, not to exceed ~100 ms query run time
+ if (tv_diff > 50 && match_count > 10)
match_count /= 2;
- else if (keys_list->elements < 700 && match_count < 500000)
+ else if (tv_diff < 25 && match_count < 1000000)
match_count *= 2;
+ if (cursor > 0) {
+ // give other queries some time to run
+ usleep(100000);
+ }
- // exponential increase and falloff, hovering around 1000 results
- if(keys_list->elements > 1300 && match_count > 500)
+ // exponential increase and falloff, not to exceed ~100 ms query run time
+ if(tv_diff > 50 && match_count > 10)
match_count /= 2;
- else if(keys_list->elements < 700 && match_count < 500000)
+ else if(tv_diff < 25 && match_count < 1000000)
match_count *= 2;
+ if(cursor > 0) {
+ // give other queries some time to run
+ usleep(100000);
+ }
#endif
db_redis_free_reply(&reply);
db_redis_free_reply(&reply);

@ -7,16 +7,16 @@ Subject: db_redis_skip_empty_keys
1 file changed, 3 insertions(+)
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 8f7056b..4dc4959 100644
index ce65628..0cf2791 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -641,6 +641,9 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
LM_DBG("no direct entry key found, checking type keys\n");
for (type = table->types; type; type = type->next) {
key = type->keys;
+ /* skip value-less master keys */
+ if (!key)
+ continue;
LM_DBG("checking type '%.*s'\n", type->type.len, type->type.s);
if (db_redis_find_query_key(key, table_name, table, &type->type, _k, _v, _op, _n, &keyname,
&key_found, ts_scan_start) != 0) {
@@ -700,6 +700,9 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
LM_DBG("no direct entry key found, checking type keys\n");
for(type = table->types; type; type = type->next) {
key = type->keys;
+ /* skip value-less master keys */
+ if(!key)
+ continue;
LM_DBG("checking type '%.*s'\n", type->type.len, type->type.s);
if(db_redis_find_query_key(key, table_name, table, &type->type, _k,
_v, _op, _n, &keyname, &key_found, ts_scan_start)

@ -3,306 +3,336 @@ Date: Wed, 12 May 2021 11:53:43 +0200
Subject: db_redis_sscan
---
src/modules/db_redis/redis_dbase.c | 86 ++++++++++++++++++++++++++++----------
1 file changed, 65 insertions(+), 21 deletions(-)
src/modules/db_redis/redis_dbase.c | 116 +++++++++++++++++++++++++++----------
1 file changed, 84 insertions(+), 32 deletions(-)
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 2569e0a..8511630 100644
index 1d8721d..b98e0f3 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -591,7 +591,7 @@ err:
static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
const db_key_t *_k, const db_val_t *_v, const db_op_t *_op, const int _n,
redis_key_t **query_keys, int *query_keys_count, int **manual_keys, int *manual_keys_count,
- int *do_table_scan, uint64_t *ts_scan_start, str *ts_scan_key) {
+ int *do_table_scan, uint64_t *ts_scan_start, str *ts_scan_key, str *ts_scan_table) {
@@ -646,7 +646,7 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
const db_key_t *_k, const db_val_t *_v, const db_op_t *_op,
const int _n, redis_key_t **query_keys, int *query_keys_count,
int **manual_keys, int *manual_keys_count, int *do_table_scan,
- uint64_t *ts_scan_start, str *ts_scan_key)
+ uint64_t *ts_scan_start, str *ts_scan_key, str *ts_scan_table)
{
struct str_hash_entry *table_e;
redis_table_t *table;
@@ -706,6 +706,21 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
LM_DBG("will use key '%.*s' at offset %llx for timestamp/int range scan\n",
keyname.len, keyname.s, (unsigned long long) *ts_scan_start);
*ts_scan_key = keyname;
+ if (ts_scan_table) {
+ if (ts_scan_table->s)
+ pkg_free(ts_scan_table->s);
+ // <version>:<table>::index::<type>
+ ts_scan_table->len = table->version_code.len + table_name->len + 9 + type->type.len;
+ ts_scan_table->s = pkg_malloc(ts_scan_table->len + 1);
+ if (!ts_scan_table->s) {
+ LM_ERR("Failed to allocate memory for ts_scan_table\n");
+ goto err;
+ }
+ sprintf(ts_scan_table->s, "%.*s%.*s::index::%.*s",
+ table->version_code.len, table->version_code.s,
+ table_name->len, table_name->s,
+ type->type.len, type->type.s);
+ }
keyname.s = NULL;
}
else if (keyname.s) {
@@ -742,6 +757,7 @@ err:
struct str_hash_entry *table_e;
@@ -775,6 +775,22 @@ static int db_redis_build_query_keys(km_redis_con_t *con, const str *table_name,
keyname.len, keyname.s,
(unsigned long long)*ts_scan_start);
*ts_scan_key = keyname;
+ if(ts_scan_table) {
+ if(ts_scan_table->s)
+ pkg_free(ts_scan_table->s);
+ // <version>:<table>::index::<type>
+ ts_scan_table->len = table->version_code.len
+ + table_name->len + 9 + type->type.len;
+ ts_scan_table->s = pkg_malloc(ts_scan_table->len + 1);
+ if(!ts_scan_table->s) {
+ LM_ERR("Failed to allocate memory for ts_scan_table\n");
+ goto err;
+ }
+ sprintf(ts_scan_table->s, "%.*s%.*s::index::%.*s",
+ table->version_code.len, table->version_code.s,
+ table_name->len, table_name->s, type->type.len,
+ type->type.s);
+ }
keyname.s = NULL;
} else if(keyname.s) {
pkg_free(keyname.s);
@@ -811,9 +827,9 @@ err:
}
static int db_redis_scan_query_keys_pattern(km_redis_con_t *con, const str *match_pattern,
+ const str *index_key,
const int _n,
redis_key_t **query_keys, int *query_keys_count,
int **manual_keys, int *manual_keys_count, unsigned int match_count_start_val) {
@@ -768,9 +784,21 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con, const str *matc
do {
snprintf(cursor_str, sizeof(cursor_str), "%lu", cursor);
static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
- const str *match_pattern, const int _n, redis_key_t **query_keys,
- int *query_keys_count, int **manual_keys, int *manual_keys_count,
- unsigned int match_count_start_val)
+ const str *match_pattern, const str *index_key, const int _n,
+ redis_key_t **query_keys, int *query_keys_count, int **manual_keys,
+ int *manual_keys_count, unsigned int match_count_start_val)
{
- if (db_redis_key_add_string(&query_v, "SCAN", 4) != 0) {
- LM_ERR("Failed to add scan command to scan query\n");
- goto err;
+ if (!index_key) {
+ if (db_redis_key_add_string(&query_v, "SCAN", 4) != 0) {
+ LM_ERR("Failed to add scan command to scan query\n");
+ goto err;
+ }
+ }
+ else {
+ if (db_redis_key_add_string(&query_v, "SSCAN", 5) != 0) {
+ LM_ERR("Failed to add scan command to scan query\n");
+ goto err;
+ }
+ if (db_redis_key_add_string(&query_v, index_key->s, index_key->len) != 0) {
+ LM_ERR("Failed to add scan command to scan query\n");
+ goto err;
+ }
}
if (db_redis_key_add_string(&query_v, cursor_str, strlen(cursor_str)) != 0) {
LM_ERR("Failed to add cursor to scan query\n");
@@ -951,7 +979,8 @@ err:
static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
const int _n,
redis_key_t **query_keys, int *query_keys_count,
- int **manual_keys, int *manual_keys_count, uint64_t ts_scan_start, const str *ts_scan_key) {
+ int **manual_keys, int *manual_keys_count, uint64_t ts_scan_start, const str *ts_scan_key,
+ const str *ts_scan_table) {
struct str_hash_entry *table_e;
redis_table_t *table;
@@ -988,7 +1017,7 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
table->version_code.len, table->version_code.s,
table_name->len, table_name->s);
str match_pattern = {match, len};
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n, query_keys, query_keys_count,
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern, ts_scan_table, _n, query_keys, query_keys_count,
manual_keys, manual_keys_count, 1000);
pkg_free(match);
return ret;
@@ -1050,7 +1079,7 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
str match_pattern = {match, len};
LM_DBG("running timestamp/int range matching using pattern '%.*s'\n", len, match);
size_t i = 0;
@@ -838,9 +854,21 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
do {
snprintf(cursor_str, sizeof(cursor_str), "%lu", cursor);
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n, &set_keys, &set_keys_count,
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern, ts_scan_table, _n, &set_keys, &set_keys_count,
manual_keys, manual_keys_count, 5000);
if (ret)
goto out;
@@ -1095,7 +1124,7 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
str match_pattern = {match, len};
LM_DBG("running timestamp/int range matching using pattern '%.*s'\n", len, match);
- if(db_redis_key_add_string(&query_v, "SCAN", 4) != 0) {
- LM_ERR("Failed to add scan command to scan query\n");
- goto err;
+ if(!index_key) {
+ if(db_redis_key_add_string(&query_v, "SCAN", 4) != 0) {
+ LM_ERR("Failed to add scan command to scan query\n");
+ goto err;
+ }
+ } else {
+ if(db_redis_key_add_string(&query_v, "SSCAN", 5) != 0) {
+ LM_ERR("Failed to add scan command to scan query\n");
+ goto err;
+ }
+ if(db_redis_key_add_string(&query_v, index_key->s, index_key->len)
+ != 0) {
+ LM_ERR("Failed to add scan command to scan query\n");
+ goto err;
+ }
}
if(db_redis_key_add_string(&query_v, cursor_str, strlen(cursor_str))
!= 0) {
@@ -1033,7 +1061,7 @@ return -1;
static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
const int _n, redis_key_t **query_keys, int *query_keys_count,
int **manual_keys, int *manual_keys_count, uint64_t ts_scan_start,
- const str *ts_scan_key)
+ const str *ts_scan_key, const str *ts_scan_table)
{
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n, &set_keys, &set_keys_count,
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern, ts_scan_table, _n, &set_keys, &set_keys_count,
manual_keys, manual_keys_count, 5000);
if (ret)
goto out;
@@ -1108,7 +1137,7 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
str match_pattern = {match, len};
LM_DBG("running timestamp/int range matching using pattern '%.*s'\n", len, match);
struct str_hash_entry *table_e;
@@ -1070,9 +1098,9 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
int len = sprintf(match, "%.*s%.*s:entry::*", table->version_code.len,
table->version_code.s, table_name->len, table_name->s);
str match_pattern = {match, len};
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n,
- query_keys, query_keys_count, manual_keys, manual_keys_count,
- 1000);
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern,
+ ts_scan_table, _n, query_keys, query_keys_count, manual_keys,
+ manual_keys_count, 1000);
pkg_free(match);
return ret;
}
@@ -1136,9 +1164,9 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
"'%.*s'\n",
len, match);
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n, &set_keys, &set_keys_count,
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern, ts_scan_table, _n, &set_keys, &set_keys_count,
manual_keys, manual_keys_count, 5000);
if (ret)
goto out;
@@ -1466,7 +1495,7 @@ static int db_redis_perform_query(const db1_con_t* _h, km_redis_con_t *con, cons
const int _n, const int _nc, db1_res_t** _r,
redis_key_t **keys, int *keys_count,
int **manual_keys, int *manual_keys_count, int do_table_scan, uint64_t ts_scan_start,
- const str *ts_scan_key) {
+ const str *ts_scan_key, const str *ts_scan_table) {
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n,
- &set_keys, &set_keys_count, manual_keys, manual_keys_count,
- 5000);
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern,
+ ts_scan_table, _n, &set_keys, &set_keys_count, manual_keys,
+ manual_keys_count, 5000);
if(ret)
goto out;
}
@@ -1183,9 +1211,9 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
LM_DBG("running timestamp/int range matching using pattern '%.*s'\n",
len, match);
redisReply *reply = NULL;
redis_key_t *query_v = NULL;
@@ -1500,7 +1529,7 @@ static int db_redis_perform_query(const db1_con_t* _h, km_redis_con_t *con, cons
}
if (db_redis_scan_query_keys(con, CON_TABLE(_h), _n,
keys, keys_count,
- manual_keys, manual_keys_count, ts_scan_start, ts_scan_key) != 0) {
+ manual_keys, manual_keys_count, ts_scan_start, ts_scan_key, ts_scan_table) != 0) {
LM_ERR("failed to scan query keys\n");
goto error;
}
@@ -1651,7 +1680,7 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
const db_val_t* _v, const db_op_t *_op, const int _n,
redis_key_t **keys, int *keys_count,
int **manual_keys, int *manual_keys_count, int do_table_scan, uint64_t ts_scan_start,
- const str *ts_scan_key) {
+ const str *ts_scan_key, const str *ts_scan_table) {
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n,
- &set_keys, &set_keys_count, manual_keys, manual_keys_count,
- 5000);
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern,
+ ts_scan_table, _n, &set_keys, &set_keys_count, manual_keys,
+ manual_keys_count, 5000);
if(ret)
goto out;
}
@@ -1199,9 +1227,9 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
LM_DBG("running timestamp/int range matching using pattern '%.*s'\n",
len, match);
int i = 0, j = 0;
redis_key_t *k = NULL;
@@ -1688,7 +1717,7 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
}
if (db_redis_scan_query_keys(con, CON_TABLE(_h), _n,
keys, keys_count,
- manual_keys, manual_keys_count, ts_scan_start, ts_scan_key) != 0) {
+ manual_keys, manual_keys_count, ts_scan_start, ts_scan_key, ts_scan_table) != 0) {
LM_ERR("failed to scan query keys\n");
goto error;
}
@@ -1953,7 +1982,7 @@ static int db_redis_perform_update(const db1_con_t* _h, km_redis_con_t *con, con
const int _n, const int _nu,
redis_key_t **keys, int *keys_count,
int **manual_keys, int *manual_keys_count, int do_table_scan, uint64_t ts_scan_start,
- const str *ts_scan_key) {
+ const str *ts_scan_key, const str *ts_scan_table) {
- ret = db_redis_scan_query_keys_pattern(con, &match_pattern, _n,
- &set_keys, &set_keys_count, manual_keys, manual_keys_count,
- 5000);
+ ret = db_redis_scan_query_keys_pattern(con, &match_pattern,
+ ts_scan_table, _n, &set_keys, &set_keys_count, manual_keys,
+ manual_keys_count, 5000);
if(ret)
goto out;
}
@@ -1579,7 +1607,7 @@ static int db_redis_perform_query(const db1_con_t *_h, km_redis_con_t *con,
const db_key_t *_c, const int _n, const int _nc, db1_res_t **_r,
redis_key_t **keys, int *keys_count, int **manual_keys,
int *manual_keys_count, int do_table_scan, uint64_t ts_scan_start,
- const str *ts_scan_key)
+ const str *ts_scan_key, const str *ts_scan_table)
{
redisReply *reply = NULL;
redis_key_t *query_v = NULL;
@@ -1985,7 +2014,7 @@ static int db_redis_perform_update(const db1_con_t* _h, km_redis_con_t *con, con
}
if (db_redis_scan_query_keys(con, CON_TABLE(_h), _n,
keys, keys_count,
- manual_keys, manual_keys_count, ts_scan_start, ts_scan_key) != 0) {
+ manual_keys, manual_keys_count, ts_scan_start, ts_scan_key, ts_scan_table) != 0) {
LM_ERR("failed to scan query keys\n");
goto error;
}
@@ -2435,6 +2464,7 @@ int db_redis_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
int do_table_scan = 0;
uint64_t ts_scan_start = 0;
str ts_scan_key = {0,};
+ str ts_scan_table = {0,};
redisReply *reply = NULL;
@@ -1614,7 +1642,8 @@ static int db_redis_perform_query(const db1_con_t *_h, km_redis_con_t *con,
CON_TABLE(_h)->s);
}
if(db_redis_scan_query_keys(con, CON_TABLE(_h), _n, keys, keys_count,
- manual_keys, manual_keys_count, ts_scan_start, ts_scan_key)
+ manual_keys, manual_keys_count, ts_scan_start, ts_scan_key,
+ ts_scan_table)
!= 0) {
LM_ERR("failed to scan query keys\n");
goto error;
@@ -1769,7 +1798,7 @@ static int db_redis_perform_delete(const db1_con_t *_h, km_redis_con_t *con,
const db_key_t *_k, const db_val_t *_v, const db_op_t *_op,
const int _n, redis_key_t **keys, int *keys_count, int **manual_keys,
int *manual_keys_count, int do_table_scan, uint64_t ts_scan_start,
- const str *ts_scan_key)
+ const str *ts_scan_key, const str *ts_scan_table)
{
redis_key_t *keys = NULL;
int keys_count = 0;
@@ -2506,7 +2536,7 @@ int db_redis_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
if (_n > 0) {
if (db_redis_build_query_keys(con, CON_TABLE(_h), _k, _v, query_ops, _n,
&keys, &keys_count, &manual_keys, &manual_keys_count, &do_table_scan, &ts_scan_start,
- &ts_scan_key) != 0) {
+ &ts_scan_key, &ts_scan_table) != 0) {
LM_ERR("failed to build query keys\n");
goto error;
}
@@ -2524,7 +2554,7 @@ int db_redis_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
}
int i = 0, j = 0;
@@ -1807,7 +1836,8 @@ static int db_redis_perform_delete(const db1_con_t *_h, km_redis_con_t *con,
LM_WARN(" scan key %d is '%.*s'\n", i, _k[i]->len, _k[i]->s);
}
if(db_redis_scan_query_keys(con, CON_TABLE(_h), _n, keys, keys_count,
- manual_keys, manual_keys_count, ts_scan_start, ts_scan_key)
+ manual_keys, manual_keys_count, ts_scan_start, ts_scan_key,
+ ts_scan_table)
!= 0) {
LM_ERR("failed to scan query keys\n");
goto error;
@@ -2083,7 +2113,7 @@ static int db_redis_perform_update(const db1_con_t *_h, km_redis_con_t *con,
const db_key_t *_uk, const db_val_t *_uv, const int _n, const int _nu,
redis_key_t **keys, int *keys_count, int **manual_keys,
int *manual_keys_count, int do_table_scan, uint64_t ts_scan_start,
- const str *ts_scan_key)
+ const str *ts_scan_key, const str *ts_scan_table)
{
if (db_redis_perform_query(_h, con, _k, _v, query_ops, _c, _n, _nc, _r,
- &keys, &keys_count, &manual_keys, &manual_keys_count, do_table_scan, ts_scan_start, &ts_scan_key) != 0) {
+ &keys, &keys_count, &manual_keys, &manual_keys_count, do_table_scan, ts_scan_start, &ts_scan_key, &ts_scan_table) != 0) {
goto error;
}
redisReply *reply = NULL;
@@ -2115,7 +2145,8 @@ static int db_redis_perform_update(const db1_con_t *_h, km_redis_con_t *con,
LM_WARN(" scan key %d is '%.*s'\n", i, _k[i]->len, _k[i]->s);
}
if(db_redis_scan_query_keys(con, CON_TABLE(_h), _n, keys, keys_count,
- manual_keys, manual_keys_count, ts_scan_start, ts_scan_key)
+ manual_keys, manual_keys_count, ts_scan_start, ts_scan_key,
+ ts_scan_table)
!= 0) {
LM_ERR("failed to scan query keys\n");
goto error;
@@ -2589,6 +2620,9 @@ int db_redis_query(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
str ts_scan_key = {
0,
};
+ str ts_scan_table = {
+ 0,
+ };
@@ -2540,6 +2570,8 @@ int db_redis_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
}
if (ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if (ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
redis_key_t *keys = NULL;
int keys_count = 0;
@@ -2663,7 +2697,7 @@ int db_redis_query(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
if(_n > 0) {
if(db_redis_build_query_keys(con, CON_TABLE(_h), _k, _v, query_ops, _n,
&keys, &keys_count, &manual_keys, &manual_keys_count,
- &do_table_scan, &ts_scan_start, &ts_scan_key)
+ &do_table_scan, &ts_scan_start, &ts_scan_key, &ts_scan_table)
!= 0) {
LM_ERR("failed to build query keys\n");
goto error;
@@ -2686,7 +2720,7 @@ int db_redis_query(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
db_redis_consume_replies(con);
return 0;
@@ -2555,6 +2587,8 @@ error:
}
if (ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if (ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
if(db_redis_perform_query(_h, con, _k, _v, query_ops, _c, _n, _nc, _r,
&keys, &keys_count, &manual_keys, &manual_keys_count,
- do_table_scan, ts_scan_start, &ts_scan_key)
+ do_table_scan, ts_scan_start, &ts_scan_key, &ts_scan_table)
!= 0) {
goto error;
}
@@ -2703,6 +2737,8 @@ int db_redis_query(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
}
if(ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if(ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return 0;
@@ -2718,6 +2754,8 @@ error:
}
if(ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if(ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
@@ -2740,6 +2774,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k,
int do_table_scan = 0;
uint64_t ts_scan_start = 0;
str ts_scan_key = {0,};
+ str ts_scan_table = {0,};
db_op_t *query_ops = NULL;
int i;
@@ -2785,7 +2820,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k,
if (_n > 0) {
if (db_redis_build_query_keys(con, CON_TABLE(_h), _k, _v, query_ops, _n,
&keys, &keys_count, &manual_keys, &manual_keys_count, &do_table_scan, &ts_scan_start,
- &ts_scan_key) != 0) {
+ &ts_scan_key, &ts_scan_table) != 0) {
LM_ERR("failed to build query keys\n");
goto error;
}
@@ -2803,7 +2838,7 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k,
}
@@ -2909,6 +2947,9 @@ int db_redis_delete(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
str ts_scan_key = {
0,
};
+ str ts_scan_table = {
+ 0,
+ };
db_op_t *query_ops = NULL;
int i;
if (db_redis_perform_delete(_h, con, _k, _v, query_ops, _n,
- &keys, &keys_count, &manual_keys, &manual_keys_count, do_table_scan, ts_scan_start, &ts_scan_key) != 0) {
+ &keys, &keys_count, &manual_keys, &manual_keys_count, do_table_scan, ts_scan_start, &ts_scan_key, &ts_scan_table) != 0) {
goto error;
}
@@ -2954,7 +2995,7 @@ int db_redis_delete(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
if(_n > 0) {
if(db_redis_build_query_keys(con, CON_TABLE(_h), _k, _v, query_ops, _n,
&keys, &keys_count, &manual_keys, &manual_keys_count,
- &do_table_scan, &ts_scan_start, &ts_scan_key)
+ &do_table_scan, &ts_scan_start, &ts_scan_key, &ts_scan_table)
!= 0) {
LM_ERR("failed to build query keys\n");
goto error;
@@ -2977,7 +3018,7 @@ int db_redis_delete(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
@@ -2817,6 +2852,8 @@ int db_redis_delete(const db1_con_t* _h, const db_key_t* _k,
pkg_free(manual_keys);
if (ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if (ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
if(db_redis_perform_delete(_h, con, _k, _v, query_ops, _n, &keys,
&keys_count, &manual_keys, &manual_keys_count, do_table_scan,
- ts_scan_start, &ts_scan_key)
+ ts_scan_start, &ts_scan_key, &ts_scan_table)
!= 0) {
goto error;
}
@@ -2992,6 +3033,8 @@ int db_redis_delete(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
pkg_free(manual_keys);
if(ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if(ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return 0;
@@ -2831,6 +2868,8 @@ error:
pkg_free(manual_keys);
if (ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if (ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return -1;
return 0;
@@ -3006,6 +3049,8 @@ error:
pkg_free(manual_keys);
if(ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if(ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return -1;
}
@@ -2855,6 +2894,7 @@ int db_redis_update(const db1_con_t* _h, const db_key_t* _k,
int do_table_scan = 0;
uint64_t ts_scan_start = 0;
str ts_scan_key = {0,};
+ str ts_scan_table = {0,};
redis_key_t *keys = NULL;
int keys_count = 0;
@@ -2905,7 +2945,7 @@ int db_redis_update(const db1_con_t* _h, const db_key_t* _k,
if (_n > 0) {
if (db_redis_build_query_keys(con, CON_TABLE(_h), _k, _v, query_ops, _n,
&keys, &keys_count, &manual_keys, &manual_keys_count, &do_table_scan, &ts_scan_start,
- &ts_scan_key) != 0) {
+ &ts_scan_key, &ts_scan_table) != 0) {
LM_ERR("failed to build query keys\n");
goto error;
}
@@ -2922,7 +2962,7 @@ int db_redis_update(const db1_con_t* _h, const db_key_t* _k,
}
@@ -3032,6 +3077,9 @@ int db_redis_update(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
str ts_scan_key = {
0,
};
+ str ts_scan_table = {
+ 0,
+ };
if (db_redis_perform_update(_h, con, _k, _v, query_ops, _uk, _uv, _n, _nu,
- &keys, &keys_count, &manual_keys, &manual_keys_count, do_table_scan, ts_scan_start, &ts_scan_key) != 0) {
+ &keys, &keys_count, &manual_keys, &manual_keys_count, do_table_scan, ts_scan_start, &ts_scan_key, &ts_scan_table) != 0) {
goto error;
}
redis_key_t *keys = NULL;
int keys_count = 0;
@@ -3082,7 +3130,7 @@ int db_redis_update(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
if(_n > 0) {
if(db_redis_build_query_keys(con, CON_TABLE(_h), _k, _v, query_ops, _n,
&keys, &keys_count, &manual_keys, &manual_keys_count,
- &do_table_scan, &ts_scan_start, &ts_scan_key)
+ &do_table_scan, &ts_scan_start, &ts_scan_key, &ts_scan_table)
!= 0) {
LM_ERR("failed to build query keys\n");
goto error;
@@ -3104,7 +3152,7 @@ int db_redis_update(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
@@ -2938,6 +2978,8 @@ int db_redis_update(const db1_con_t* _h, const db_key_t* _k,
}
if (ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if (ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return 0;
if(db_redis_perform_update(_h, con, _k, _v, query_ops, _uk, _uv, _n, _nu,
&keys, &keys_count, &manual_keys, &manual_keys_count,
- do_table_scan, ts_scan_start, &ts_scan_key)
+ do_table_scan, ts_scan_start, &ts_scan_key, &ts_scan_table)
!= 0) {
goto error;
}
@@ -3121,6 +3169,8 @@ int db_redis_update(const db1_con_t *_h, const db_key_t *_k, const db_op_t *_op,
}
if(ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if(ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return 0;
@@ -2952,6 +2994,8 @@ error:
}
if (ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if (ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return -1;
@@ -3135,6 +3185,8 @@ error:
}
if(ts_scan_key.s)
pkg_free(ts_scan_key.s);
+ if(ts_scan_table.s)
+ pkg_free(ts_scan_table.s);
db_redis_consume_replies(con);
return -1;
}

@ -7,15 +7,15 @@ Subject: db_redis_sscan_fix_empty_key
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 8511630..a806f78 100644
index b98e0f3..c0b9416 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -784,7 +784,7 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con, const str *matc
do {
snprintf(cursor_str, sizeof(cursor_str), "%lu", cursor);
@@ -854,7 +854,7 @@ static int db_redis_scan_query_keys_pattern(km_redis_con_t *con,
do {
snprintf(cursor_str, sizeof(cursor_str), "%lu", cursor);
- if (!index_key) {
+ if (!index_key || !index_key->len) {
if (db_redis_key_add_string(&query_v, "SCAN", 4) != 0) {
LM_ERR("Failed to add scan command to scan query\n");
goto err;
- if(!index_key) {
+ if(!index_key || !index_key->len) {
if(db_redis_key_add_string(&query_v, "SCAN", 4) != 0) {
LM_ERR("Failed to add scan command to scan query\n");
goto err;

@ -4,12 +4,12 @@ Subject: dialog: dlg_get_ttag()
---
src/modules/dialog/dialog.c | 126 ++++++++++++++++++++++++++++++++++++++++++
src/modules/dialog/dlg_hash.c | 70 +++++++++++++++++++++++
src/modules/dialog/dlg_hash.c | 72 ++++++++++++++++++++++++
src/modules/dialog/dlg_hash.h | 13 +++++
3 files changed, 209 insertions(+)
3 files changed, 211 insertions(+)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index b76f1da..9478c67 100644
index 7a416ee..02c8b1b 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -54,6 +54,7 @@
@ -20,9 +20,9 @@ index b76f1da..9478c67 100644
#include "../../core/mod_fix.h"
#include "../../core/script_cb.h"
#include "../../core/kemi.h"
@@ -197,6 +198,9 @@ static int fixup_dlg_refer(void** param, int param_no);
static int fixup_dlg_bridge(void** param, int param_no);
static int w_dlg_get(struct sip_msg*, char*, char*, char*);
@@ -197,6 +198,9 @@ static int fixup_dlg_refer(void **param, int param_no);
static int fixup_dlg_bridge(void **param, int param_no);
static int w_dlg_get(struct sip_msg *, char *, char *, char *);
static int w_is_known_dlg(struct sip_msg *);
+static int w_dlg_get_ttag(sip_msg_t *, char *, char *, char *);
+static int fixup_dlg_get_ttag(void** param, int param_no);
@ -30,7 +30,7 @@ index b76f1da..9478c67 100644
static int w_dlg_set_ruri(sip_msg_t *, char *, char *);
static int w_dlg_db_load_callid(sip_msg_t *msg, char *ci, char *p2);
static int w_dlg_db_load_extra(sip_msg_t *msg, char *p1, char *p2);
@@ -255,6 +259,8 @@ static cmd_export_t cmds[]={
@@ -260,6 +264,8 @@ static cmd_export_t cmds[]={
0, ANY_ROUTE },
{"is_known_dlg", (cmd_function)w_is_known_dlg, 0, NULL,
0, ANY_ROUTE },
@ -39,7 +39,7 @@ index b76f1da..9478c67 100644
{"dlg_set_timeout", (cmd_function)w_dlg_set_timeout, 1,fixup_igp_null,
0, ANY_ROUTE },
{"dlg_set_timeout", (cmd_function)w_dlg_set_timeout, 3,fixup_igp_all,
@@ -1992,6 +1998,121 @@ static int fixup_dlg_set_var_free(void** param, int param_no)
@@ -1981,6 +1987,121 @@ static int fixup_dlg_set_var_free(void **param, int param_no)
return -1;
}
@ -161,7 +161,7 @@ index b76f1da..9478c67 100644
static int ki_dlg_get(sip_msg_t *msg, str *sc, str *sf, str *st)
{
dlg_cell_t *dlg = NULL;
@@ -2572,6 +2693,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
@@ -2556,6 +2677,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
@ -174,10 +174,10 @@ index b76f1da..9478c67 100644
SR_KEMIP_XVAL, ki_dlg_get_var,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c
index d61bfb6..b9084fb 100644
index c5c5042..22346f3 100644
--- a/src/modules/dialog/dlg_hash.c
+++ b/src/modules/dialog/dlg_hash.c
@@ -916,7 +916,48 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
@@ -908,6 +908,49 @@ static inline struct dlg_cell *internal_get_dlg(unsigned int h_entry,
return 0;
}
@ -190,43 +190,44 @@ index d61bfb6..b9084fb 100644
+ * \param mode let hash table slot locked or not, even when dlg is not found
+ * \return dialog structure on success, NULL on failure
+ */
+static inline struct dlg_cell* internal_get_dlg_confirmed(unsigned int h_entry,
+ str *callid, str *ftag, int mode)
+static inline struct dlg_cell *internal_get_dlg_confirmed(
+ unsigned int h_entry, str *callid, str *ftag, int mode)
+{
+ struct dlg_cell *dlg;
+ struct dlg_entry *d_entry;
+
+ d_entry = &(d_table->entries[h_entry]);
+
+ dlg_lock( d_table, d_entry);
+ dlg_lock(d_table, d_entry);
+
+ for( dlg = d_entry->first ; dlg ; dlg = dlg->next ) {
+ for(dlg = d_entry->first; dlg; dlg = dlg->next) {
+ if(dlg->state != DLG_STATE_CONFIRMED)
+ continue;
+ /* check callid / fromtag */
+ if (match_downstream_dialog( dlg, callid, ftag)==1) {
+ if(match_downstream_dialog(dlg, callid, ftag) == 1) {
+ ref_dlg_unsafe(dlg, 1);
+ if(likely(mode==0)) {
+ dlg_unlock( d_table, d_entry);
+ if(likely(mode == 0)) {
+ dlg_unlock(d_table, d_entry);
+ }
+ LM_DBG("dialog callid='%.*s' found on entry %u, to-tag='%.*s'\n",
+ STR_FMT(callid), h_entry, STR_FMT(&dlg->tag[DLG_CALLEE_LEG]));
+ STR_FMT(callid), h_entry,
+ STR_FMT(&dlg->tag[DLG_CALLEE_LEG]));
+ return dlg;
+ }
+ }
+
+ if(likely(mode==0)) {
+ if(likely(mode == 0)) {
+ dlg_unlock(d_table, d_entry);
+ }
+
+ LM_DBG("no dialog callid='%.*s' from-tag='%.*s' found\n",
+ STR_FMT(callid), STR_FMT(ftag));
+ LM_DBG("no dialog callid='%.*s' from-tag='%.*s' found\n", STR_FMT(callid),
+ STR_FMT(ftag));
+ return 0;
+}
/*!
* \brief Get dialog that correspond to CallId, From Tag and To Tag
@@ -953,6 +994,35 @@ struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir)
@@ -944,6 +987,35 @@ struct dlg_cell *get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir)
return dlg;
}
@ -239,21 +240,21 @@ index d61bfb6..b9084fb 100644
+ * \param ftag from tag
+ * \return dialog structure on success, NULL on failure
+ */
+struct dlg_cell* get_dlg_confirmed(str *callid, str *ftag)
+struct dlg_cell *get_dlg_confirmed(str *callid, str *ftag)
+{
+ struct dlg_cell *dlg;
+ unsigned int he;
+
+ if(d_table==NULL) {
+ if(d_table == NULL) {
+ LM_ERR("dialog hash table not available\n");
+ return 0;
+ }
+ he = core_hash(callid, 0, d_table->size);
+ dlg = internal_get_dlg_confirmed(he, callid, ftag, 0);
+
+ if (dlg == 0) {
+ if(dlg == 0) {
+ LM_DBG("no dialog callid='%.*s' from-tag='%.*s' found\n",
+ STR_FMT(callid), STR_FMT(ftag));
+ STR_FMT(callid), STR_FMT(ftag));
+ return 0;
+ }
+ return dlg;
@ -263,12 +264,12 @@ index d61bfb6..b9084fb 100644
/*!
* \brief Search dialog that corresponds to CallId, From Tag and To Tag
diff --git a/src/modules/dialog/dlg_hash.h b/src/modules/dialog/dlg_hash.h
index 067f489..041c0c4 100644
index e4b583f..bfafde1 100644
--- a/src/modules/dialog/dlg_hash.h
+++ b/src/modules/dialog/dlg_hash.h
@@ -391,6 +391,19 @@ dlg_cell_t* dlg_get_by_iuid(dlg_iuid_t *diuid);
@@ -394,6 +394,19 @@ dlg_cell_t *dlg_get_by_iuid(dlg_iuid_t *diuid);
*/
dlg_cell_t* get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir);
dlg_cell_t *get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir);
+/*!
+ * \brief Get confirmed dialog that correspond to CallId and From Tag

@ -3,17 +3,17 @@ Date: Mon, 27 Jun 2022 21:04:29 +0200
Subject: dialog: support profile_get_size for all profiles
---
src/modules/dialog/dialog.c | 35 +++++++++++++++++++++++++++++++++
src/modules/dialog/dialog.c | 34 +++++++++++++++++++++++++++++++++
src/modules/dialog/dlg_profile.c | 8 ++++++++
src/modules/dialog/dlg_profile.h | 5 +++++
src/modules/dialog/doc/dialog_admin.xml | 22 +++++++++++++++++++++
4 files changed, 70 insertions(+)
4 files changed, 69 insertions(+)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 947c403..b76f1da 100644
index e937947..7a416ee 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -3011,6 +3011,33 @@ static void internal_rpc_profile_get_size(rpc_t *rpc, void *c, str *profile_name
@@ -3026,6 +3026,31 @@ static void internal_rpc_profile_get_size(
return;
}
@ -31,12 +31,10 @@ index 947c403..b76f1da 100644
+ dlg_profile_table_t *profile;
+
+ profile = get_first_dlg_profile();
+ for (; profile; profile = profile->next) {
+ for(; profile; profile = profile->next) {
+ size = get_profile_size(profile, NULL);
+ rpc->add(c, "{", &h);
+ if (rpc->struct_add(h, "Sd",
+ "name", &profile->name,
+ "size", size) < 0) {
+ if(rpc->struct_add(h, "Sd", "name", &profile->name, "size", size) < 0) {
+ rpc->fault(c, 500, "Server failure");
+ return;
+ }
@ -47,40 +45,41 @@ index 947c403..b76f1da 100644
/*!
* \brief Helper function that outputs the dialogs belonging to a given profile via the RPC interface
* \see rpc_profile_print_dlgs
@@ -3103,6 +3130,9 @@ static const char *rpc_dlg_set_state_doc[3] = {
@@ -3110,6 +3135,8 @@ static const char *rpc_dlg_set_state_doc[3] = {
0};
static const char *rpc_profile_get_size_doc[2] = {
"Returns the number of dialogs belonging to a profile", 0
};
"Returns the number of dialogs belonging to a profile", 0};
+static const char *rpc_profile_get_sizes_doc[2] = {
+ "Returns the number of dialogs belonging to all profiles", 0
+};
+ "Returns the number of dialogs belonging to all profiles", 0};
static const char *rpc_profile_print_dlgs_doc[2] = {
"Lists all the dialogs belonging to a profile", 0
};
@@ -3308,6 +3338,10 @@ static void rpc_profile_get_size(rpc_t *rpc, void *c) {
"Lists all the dialogs belonging to a profile", 0};
static const char *rpc_dlg_bridge_doc[2] = {
@@ -3326,6 +3353,11 @@ static void rpc_profile_get_size(rpc_t *rpc, void *c)
}
return;
}
+static void rpc_profile_get_sizes(rpc_t *rpc, void *c) {
+static void rpc_profile_get_sizes(rpc_t *rpc, void *c)
+{
+ internal_rpc_profile_get_sizes(rpc, c);
+ return;
+}
static void rpc_profile_print_dlgs(rpc_t *rpc, void *c) {
str profile_name = {NULL,0};
str value = {NULL,0};
@@ -3725,6 +3759,7 @@ static rpc_export_t rpc_methods[] = {
{"dlg.dlg_list_ctx", rpc_print_dlg_ctx, rpc_print_dlg_ctx_doc, 0},
{"dlg.end_dlg", rpc_end_dlg_entry_id, rpc_end_dlg_entry_id_doc, 0},
{"dlg.profile_get_size", rpc_profile_get_size, rpc_profile_get_size_doc, 0},
+ {"dlg.profile_get_sizes", rpc_profile_get_sizes, rpc_profile_get_sizes_doc, RET_ARRAY},
{"dlg.profile_list", rpc_profile_print_dlgs, rpc_profile_print_dlgs_doc, RET_ARRAY},
{"dlg.bridge_dlg", rpc_dlg_bridge, rpc_dlg_bridge_doc, 0},
{"dlg.terminate_dlg", rpc_dlg_terminate_dlg, rpc_dlg_terminate_dlg_doc, 0},
static void rpc_profile_print_dlgs(rpc_t *rpc, void *c)
{
str profile_name = {NULL, 0};
@@ -3743,6 +3775,8 @@ static rpc_export_t rpc_methods[] = {
{"dlg.end_dlg", rpc_end_dlg_entry_id, rpc_end_dlg_entry_id_doc, 0},
{"dlg.profile_get_size", rpc_profile_get_size, rpc_profile_get_size_doc,
0},
+ {"dlg.profile_get_sizes", rpc_profile_get_sizes,
+ rpc_profile_get_sizes_doc, RET_ARRAY},
{"dlg.profile_list", rpc_profile_print_dlgs, rpc_profile_print_dlgs_doc,
RET_ARRAY},
{"dlg.bridge_dlg", rpc_dlg_bridge, rpc_dlg_bridge_doc, 0},
diff --git a/src/modules/dialog/dlg_profile.c b/src/modules/dialog/dlg_profile.c
index f9ad20f..0d3e62f 100644
index 5dd3b37..2b2493e 100644
--- a/src/modules/dialog/dlg_profile.c
+++ b/src/modules/dialog/dlg_profile.c
@@ -126,6 +126,14 @@ int add_profile_definitions( char* profiles, unsigned int has_value)
@@ -127,6 +127,14 @@ int add_profile_definitions(char *profiles, unsigned int has_value)
return 0;
}
@ -96,10 +95,10 @@ index f9ad20f..0d3e62f 100644
/*!
* \brief Search a dialog profile in the global list
diff --git a/src/modules/dialog/dlg_profile.h b/src/modules/dialog/dlg_profile.h
index 3dc7be8..7a4f8b0 100644
index 4a6f6f1..38b5928 100644
--- a/src/modules/dialog/dlg_profile.h
+++ b/src/modules/dialog/dlg_profile.h
@@ -108,6 +108,11 @@ int add_profile_definitions( char* profiles, unsigned int has_value);
@@ -112,6 +112,11 @@ int add_profile_definitions(char *profiles, unsigned int has_value);
*/
void destroy_dlg_profiles(void);
@ -112,7 +111,7 @@ index 3dc7be8..7a4f8b0 100644
/*!
* \brief Search a dialog profile in the global list
diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml
index 6350e2d..5894829 100644
index 07116e7..a2513cc 100644
--- a/src/modules/dialog/doc/dialog_admin.xml
+++ b/src/modules/dialog/doc/dialog_admin.xml
@@ -3013,6 +3013,28 @@ dlg_reset_property("timeout-noreset");

@ -7,16 +7,16 @@ Subject: dialplan: don't stop loading rules on error
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/modules/dialplan/dp_db.c b/src/modules/dialplan/dp_db.c
index 4275f02..3055d31 100644
index cc4ebeb..a3a9dac 100644
--- a/src/modules/dialplan/dp_db.c
+++ b/src/modules/dialplan/dp_db.c
@@ -300,8 +300,10 @@ int dp_load_db(void)
@@ -304,8 +304,10 @@ int dp_load_db(void)
values = ROW_VALUES(rows+i);
values = ROW_VALUES(rows + i);
- if((rule = build_rule(values)) ==0 )
- if((rule = build_rule(values)) == 0)
- goto err2;
+ if((rule = build_rule(values)) ==0 ) {
+ if((rule = build_rule(values)) == 0) {
+ LM_ERR("skip rule id:%d", VAL_INT(values));
+ continue;
+ }

@ -13,7 +13,7 @@ Subject: kamctl: TMPDIR config
5 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index b4e552e..b95f707 100755
index 7eea9be..1fff779 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -77,6 +77,10 @@ if [ -z "$STARTUP_CONFIG_FILE" ]; then
@ -99,7 +99,7 @@ index f7408b5..478864a 100644
trap "rm $path; clear; echo monitor ^C-ed; exit 1" 2
attempt=0
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 4f3f407..7c18523 100755
index 5a89a95..19a50c5 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -303,7 +303,7 @@ case $1 in

@ -3,13 +3,13 @@ Date: Fri, 10 Mar 2023 11:58:50 +0100
Subject: lcr: add stats per gw
---
src/modules/lcr/lcr_mod.c | 327 +++++++++++++++++++++++++++++++-
src/modules/lcr/lcr_mod.c | 323 +++++++++++++++++++++++++++++++++
src/modules/lcr/lcr_mod.h | 53 ++++++
src/modules/lcr/lcr_rpc.c | 460 +++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 833 insertions(+), 7 deletions(-)
src/modules/lcr/lcr_rpc.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 827 insertions(+)
diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 3d49365..1300ffb 100644
index 826f853..834612c 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -65,6 +65,7 @@
@ -40,7 +40,7 @@ index 3d49365..1300ffb 100644
/*
* Functions that are defined later
*/
@@ -271,6 +278,10 @@ static int to_gw_1(struct sip_msg *_m, char *_s1, char *_s2);
@@ -272,6 +279,10 @@ static int to_gw_1(struct sip_msg *_m, char *_s1, char *_s2);
static int to_gw_3(struct sip_msg *_m, char *_s1, char *_s2, char *_s3);
static int to_any_gw_0(struct sip_msg *_m, char *_s1, char *_s2);
static int to_any_gw_2(struct sip_msg *_m, char *_s1, char *_s2);
@ -51,7 +51,7 @@ index 3d49365..1300ffb 100644
/* clang-format off */
/*
@@ -361,6 +372,7 @@ static param_export_t params[] = {
@@ -362,6 +373,7 @@ static param_export_t params[] = {
{"ping_from", PARAM_STR, &ping_from_param},
{"ping_socket", PARAM_STR, &ping_socket_param},
{"stopper_mode", PARAM_INT, &stopper_mode_param},
@ -59,7 +59,7 @@ index 3d49365..1300ffb 100644
{0, 0, 0}
};
@@ -426,6 +438,180 @@ static void lcr_db_close(void)
@@ -427,6 +439,180 @@ static void lcr_db_close(void)
}
}
@ -240,7 +240,7 @@ index 3d49365..1300ffb 100644
/*
* Module initialization function that is called before the main process forks
@@ -438,6 +624,28 @@ static int mod_init(void)
@@ -439,6 +625,28 @@ static int mod_init(void)
unsigned int i;
char *at, *past, *sep;
@ -269,7 +269,7 @@ index 3d49365..1300ffb 100644
/* Register RPC commands */
if(rpc_register_array(lcr_rpc) != 0) {
LM_ERR("failed to register RPC commands\n");
@@ -1013,6 +1221,10 @@ static int insert_gw(struct gw_info *gws, unsigned int i, unsigned int gw_id,
@@ -1022,6 +1230,10 @@ static int insert_gw(struct gw_info *gws, unsigned int i, unsigned int gw_id,
append_str(at, transport, transport_len);
}
gws[i].uri_len = at - &(gws[i].uri[0]);
@ -280,7 +280,7 @@ index 3d49365..1300ffb 100644
LM_DBG("inserted gw <%u, %.*s, %.*s> at index %u\n", gw_id, gw_name_len,
gw_name, gws[i].uri_len, gws[i].uri, i);
return 1;
@@ -2281,6 +2493,65 @@ done:
@@ -2288,6 +2500,65 @@ done:
return j;
}
@ -346,18 +346,7 @@ index 3d49365..1300ffb 100644
/*
* Load info of matching GWs into gw_uri_avps
@@ -3279,8 +3550,8 @@ static int from_any_gw_0(struct sip_msg *_m, char *_s1, char *_s2)
* Checks if request comes from ip address of a gateway taking source
* IP address, transport protocol and source port from parameters.
*/
-static int ki_from_any_gw_addr_port(sip_msg_t *_m, str *addr_str, int transport,
- int src_port)
+static int ki_from_any_gw_addr_port(
+ sip_msg_t *_m, str *addr_str, int transport, int src_port)
{
unsigned int i;
struct ip_addr *ip, src_addr;
@@ -3713,3 +3984,55 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
@@ -3726,3 +3997,55 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
sr_kemi_modules_add(sr_kemi_lcr_exports);
return 0;
}
@ -492,24 +481,13 @@ index 193e216..e14ffd7 100644
#endif /* LCR_MOD_H */
diff --git a/src/modules/lcr/lcr_rpc.c b/src/modules/lcr/lcr_rpc.c
index 3a990c7..fb38912 100644
index 614d027..755fe58 100644
--- a/src/modules/lcr/lcr_rpc.c
+++ b/src/modules/lcr/lcr_rpc.c
@@ -99,11 +99,176 @@ static void dump_gw(rpc_t *rpc, void *st, struct gw_info *gw, unsigned int gw_in
prefix.len = gw->prefix_len;
tag.s = gw->tag;
tag.len = gw->tag_len;
- start = int2strbuf(
- gw->defunct_until, &(buf[0]), INT2STR_MAX_LEN, &len);
- rpc->struct_add(st, "dSSdds", "strip", gw->strip, "prefix",
- &prefix, "tag", &tag, "flags", gw->flags, "state",
- gw->state, "defunct_until", start);
+ start = int2strbuf(gw->defunct_until, &(buf[0]), INT2STR_MAX_LEN, &len);
+ rpc->struct_add(st, "dSSdds", "strip", gw->strip, "prefix", &prefix, "tag",
+ &tag, "flags", gw->flags, "state", gw->state, "defunct_until",
+ start);
+}
+
@@ -102,6 +102,172 @@ static void dump_gw(rpc_t *rpc, void *st, struct gw_info *gw,
start);
}
+static void print_gw_stat(rpc_t *rpc, void *st, struct gw_info *gw)
+{
+ str gw_name;
@ -674,10 +652,12 @@ index 3a990c7..fb38912 100644
+{
+ reset_gw_stats(gw);
+ print_gw_stat(rpc, st, gw);
}
+}
+
static void dump_gws(rpc_t *rpc, void *c)
@@ -302,6 +467,288 @@ static void load_gws(rpc_t *rpc, void *c)
{
void *st;
@@ -303,6 +469,288 @@ static void load_gws(rpc_t *rpc, void *c)
return;
}
@ -966,7 +946,7 @@ index 3a990c7..fb38912 100644
/* clang-format off */
rpc_export_t lcr_rpc[] = {
{"lcr.reload", reload, reload_doc, 0},
@@ -309,6 +756,9 @@ rpc_export_t lcr_rpc[] = {
@@ -310,6 +758,9 @@ rpc_export_t lcr_rpc[] = {
{"lcr.dump_rules", dump_rules, dump_rules_doc, 0},
{"lcr.defunct_gw", defunct_gw, defunct_gw_doc, 0},
{"lcr.load_gws", load_gws, load_gws_doc, 0},

@ -10,7 +10,7 @@ but will sort them first before stopping
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index be945fb..3d49365 100644
index 1d5a1ff..826f853 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -204,6 +204,10 @@ static unsigned int priority_ordering_param = 0;
@ -24,7 +24,7 @@ index be945fb..3d49365 100644
/*
* Other module types and variables
*/
@@ -356,6 +360,7 @@ static param_export_t params[] = {
@@ -357,6 +361,7 @@ static param_export_t params[] = {
{"ping_valid_reply_codes", PARAM_STR, &ping_valid_reply_codes_param},
{"ping_from", PARAM_STR, &ping_from_param},
{"ping_socket", PARAM_STR, &ping_socket_param},
@ -32,7 +32,7 @@ index be945fb..3d49365 100644
{0, 0, 0}
};
@@ -2226,6 +2231,8 @@ int load_gws_dummy(int lcr_id, str *ruri_user, str *from_uri, str *request_uri,
@@ -2233,6 +2238,8 @@ int load_gws_dummy(int lcr_id, str *ruri_user, str *from_uri, str *request_uri,
matched_gws[gw_index].priority = t->priority;
matched_gws[gw_index].weight = t->weight * (kam_rand() >> 8);
matched_gws[gw_index].duplicate = 0;
@ -41,7 +41,7 @@ index be945fb..3d49365 100644
LM_DBG("added matched_gws[%d]=[%u, %u, %u, %u]\n", gw_index,
t->gw_index, pl->prefix_len, t->priority,
matched_gws[gw_index].weight);
@@ -2233,8 +2240,10 @@ int load_gws_dummy(int lcr_id, str *ruri_user, str *from_uri, str *request_uri,
@@ -2240,8 +2247,10 @@ int load_gws_dummy(int lcr_id, str *ruri_user, str *from_uri, str *request_uri,
skip_gw:
t = t->next;
}
@ -53,7 +53,7 @@ index be945fb..3d49365 100644
next:
rule = rule->next;
@@ -2261,6 +2270,11 @@ done:
@@ -2268,6 +2277,11 @@ done:
if(matched_gws[i].duplicate == 1)
continue;
gw_indexes[j] = matched_gws[i].gw_index;
@ -65,7 +65,7 @@ index be945fb..3d49365 100644
j++;
}
@@ -2276,7 +2290,7 @@ static int ki_load_gws_furi(
@@ -2283,7 +2297,7 @@ static int ki_load_gws_furi(
{
str *request_uri;
int i, j;
@ -74,7 +74,7 @@ index be945fb..3d49365 100644
int_str val;
struct matched_gw_info matched_gws[MAX_NO_OF_GWS + 1];
struct rule_info **rules, *rule, *pl;
@@ -2396,6 +2410,8 @@ static int ki_load_gws_furi(
@@ -2403,6 +2417,8 @@ static int ki_load_gws_furi(
matched_gws[gw_index].priority = t->priority;
matched_gws[gw_index].weight = t->weight * (kam_rand() >> 8);
matched_gws[gw_index].duplicate = 0;
@ -83,7 +83,7 @@ index be945fb..3d49365 100644
LM_DBG("added matched_gws[%d]=[%u, %u, %u, %u]\n", gw_index,
t->gw_index, pl->prefix_len, t->priority,
matched_gws[gw_index].weight);
@@ -2404,8 +2420,10 @@ static int ki_load_gws_furi(
@@ -2411,8 +2427,10 @@ static int ki_load_gws_furi(
t = t->next;
}
/* Do not look further if this matching rule was stopper */
@ -95,7 +95,7 @@ index be945fb..3d49365 100644
next:
rule = rule->next;
@@ -2430,6 +2448,24 @@ done:
@@ -2437,6 +2455,24 @@ done:
}
}

@ -3,18 +3,18 @@ Date: Thu, 2 Nov 2023 11:45:00 +0100
Subject: lcr_read_id
---
src/modules/lcr/lcr_mod.c | 57 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 49 insertions(+), 8 deletions(-)
src/modules/lcr/lcr_mod.c | 93 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 73 insertions(+), 20 deletions(-)
diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 1300ffb..a1b8bae 100644
index 834612c..3f4cb86 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -172,6 +172,7 @@ static char *gw_uri_avp_param = NULL;
static char *ruri_user_avp_param = NULL;
static char *tag_avp_param = NULL;
static char *flags_avp_param = NULL;
+static char* gw_id_avp_param = NULL;
+static char *gw_id_avp_param = NULL;
static char *rule_id_avp_param = NULL;
static char *defunct_gw_avp_param = NULL;
static char *lcr_id_avp_param = NULL;
@ -27,7 +27,7 @@ index 1300ffb..a1b8bae 100644
static int rule_id_avp_type;
static int_str rule_id_avp;
static int defunct_gw_avp_type;
@@ -354,6 +357,7 @@ static param_export_t params[] = {
@@ -355,6 +358,7 @@ static param_export_t params[] = {
{"ruri_user_avp", PARAM_STRING, &ruri_user_avp_param},
{"tag_avp", PARAM_STRING, &tag_avp_param},
{"flags_avp", PARAM_STRING, &flags_avp_param},
@ -35,7 +35,7 @@ index 1300ffb..a1b8bae 100644
{"rule_id_avp", PARAM_STRING, &rule_id_avp_param},
{"defunct_capability", INT_PARAM, &defunct_capability_param},
{"defunct_gw_avp", PARAM_STRING, &defunct_gw_avp_param},
@@ -759,6 +763,21 @@ static int mod_init(void)
@@ -760,6 +764,21 @@ static int mod_init(void)
flags_avp_type = avp_flags;
}
@ -57,7 +57,7 @@ index 1300ffb..a1b8bae 100644
if(rule_id_avp_param) {
s.s = rule_id_avp_param;
s.len = strlen(s.s);
@@ -2091,7 +2110,7 @@ static inline int encode_avp_value(char *value, unsigned int gw_index,
@@ -2098,7 +2117,7 @@ static inline int encode_avp_value(char *value, unsigned int gw_index,
struct ip_addr *ip_addr, char *hostname, unsigned int hostname_len,
unsigned int port, char *params, unsigned int params_len,
char *transport, unsigned int transport_len, unsigned int flags,
@ -66,7 +66,7 @@ index 1300ffb..a1b8bae 100644
{
char *at, *string;
int len;
@@ -2147,13 +2166,17 @@ static inline int encode_avp_value(char *value, unsigned int gw_index,
@@ -2154,13 +2173,18 @@ static inline int encode_avp_value(char *value, unsigned int gw_index,
/* rule id */
string = int2str(rule_id, &len);
append_str(at, string, len);
@ -81,11 +81,12 @@ index 1300ffb..a1b8bae 100644
str *scheme, unsigned int *strip, str *prefix, str *tag,
struct ip_addr *addr, str *hostname, str *port, str *params,
- str *transport, unsigned int *flags, unsigned int *rule_id)
+ str *transport, unsigned int *flags, unsigned int *rule_id, unsigned int *gw_id)
+ str *transport, unsigned int *flags, unsigned int *rule_id,
+ unsigned int *gw_id)
{
unsigned int u = 0;
str s;
@@ -2269,6 +2292,12 @@ static inline int decode_avp_value(char *value, unsigned int *gw_index,
@@ -2276,6 +2300,12 @@ static inline int decode_avp_value(char *value, unsigned int *gw_index,
s.s = sep + 1;
s.len = strlen(s.s);
str2int(&s, rule_id);
@ -98,16 +99,83 @@ index 1300ffb..a1b8bae 100644
return 1;
}
@@ -2319,7 +2348,7 @@ void add_gws_into_avps(struct gw_info *gws, struct matched_gw_info *matched_gws,
@@ -2326,7 +2356,8 @@ void add_gws_into_avps(struct gw_info *gws, struct matched_gw_info *matched_gws,
gws[index].tag, tag_len, &gws[index].ip_addr,
gws[index].hostname, hostname_len, gws[index].port,
gws[index].params, params_len, gws[index].transport,
- gws[index].transport_len, gws[index].flags, rule_id);
+ gws[index].transport_len, gws[index].flags, rule_id, gws[index].gw_id);
+ gws[index].transport_len, gws[index].flags, rule_id,
+ gws[index].gw_id);
value.s = (char *)&(encoded_value[0]);
val.s = value;
add_avp(gw_uri_avp_type | AVP_VAL_STR, gw_uri_avp, val);
@@ -2831,7 +2860,7 @@ static int load_gws(struct sip_msg *_m, int argc, action_u_t argv[])
@@ -2489,9 +2520,9 @@ done:
if(matched_gws[i].duplicate == 1)
continue;
gw_indexes[j] = matched_gws[i].gw_index;
- if(stopper_mode_param != 0 && matched_gws[i].stopper == 1){
+ if(stopper_mode_param != 0 && matched_gws[i].stopper == 1) {
LM_DBG("lcr_rule[%d] has stopper, skip the rest\n",
- matched_gws[i].rule_id);
+ matched_gws[i].rule_id);
i = -1;
}
j++;
@@ -2523,28 +2554,36 @@ void reset_gw_stats(struct gw_info *gw)
gw->rcv_gw_rpl = 0;
gw->rcv_gw_rpl_invite = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_invite_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_invite_by_method[i] = 0;
gw->rcv_gw_rpl_cancel = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_cancel_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_cancel_by_method[i] = 0;
gw->rcv_gw_rpl_bye = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_bye_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_bye_by_method[i] = 0;
gw->rcv_gw_rpl_register = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_register_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_register_by_method[i] = 0;
gw->rcv_gw_rpl_message = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_message_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_message_by_method[i] = 0;
gw->rcv_gw_rpl_prack = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_prack_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_prack_by_method[i] = 0;
gw->rcv_gw_rpl_update = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_update_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_update_by_method[i] = 0;
gw->rcv_gw_rpl_refer = 0;
- for (i = 0; i < 6; i++) gw->rcv_gw_rpl_refer_by_method[i] = 0;
+ for(i = 0; i < 6; i++)
+ gw->rcv_gw_rpl_refer_by_method[i] = 0;
gw->rcv_gw_rpls_1xx = 0;
gw->rcv_gw_rpls_18x = 0;
@@ -2739,7 +2778,7 @@ done:
} else if(matched_gws[i].stopper == 1) {
stopper_flag = 1;
LM_DBG("lcr_rule[%d] has stopper, skip the rest\n",
- matched_gws[i].rule_id);
+ matched_gws[i].rule_id);
}
}
}
@@ -2838,7 +2877,7 @@ static int load_gws(struct sip_msg *_m, int argc, action_u_t argv[])
static int generate_uris(struct sip_msg *_m, char *r_uri, str *r_uri_user,
unsigned int *r_uri_len, char *dst_uri, unsigned int *dst_uri_len,
struct ip_addr *addr, unsigned int *gw_index, unsigned int *flags,
@ -116,16 +184,16 @@ index 1300ffb..a1b8bae 100644
{
int_str gw_uri_val;
struct usr_avp *gu_avp;
@@ -2856,7 +2885,7 @@ static int generate_uris(struct sip_msg *_m, char *r_uri, str *r_uri_user,
return 0; /* No more gateways left */
@@ -2864,7 +2903,7 @@ static int generate_uris(struct sip_msg *_m, char *r_uri, str *r_uri_user,
decode_avp_value(gw_uri_val.s.s, gw_index, &scheme, &strip, &prefix,
- &tmp_tag, addr, &hostname, &port, &params, &transport, flags, rule_id);
+ &tmp_tag, addr, &hostname, &port, &params, &transport, flags, rule_id, gw_id);
&tmp_tag, addr, &hostname, &port, &params, &transport, flags,
- rule_id);
+ rule_id, gw_id);
if(addr->af != 0) {
addr_str.s = ip_addr2a(addr);
@@ -3214,7 +3243,7 @@ static int ki_next_gw(sip_msg_t *_m)
@@ -3222,7 +3261,7 @@ static int ki_next_gw(sip_msg_t *_m)
int rval;
str uri_str, tag_str;
char tag[MAX_TAG_LEN];
@ -134,25 +202,27 @@ index 1300ffb..a1b8bae 100644
char r_uri[MAX_URI_LEN], dst_uri[MAX_URI_LEN];
struct ip_addr addr;
@@ -3236,7 +3265,7 @@ static int ki_next_gw(sip_msg_t *_m)
@@ -3244,7 +3283,8 @@ static int ki_next_gw(sip_msg_t *_m)
return -1;
}
if(generate_uris(_m, r_uri, &(_m->parsed_uri.user), &r_uri_len, dst_uri,
- &dst_uri_len, &addr, &gw_index, &flags, &tag_str, &rule_id)
+ &dst_uri_len, &addr, &gw_index, &flags, &tag_str, &rule_id, &gw_id)
+ &dst_uri_len, &addr, &gw_index, &flags, &tag_str, &rule_id,
+ &gw_id)
<= 0) {
return -1;
}
@@ -3255,7 +3284,7 @@ static int ki_next_gw(sip_msg_t *_m)
@@ -3263,7 +3303,8 @@ static int ki_next_gw(sip_msg_t *_m)
* and Destination URIs. */
if(generate_uris(_m, r_uri, &(ruri_user_val.s), &r_uri_len, dst_uri,
- &dst_uri_len, &addr, &gw_index, &flags, &tag_str, &rule_id)
+ &dst_uri_len, &addr, &gw_index, &flags, &tag_str, &rule_id, &gw_id)
+ &dst_uri_len, &addr, &gw_index, &flags, &tag_str, &rule_id,
+ &gw_id)
<= 0) {
return -1;
}
@@ -3288,6 +3317,13 @@ static int ki_next_gw(sip_msg_t *_m)
@@ -3296,6 +3337,13 @@ static int ki_next_gw(sip_msg_t *_m)
LM_DBG("added flags_avp <%u>\n", (unsigned int)val.n);
}
@ -166,7 +236,7 @@ index 1300ffb..a1b8bae 100644
/* Set tag_avp */
if(tag_avp_param) {
val.s = tag_str;
@@ -3363,6 +3399,11 @@ static int do_from_gw(struct sip_msg *_m, unsigned int lcr_id,
@@ -3374,6 +3422,11 @@ static int do_from_gw(struct sip_msg *_m, unsigned int lcr_id,
add_avp(flags_avp_type, flags_avp, val);
LM_DBG("added flags_avp <%u>\n", (unsigned int)val.n);
}
@ -178,3 +248,10 @@ index 1300ffb..a1b8bae 100644
return 1;
} else {
LM_DBG("request did not come from gw\n");
@@ -4048,4 +4101,4 @@ static struct gw_info *ki_lcr_check_sip_msg_against_gwlist(sip_msg_t *_m)
}
}
return NULL;
-}
\ No newline at end of file
+}

@ -1,90 +0,0 @@
From: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Tue, 17 Oct 2023 14:12:57 +0200
Subject: presence: active_watcher cleanup timer
---
src/modules/presence/notify.c | 33 +++++++++++++++++++++++++++++++++
src/modules/presence/notify.h | 1 +
src/modules/presence/presence.c | 5 +++++
3 files changed, 39 insertions(+)
diff --git a/src/modules/presence/notify.c b/src/modules/presence/notify.c
index b10e069..358775e 100644
--- a/src/modules/presence/notify.c
+++ b/src/modules/presence/notify.c
@@ -3194,3 +3194,36 @@ void pres_timer_send_notify(unsigned int ticks, void *param)
return;
}
}
+
+void ps_active_watchers_db_timer_clean(unsigned int ticks, void *param)
+{
+ db_key_t db_keys[2];
+ db_val_t db_vals[2];
+ db_op_t db_ops[2];
+
+ if(pa_db == NULL) {
+ return;
+ }
+
+ LM_DBG("cleaning expired subscriptions\n");
+
+ db_keys[0] = &str_expires_col;
+ db_ops[0] = OP_LT;
+ db_vals[0].type = DB1_INT;
+ db_vals[0].nul = 0;
+ db_vals[0].val.int_val = (int)time(NULL);
+
+ db_keys[1] = &str_expires_col;
+ db_ops[1] = OP_GT;
+ db_vals[1].type = DB1_INT;
+ db_vals[1].nul = 0;
+ db_vals[1].val.int_val = 0;
+
+ if(pa_dbf.use_table(pa_db, &active_watchers_table) < 0) {
+ LM_ERR("unsuccessful use table sql operation\n");
+ return;
+ }
+
+ if(pa_dbf.delete(pa_db, db_keys, db_ops, db_vals, 2) < 0)
+ LM_ERR("cleaning expired subscriptions\n");
+}
diff --git a/src/modules/presence/notify.h b/src/modules/presence/notify.h
index 4bac84b..3d875f3 100644
--- a/src/modules/presence/notify.h
+++ b/src/modules/presence/notify.h
@@ -129,4 +129,5 @@ char *get_status_str(int flag);
str *get_p_notify_body(str pres_uri, pres_ev_t *event, str *etag, str *contact);
void free_notify_body(str *body, pres_ev_t *ev);
void pres_timer_send_notify(unsigned int ticks, void *param);
+void ps_active_watchers_db_timer_clean(unsigned int ticks, void *param);
#endif
diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index 06b73df..a3a786f 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -452,12 +452,16 @@ static int mod_init(void)
if(pres_timer_mode==0) {
register_timer(ps_presentity_db_timer_clean, 0, pres_clean_period);
register_timer(ps_watchers_db_timer_clean, 0, pres_clean_period);
+ register_timer(
+ ps_active_watchers_db_timer_clean, 0, pres_clean_period);
if(publ_cache_mode==PS_PCACHE_RECORD) {
register_timer(ps_ptable_timer_clean, 0, pres_clean_period);
}
} else {
sr_wtimer_add(ps_presentity_db_timer_clean, 0, pres_clean_period);
sr_wtimer_add(ps_watchers_db_timer_clean, 0, pres_clean_period);
+ sr_wtimer_add(
+ ps_active_watchers_db_timer_clean, 0, pres_clean_period);
if(publ_cache_mode==PS_PCACHE_RECORD) {
sr_wtimer_add(ps_ptable_timer_clean, 0, pres_clean_period);
}
@@ -1845,6 +1849,7 @@ void rpc_presence_cleanup(rpc_t *rpc, void *c)
(void)ps_watchers_db_timer_clean(0, 0);
(void)ps_presentity_db_timer_clean(0, 0);
+ (void)ps_active_watchers_db_timer_clean(0, 0);
(void)ps_ptable_timer_clean(0, 0);
(void)timer_db_update(0, 0);

@ -6,11 +6,11 @@ Subject: pua_dialoginfo: fix dlg_var store and retrieval
* store values as comma separate strings
* alloc string values always for str_list
---
src/modules/pua_dialoginfo/pua_dialoginfo.c | 183 +++++++++++++++++++---------
1 file changed, 123 insertions(+), 60 deletions(-)
src/modules/pua_dialoginfo/pua_dialoginfo.c | 203 +++++++++++++++++++---------
1 file changed, 137 insertions(+), 66 deletions(-)
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index 4fe5212..dab4755 100644
index 6efcdc0..089586d 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -83,6 +83,7 @@ unsigned short pubruri_callee_avp_type;
@ -18,18 +18,18 @@ index 4fe5212..dab4755 100644
sruid_t _puadi_sruid;
+static char *DLG_VAR_SEP = ",";
static str caller_dlg_var = {0, 0}; /* pubruri_caller */
static str callee_dlg_var = {0, 0}; /* pubruri_callee */
static str caller_dlg_var = {0, 0}; /* pubruri_caller */
static str callee_dlg_var = {0, 0}; /* pubruri_callee */
static str caller_entity_when_publish_disabled = {0, 0}; /* pubruri_caller */
@@ -533,7 +534,6 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
struct str_list* get_str_list(unsigned short avp_flags, int_str avp_name) {
@@ -596,7 +597,6 @@ struct str_list *get_str_list(unsigned short avp_flags, int_str avp_name)
{
int_str avp_value;
- unsigned int len;
struct str_list* list_first = 0;
struct str_list* list_current = 0 ;
struct str_list *list_first = 0;
struct str_list *list_current = 0;
struct search_state st;
@@ -543,42 +543,121 @@ struct str_list* get_str_list(unsigned short avp_flags, int_str avp_name) {
@@ -606,33 +606,122 @@ struct str_list *get_str_list(unsigned short avp_flags, int_str avp_name)
}
do {
@ -39,22 +39,24 @@ index 4fe5212..dab4755 100644
- len = sizeof(struct str_list) + avp_value.s.len;
-
if(list_current) {
- list_current->next = (struct str_list*) shm_malloc( len);
+ list_current->next = (struct str_list*) shm_malloc(sizeof(struct str_list));
list_current=list_current->next;
- list_current->next = (struct str_list *)shm_malloc(len);
+ list_current->next =
+ (struct str_list *)shm_malloc(sizeof(struct str_list));
list_current = list_current->next;
} else {
- list_current=list_first= (struct str_list*) shm_malloc( len);
+ list_current=list_first= (struct str_list*) shm_malloc(sizeof(struct str_list));
- list_current = list_first = (struct str_list *)shm_malloc(len);
+ list_current = list_first =
+ (struct str_list *)shm_malloc(sizeof(struct str_list));
}
-
- if (list_current==0) {
+ if (!list_current) {
- if(list_current == 0) {
+ if(!list_current) {
SHM_MEM_ERROR;
- return 0;
+ free_str_list_all(list_first);
+ return NULL;
+ }
+ memset( list_current, 0, sizeof(struct str_list));
+ memset(list_current, 0, sizeof(struct str_list));
+ list_current->s.s = shm_str2char_dup(&avp_value.s);
+ if(!list_current->s.s) {
+ free_str_list_all(list_first);
@ -63,13 +65,13 @@ index 4fe5212..dab4755 100644
+ list_current->s.len = avp_value.s.len;
+ } while(search_next_avp(&st, &avp_value));
- memset( list_current, 0, len);
- memset(list_current, 0, len);
+ return list_first;
+}
- list_current->s.s = (char*)list_current + sizeof(struct str_list);
- list_current->s.s = (char *)list_current + sizeof(struct str_list);
- list_current->s.len = avp_value.s.len;
- memcpy(list_current->s.s,avp_value.s.s,avp_value.s.len);
- memcpy(list_current->s.s, avp_value.s.s, avp_value.s.len);
+/**
+ * @brief set dlg_var value from str_list as comma separated values
+ *
@ -85,13 +87,15 @@ index 4fe5212..dab4755 100644
+ int num = -1;
+ int res;
+ if(!lst) return -1;
+ if(!lst)
+ return -1;
- } while(search_next_avp(&st, &avp_value));
+ while(it) {
+ buf.len += it->s.len + ++num;
+ it = it->next;
+ }
+ buf.s = (char*) pkg_malloc( sizeof(char) * buf.len);
+ buf.s = (char *)pkg_malloc(sizeof(char) * buf.len);
+
+ it = lst;
+ num = 0;
@ -106,19 +110,19 @@ index 4fe5212..dab4755 100644
+ res = dlg_api.set_dlg_var(dlg, key, &buf);
+ pkg_free(buf.s);
- } while(search_next_avp(&st, &avp_value));
- return list_first;
+ return res;
+}
- return list_first;
+
+static int get_dlg_var(struct dlg_cell *dlg, str *key, struct str_list **lst)
+{
+ str dval = STR_NULL;
+ str val = STR_NULL;
+ struct str_list *it, *prev;
+ char *sep, *ini, *end;
+ if (dlg_api.get_dlg_varval(dlg, &caller_dlg_var, &dval)!=0 || dval.s == NULL)
+
+ if(dlg_api.get_dlg_varval(dlg, &caller_dlg_var, &dval) != 0
+ || dval.s == NULL)
+ return 0;
+
+ if(*lst) {
@ -128,13 +132,14 @@ index 4fe5212..dab4755 100644
+ ini = dval.s;
+ end = dval.s + dval.len - 1;
+ sep = stre_search_strz(ini, end, DLG_VAR_SEP);
+ if(!sep) sep = end;
+ if(!sep)
+ sep = end;
+ do {
+ val.s = ini;
+ val.len = sep - ini + 1;
+ ini = sep + 1;
+ it = (struct str_list*)shm_malloc(sizeof(struct str_list));
+ if (!it) {
+ it = (struct str_list *)shm_malloc(sizeof(struct str_list));
+ if(!it) {
+ SHM_MEM_ERROR;
+ return -1;
+ }
@ -145,21 +150,24 @@ index 4fe5212..dab4755 100644
+ return -1;
+ }
+ it->s.len = val.len;
+ LM_DBG("Found uri '%.*s' in dlg_var:'%.*s'\n",
+ val.len, val.s, key->len, key->s);
+ LM_DBG("Found uri '%.*s' in dlg_var:'%.*s'\n", val.len, val.s, key->len,
+ key->s);
+ if(!*lst) {
+ *lst = prev = it;
+ } else {
+ prev->next = it;
+ }
+ if(ini < end) sep = stre_search_strz(ini, end, DLG_VAR_SEP);
+ else sep = NULL;
+ if(ini < end)
+ sep = stre_search_strz(ini, end, DLG_VAR_SEP);
+ else
+ sep = NULL;
+ } while(sep);
+
+ return 0;
}
struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable_caller_publish, int disable_callee_publish)
struct dlginfo_cell *get_dialog_data(struct dlg_cell *dlg, int type,
@@ -640,7 +729,6 @@ struct dlginfo_cell *get_dialog_data(struct dlg_cell *dlg, int type,
{
struct dlginfo_cell *dlginfo;
int len;
@ -167,81 +175,91 @@ index 4fe5212..dab4755 100644
// generate new random uuid
if(sruid_next_safe(&_puadi_sruid) < 0) {
@@ -644,53 +723,31 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
dlginfo->pubruris_callee = get_str_list(pubruri_callee_avp_type,
pubruri_callee_avp_name);
@@ -701,59 +789,35 @@ struct dlginfo_cell *get_dialog_data(struct dlg_cell *dlg, int type,
dlginfo->pubruris_callee = get_str_list(
pubruri_callee_avp_type, pubruri_callee_avp_name);
- if(dlginfo->pubruris_callee!=NULL && callee_dlg_var.len>0)
- dlg_api.set_dlg_var(dlg, &callee_dlg_var,
- &dlginfo->pubruris_callee->s);
- if(dlginfo->pubruris_callee != NULL && callee_dlg_var.len > 0)
- dlg_api.set_dlg_var(
- dlg, &callee_dlg_var, &dlginfo->pubruris_callee->s);
-
- if(dlginfo->pubruris_caller!=NULL && caller_dlg_var.len>0)
- dlg_api.set_dlg_var(dlg, &caller_dlg_var,
- &dlginfo->pubruris_caller->s);
- if(dlginfo->pubruris_caller != NULL && caller_dlg_var.len > 0)
- dlg_api.set_dlg_var(
- dlg, &caller_dlg_var, &dlginfo->pubruris_caller->s);
-
+ if(dlginfo->pubruris_callee!=NULL && callee_dlg_var.len>0) {
+ if(set_dlg_var(dlg, &callee_dlg_var, dlginfo->pubruris_callee) < 0) {
+ if(dlginfo->pubruris_callee != NULL && callee_dlg_var.len > 0) {
+ if(set_dlg_var(dlg, &callee_dlg_var, dlginfo->pubruris_callee)
+ < 0) {
+ free_str_list_all(dlginfo->pubruris_callee);
+ dlginfo->pubruris_callee = NULL;
+ }
+ }
+ if(dlginfo->pubruris_caller!=NULL && caller_dlg_var.len>0) {
+ if(set_dlg_var(dlg, &caller_dlg_var, dlginfo->pubruris_caller) < 0) {
+ if(dlginfo->pubruris_caller != NULL && caller_dlg_var.len > 0) {
+ if(set_dlg_var(dlg, &caller_dlg_var, dlginfo->pubruris_caller)
+ < 0) {
+ free_str_list_all(dlginfo->pubruris_caller);
+ dlginfo->pubruris_caller = NULL;
+ }
+ }
} else {
- if(caller_dlg_var.len>0
- && (dlg_api.get_dlg_varval(dlg, &caller_dlg_var, &dval)==0)
- && dval.s!=NULL) {
- dlginfo->pubruris_caller =
- (struct str_list*)shm_malloc(sizeof(struct str_list) + dval.len + 1);
- if (dlginfo->pubruris_caller==0) {
- if(caller_dlg_var.len > 0
- && (dlg_api.get_dlg_varval(dlg, &caller_dlg_var, &dval)
- == 0)
- && dval.s != NULL) {
- dlginfo->pubruris_caller = (struct str_list *)shm_malloc(
- sizeof(struct str_list) + dval.len + 1);
- if(dlginfo->pubruris_caller == 0) {
- SHM_MEM_ERROR;
+ if(caller_dlg_var.len>0) {
+ if(get_dlg_var(dlg, &caller_dlg_var, &dlginfo->pubruris_caller) <0) {
+ if(caller_dlg_var.len > 0) {
+ if(get_dlg_var(dlg, &caller_dlg_var, &dlginfo->pubruris_caller)
+ < 0) {
free_dlginfo_cell(dlginfo);
return NULL;
}
- memset(dlginfo->pubruris_caller, 0, sizeof(struct str_list));
- dlginfo->pubruris_caller->s.s = (char*)dlginfo->pubruris_caller
- + sizeof(sizeof(struct str_list));
- dlginfo->pubruris_caller->s.s =
- (char *)dlginfo->pubruris_caller
- + sizeof(sizeof(struct str_list));
- memcpy(dlginfo->pubruris_caller->s.s, dval.s, dval.len);
- dlginfo->pubruris_caller->s.s[dval.len] = '\0';
- dlginfo->pubruris_caller->s.len = dval.len;
- LM_DBG("Found pubruris_caller in dialog '%.*s'\n",
- dlginfo->pubruris_caller->s.len, dlginfo->pubruris_caller->s.s);
- dlginfo->pubruris_caller->s.len,
- dlginfo->pubruris_caller->s.s);
}
- if(callee_dlg_var.len>0
- && (dlg_api.get_dlg_varval(dlg, &callee_dlg_var, &dval)==0)
- && dval.s!=NULL) {
- dlginfo->pubruris_callee =
- (struct str_list*)shm_malloc(sizeof(struct str_list) + dval.len + 1);
- if (dlginfo->pubruris_callee==0) {
- if(callee_dlg_var.len > 0
- && (dlg_api.get_dlg_varval(dlg, &callee_dlg_var, &dval)
- == 0)
- && dval.s != NULL) {
- dlginfo->pubruris_callee = (struct str_list *)shm_malloc(
- sizeof(struct str_list) + dval.len + 1);
- if(dlginfo->pubruris_callee == 0) {
- SHM_MEM_ERROR;
+ if(callee_dlg_var.len>0) {
+ if(get_dlg_var(dlg, &callee_dlg_var, &dlginfo->pubruris_callee) <0) {
+ if(callee_dlg_var.len > 0) {
+ if(get_dlg_var(dlg, &callee_dlg_var, &dlginfo->pubruris_callee)
+ < 0) {
free_dlginfo_cell(dlginfo);
return NULL;
}
- memset(dlginfo->pubruris_callee, 0, sizeof(struct str_list));
- dlginfo->pubruris_callee->s.s = (char*)dlginfo->pubruris_callee
- + sizeof(sizeof(struct str_list));
- dlginfo->pubruris_callee->s.s =
- (char *)dlginfo->pubruris_callee
- + sizeof(sizeof(struct str_list));
- memcpy(dlginfo->pubruris_callee->s.s, dval.s, dval.len);
- dlginfo->pubruris_callee->s.s[dval.len] = '\0';
- dlginfo->pubruris_callee->s.len = dval.len;
- LM_DBG("Found pubruris_callee in dialog '%.*s'\n",
- dlginfo->pubruris_callee->s.len, dlginfo->pubruris_callee->s.s);
- dlginfo->pubruris_callee->s.len,
- dlginfo->pubruris_callee->s.s);
}
}
@@ -709,7 +766,12 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
@@ -772,7 +836,12 @@ struct dlginfo_cell *get_dialog_data(struct dlg_cell *dlg, int type,
return NULL;
}
memset( dlginfo->pubruris_caller, 0, sizeof(struct str_list));
- dlginfo->pubruris_caller->s=dlginfo->from_uri;
memset(dlginfo->pubruris_caller, 0, sizeof(struct str_list));
- dlginfo->pubruris_caller->s = dlginfo->from_uri;
+ dlginfo->pubruris_caller->s.s = shm_str2char_dup(&dlginfo->from_uri);
+ if(!dlginfo->pubruris_caller->s.s) {
+ free_dlginfo_cell(dlginfo);
@ -250,9 +268,9 @@ index 4fe5212..dab4755 100644
+ dlginfo->pubruris_caller->s.len = dlginfo->from_uri.len;
dlginfo->pubruris_callee =
(struct str_list*)shm_malloc( sizeof(struct str_list) );
@@ -721,9 +783,11 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
memset( dlginfo->pubruris_callee, 0, sizeof(struct str_list));
(struct str_list *)shm_malloc(sizeof(struct str_list));
@@ -784,9 +853,11 @@ struct dlginfo_cell *get_dialog_data(struct dlg_cell *dlg, int type,
memset(dlginfo->pubruris_callee, 0, sizeof(struct str_list));
if(include_req_uri) {
- dlginfo->pubruris_callee->s = dlginfo->req_uri;
@ -265,15 +283,16 @@ index 4fe5212..dab4755 100644
}
}
@@ -1009,10 +1073,9 @@ void free_str_list_all(struct str_list * del_current) {
struct str_list* del_next;
@@ -1105,10 +1176,10 @@ void free_str_list_all(struct str_list *del_current)
struct str_list *del_next;
while(del_current) {
-
del_next = del_current->next;
+ if(del_current->s.s) shm_free(del_current->s.s);
+ if(del_current->s.s)
+ shm_free(del_current->s.s);
shm_free(del_current);
-
del_current=del_next;
del_current = del_next;
}
}

@ -1,22 +0,0 @@
From: Victor Seva <vseva@sipwise.com>
Date: Mon, 23 Oct 2023 14:36:49 +0200
Subject: pv_headers: pvh_xavi_get_child() fix fallback logic
* don't fallback to Initial request headers for Replies
---
src/modules/pv_headers/pvh_xavp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c
index 3bc32d2..bb5f950 100644
--- a/src/modules/pv_headers/pvh_xavp.c
+++ b/src/modules/pv_headers/pvh_xavp.c
@@ -284,7 +284,7 @@ sr_xavp_t *pvh_xavi_get_child(struct sip_msg *msg, str *xname, str *name)
pvh_get_branch_xname(msg, xname, &br_xname);
xavi = xavi_get_child(&br_xname, name);
- if(xavi == NULL) {
+ if(xavi == NULL && msg->first_line.type == SIP_REQUEST) {
if(cmp_str(xname, &br_xname) != 0) {
xavi = xavi_get_child(xname, name);
if(xavi) {

@ -5,19 +5,19 @@ Subject: pv_headers: rework pvh_remove_header_param, take two
* pvh_set_xavi changes/removes xavi, so we need the new value
* after pvh_remove_header, search for the header again
---
src/modules/pv_headers/pv_headers.c | 18 ++++++++++++++----
src/modules/pv_headers/pv_headers.c | 22 ++++++++++++++++------
src/modules/pv_headers/pvh_func.c | 12 ++++++++----
src/modules/pv_headers/pvh_xavp.c | 34 +++++++++++++++-------------------
src/modules/pv_headers/pvh_xavp.h | 2 +-
4 files changed, 38 insertions(+), 28 deletions(-)
4 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
index 7561b08..3e9e5a6 100644
index a833b96..fdb6f2e 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -223,12 +223,15 @@ static int w_pvh_header_param_exists(
static int ki_pvh_remove_header_param(struct sip_msg *msg, str *hname, str *toRemove)
@@ -224,12 +224,15 @@ static int w_pvh_header_param_exists(struct sip_msg *msg, char *p1, char *p2)
static int ki_pvh_remove_header_param(
struct sip_msg *msg, str *hname, str *toRemove)
{
- int idx;
+ int next;
@ -26,33 +26,37 @@ index 7561b08..3e9e5a6 100644
str dst = STR_NULL;
sr_xavp_t *avi = pvh_xavi_get_child(msg, &xavi_name, hname);
- for(idx=0; avi != NULL; avi = xavi_get_next(avi)) {
- for(idx = 0; avi != NULL; avi = xavi_get_next(avi)) {
+ while(avi) {
+ next = 1;
+ LM_DBG("hname:%.*s[%d]\n", STR_FMT(hname), idx);
if (avi->val.type == SR_XTYPE_STR && avi->val.v.s.s != NULL) {
if(avi->val.type == SR_XTYPE_STR && avi->val.v.s.s != NULL) {
if(str_casesearch(&avi->val.v.s, toRemove) != NULL) {
new_size = pvh_remove_header_param_helper(&avi->val.v.s, toRemove, &dst);
@@ -237,13 +240,17 @@ static int ki_pvh_remove_header_param(struct sip_msg *msg, str *hname, str *toRe
new_size = pvh_remove_header_param_helper(
@@ -239,15 +242,19 @@ static int ki_pvh_remove_header_param(
STR_FMT(hname), idx);
if(pvh_remove_header(msg, hname, idx) < 0)
return -1;
+ avi = pvh_xavi_get_child(msg, &xavi_name, hname);
+ if(idx > 0) idx = 0;
+ if(idx > 0)
+ idx = 0;
+ next = 0;
} else if(dst.len < 0 || new_size == avi->val.v.s.len) {
LM_DBG("'%.*s' not found at '%.*s'\n", STR_FMT(toRemove),
STR_FMT(&avi->val.v.s));
STR_FMT(&avi->val.v.s));
} else {
LM_DBG("old_value:'%.*s' new_value:'%.*s'\n",
STR_FMT(&avi->val.v.s), STR_FMT(&dst));
- if(pvh_set_xavi(msg, &xavi_name, hname, &dst, SR_XTYPE_STR, idx, 0) < 0) {
+ avi = pvh_set_xavi(msg, &xavi_name, hname, &dst, SR_XTYPE_STR, idx, 0);
STR_FMT(&avi->val.v.s), STR_FMT(&dst));
- if(pvh_set_xavi(msg, &xavi_name, hname, &dst, SR_XTYPE_STR,
- idx, 0)
- < 0) {
+ avi = pvh_set_xavi(
+ msg, &xavi_name, hname, &dst, SR_XTYPE_STR, idx, 0);
+ if(avi == NULL) {
LM_ERR("can't set new value\n");
return -1;
}
@@ -253,7 +260,10 @@ static int ki_pvh_remove_header_param(struct sip_msg *msg, str *hname, str *toRe
@@ -257,7 +264,10 @@ static int ki_pvh_remove_header_param(
STR_FMT(&avi->val.v.s));
}
}
@ -65,7 +69,7 @@ index 7561b08..3e9e5a6 100644
return 1;
}
diff --git a/src/modules/pv_headers/pvh_func.c b/src/modules/pv_headers/pvh_func.c
index 918733c..09f70ba 100644
index 7b1c6f9..b0e7a82 100644
--- a/src/modules/pv_headers/pvh_func.c
+++ b/src/modules/pv_headers/pvh_func.c
@@ -325,12 +325,16 @@ int pvh_check_header(struct sip_msg *msg, str *hname)
@ -103,7 +107,7 @@ index 918733c..09f70ba 100644
}
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c
index 4f90808..6f63015 100644
index e52f9da..fb9a714 100644
--- a/src/modules/pv_headers/pvh_xavp.c
+++ b/src/modules/pv_headers/pvh_xavp.c
@@ -131,18 +131,18 @@ static sr_xavp_t *pvh_xavi_new_value(str *name, sr_xval_t *val)

@ -3,21 +3,20 @@ Date: Thu, 26 Mar 2020 10:06:46 +0100
Subject: pv_trans_eval_uri
---
src/modules/pv/pv_trans.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
src/modules/pv/pv_trans.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c
index 636d846..1561a55 100644
index 5204c8f..80c42ef 100644
--- a/src/modules/pv/pv_trans.c
+++ b/src/modules/pv/pv_trans.c
@@ -1594,8 +1594,8 @@ int tr_eval_uri(struct sip_msg *msg, tr_param_t *tp, int subtype,
@@ -1542,7 +1542,8 @@ int tr_eval_uri(
}
/* parse uri -- params only when requested */
if(parse_uri(_tr_uri.s, _tr_uri.len - dlen, &_tr_parsed_uri)!=0)
{
- LM_ERR("invalid uri [%.*s]\n", val->rs.len,
- val->rs.s);
+ LM_DBG("invalid uri [%.*s] (%s:%d)\n", val->rs.len,
+ val->rs.s, ZSW(get_cfg_crt_file_name()), get_cfg_crt_line());
if(_tr_uri_params != NULL)
{
if(parse_uri(_tr_uri.s, _tr_uri.len - dlen, &_tr_parsed_uri) != 0) {
- LM_ERR("invalid uri [%.*s]\n", val->rs.len, val->rs.s);
+ LM_ERR("invalid uri [%.*s] (%s:%d)\n", val->rs.len, val->rs.s,
+ ZSW(get_cfg_crt_file_name()), get_cfg_crt_line());
if(_tr_uri_params != NULL) {
free_params(_tr_uri_params);
_tr_uri_params = 0;

@ -4,74 +4,74 @@ Subject: rtpengine-set-mime-content-length
---
src/modules/rtpengine/rtpengine.c | 43 ++++++++++++++++++++++++---------
src/modules/rtpengine/rtpengine_funcs.c | 10 +++++---
src/modules/rtpengine/rtpengine_funcs.c | 9 ++++---
src/modules/rtpengine/rtpengine_funcs.h | 3 +--
3 files changed, 39 insertions(+), 17 deletions(-)
3 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c
index 51bd9e3..11438b7 100644
index 442df8d..1c7da31 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -2506,7 +2506,7 @@ error:
}
@@ -2550,7 +2550,7 @@ error:
static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_msg *msg,
- enum rtpe_operation op, const char *flags_str, str *body_out)
+ enum rtpe_operation op, const char *flags_str, str *body_out, str *cl_field)
static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf,
struct sip_msg *msg, enum rtpe_operation op, const char *flags_str,
- str *body_out)
+ str *body_out, str *cl_field)
{
struct ng_flags_parse ng_flags;
bencode_item_t *item, *resp;
@@ -2570,7 +2570,7 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf, struct sip_
@@ -2616,7 +2616,7 @@ static bencode_item_t *rtpp_function_call(bencode_buffer_t *bencbuf,
body = pv_val.rs;
}
- } else if ((cont_type = extract_body(msg, &body)) == -1) {
+ } else if ((cont_type = extract_body(msg, &body, cl_field)) == -1) {
- } else if((cont_type = extract_body(msg, &body)) == -1) {
+ } else if((cont_type = extract_body(msg, &body, cl_field)) == -1) {
LM_ERR("can't extract body from the message\n");
goto error;
}
@@ -2876,7 +2876,7 @@ static int rtpp_function_call_simple(struct sip_msg *msg, enum rtpe_operation op
@@ -2953,7 +2953,7 @@ static int rtpp_function_call_simple(
bencode_buffer_t bencbuf;
bencode_item_t *ret;
- ret = rtpp_function_call(&bencbuf, msg, op, flags_str, NULL);
+ ret = rtpp_function_call(&bencbuf, msg, op, flags_str, NULL, NULL);
if (!ret)
if(!ret)
return -1;
@@ -2896,11 +2896,11 @@ static int rtpengine_simple_wrap(struct sip_msg *msg, void *d, int more, enum rt
@@ -2976,11 +2976,11 @@ static int rtpengine_simple_wrap(
static bencode_item_t *rtpp_function_call_ok(bencode_buffer_t *bencbuf, struct sip_msg *msg,
- enum rtpe_operation op, const char *flags_str, str *body)
+ enum rtpe_operation op, const char *flags_str, str *body, str *cl_field)
static bencode_item_t *rtpp_function_call_ok(bencode_buffer_t *bencbuf,
struct sip_msg *msg, enum rtpe_operation op, const char *flags_str,
- str *body)
+ str *body, str *cl_field)
{
bencode_item_t *ret;
- ret = rtpp_function_call(bencbuf, msg, op, flags_str, body);
+ ret = rtpp_function_call(bencbuf, msg, op, flags_str, body, cl_field);
if (!ret)
if(!ret)
return NULL;
@@ -3695,7 +3695,7 @@ static void parse_call_stats(bencode_item_t *dict, struct sip_msg *msg) {
static int rtpengine_delete(struct sip_msg *msg, const char *flags) {
@@ -3804,7 +3804,7 @@ static int rtpengine_delete(struct sip_msg *msg, const char *flags)
{
bencode_buffer_t bencbuf;
- bencode_item_t *ret = rtpp_function_call_ok(&bencbuf, msg, OP_DELETE, flags, NULL);
+ bencode_item_t *ret = rtpp_function_call_ok(&bencbuf, msg, OP_DELETE, flags, NULL, NULL);
if (!ret)
bencode_item_t *ret =
- rtpp_function_call_ok(&bencbuf, msg, OP_DELETE, flags, NULL);
+ rtpp_function_call_ok(&bencbuf, msg, OP_DELETE, flags, NULL, NULL);
if(!ret)
return -1;
parse_call_stats(ret, msg);
@@ -3705,7 +3705,7 @@ static int rtpengine_delete(struct sip_msg *msg, const char *flags) {
static int rtpengine_query(struct sip_msg *msg, const char *flags) {
@@ -3816,7 +3816,7 @@ static int rtpengine_query(struct sip_msg *msg, const char *flags)
{
bencode_buffer_t bencbuf;
- bencode_item_t *ret = rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, flags, NULL);
+ bencode_item_t *ret = rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, flags, NULL, NULL);
if (!ret)
bencode_item_t *ret =
- rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, flags, NULL);
+ rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, flags, NULL, NULL);
if(!ret)
return -1;
parse_call_stats(ret, msg);
@@ -3979,9 +3979,11 @@ rtpengine_offer_answer(struct sip_msg *msg, const char *flags, enum rtpe_operati
@@ -4097,9 +4097,11 @@ static int rtpengine_offer_answer(struct sip_msg *msg, const char *flags,
str body, newbody;
struct lump *anchor;
pv_value_t pv_val;
@ -82,69 +82,69 @@ index 51bd9e3..11438b7 100644
- dict = rtpp_function_call_ok(&bencbuf, msg, op, flags, &body);
+ dict = rtpp_function_call_ok(&bencbuf, msg, op, flags, &body, &cl_field);
if (!dict)
if(!dict)
return -1;
@@ -4009,6 +4011,21 @@ rtpengine_offer_answer(struct sip_msg *msg, const char *flags, enum rtpe_operati
@@ -4129,6 +4131,21 @@ static int rtpengine_offer_answer(struct sip_msg *msg, const char *flags,
pkg_free(newbody.s);
} else {
+ if (cl_field.len) {
+ if(cl_field.len) {
+ anchor = del_lump(msg, cl_field.s - msg->buf, cl_field.len, 0);
+ cl_repl.s = pkg_malloc(10);
+ if (!cl_repl.s) {
+ if(!cl_repl.s) {
+ LM_ERR("pkg_malloc for Content-Length failed\n");
+ goto error_free;
+ }
+ cl_repl.len = snprintf(cl_repl.s, 10, "%i", (int) newbody.len);
+ if (!insert_new_lump_after(anchor, cl_repl.s, cl_repl.len, 0)) {
+ cl_repl.len = snprintf(cl_repl.s, 10, "%i", (int)newbody.len);
+ if(!insert_new_lump_after(anchor, cl_repl.s, cl_repl.len, 0)) {
+ LM_ERR("insert_new_lump_after failed\n");
+ goto error_free;
+ }
+ cl_repl.s = NULL;
+ }
+
if (read_sdp_pvar_str.len > 0) {
if(read_sdp_pvar_str.len > 0) {
/* get the body from the message as body ptr may have changed
* when using read_sdp_pv */
@@ -4036,6 +4053,8 @@ rtpengine_offer_answer(struct sip_msg *msg, const char *flags, enum rtpe_operati
@@ -4156,6 +4173,8 @@ static int rtpengine_offer_answer(struct sip_msg *msg, const char *flags,
error_free:
pkg_free(newbody.s);
+ if (cl_repl.s)
+ if(cl_repl.s)
+ pkg_free(cl_repl.s);
error:
bencode_buffer_free(&bencbuf);
return -1;
@@ -4104,7 +4123,7 @@ static int rtpengine_play_media(struct sip_msg *msg, void *d, int more, enum rtp
@@ -4219,7 +4238,7 @@ static int rtpengine_play_media(
pv_value_t val;
int retval = 1;
- ret = rtpp_function_call_ok(&bencbuf, msg, OP_PLAY_MEDIA, d, NULL);
+ ret = rtpp_function_call_ok(&bencbuf, msg, OP_PLAY_MEDIA, d, NULL, NULL);
if (!ret)
if(!ret)
return -1;
if (media_duration_pvar) {
@@ -4168,7 +4187,7 @@ static int rtpengine_rtpstat_wrap(struct sip_msg *msg, void *d, int more, enum r
if(media_duration_pvar) {
@@ -4283,7 +4302,7 @@ static int rtpengine_rtpstat_wrap(
param = parms[0];
res = parms[1];
- dict = rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, NULL, NULL);
+ dict = rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, NULL, NULL, NULL);
if (!dict)
if(!dict)
return -1;
@@ -4336,7 +4355,7 @@ static int rtpengine_query_v_wrap(struct sip_msg *msg, void *d, int more,
@@ -4452,7 +4471,7 @@ static int rtpengine_query_v_wrap(
fmt = parms[0];
dst = parms[1];
- dict = rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, NULL, NULL);
+ dict = rtpp_function_call_ok(&bencbuf, msg, OP_QUERY, NULL, NULL, NULL);
if (!dict) {
if(!dict) {
return -1;
}
diff --git a/src/modules/rtpengine/rtpengine_funcs.c b/src/modules/rtpengine/rtpengine_funcs.c
index 4863ec6..35272b4 100644
index 7ef7c8b..dde9cf5 100644
--- a/src/modules/rtpengine/rtpengine_funcs.c
+++ b/src/modules/rtpengine/rtpengine_funcs.c
@@ -66,7 +66,7 @@
@ -154,41 +154,40 @@ index 4863ec6..35272b4 100644
-int check_content_type(struct sip_msg *msg)
+static int check_content_type(struct sip_msg *msg)
{
static unsigned int appl[16] = {
0x6c707061/*appl*/,0x6c707041/*Appl*/,0x6c705061/*aPpl*/,
@@ -161,7 +161,7 @@ other:
static unsigned int appl[16] = {0x6c707061 /*appl*/, 0x6c707041 /*Appl*/,
0x6c705061 /*aPpl*/, 0x6c705041 /*APpl*/, 0x6c507061 /*apPl*/,
@@ -156,7 +156,7 @@ other:
/*
* Get message body and check Content-Type header field
*/
-int extract_body(struct sip_msg *msg, str *body )
-int extract_body(struct sip_msg *msg, str *body)
+int extract_body(struct sip_msg *msg, str *body, str *cl_field)
{
char c;
int ret;
@@ -241,7 +241,11 @@ int extract_body(struct sip_msg *msg, str *body )
@@ -234,7 +234,10 @@ int extract_body(struct sip_msg *msg, str *body)
break;
if(hf.type==HDR_ERROR_T)
if(hf.type == HDR_ERROR_T)
return -1;
- if(hf.type==HDR_CONTENTTYPE_T) {
- if(hf.type == HDR_CONTENTTYPE_T) {
+ if(hf.type == HDR_CONTENTLENGTH_T) {
+ if (cl_field)
+ if(cl_field)
+ *cl_field = hf.body;
+ }
+ else if(hf.type == HDR_CONTENTTYPE_T) {
if(decode_mime_type(hf.body.s, hf.body.s + hf.body.len,
&mime)==NULL)
+ } else if(hf.type == HDR_CONTENTTYPE_T) {
if(decode_mime_type(hf.body.s, hf.body.s + hf.body.len, &mime)
== NULL)
return -1;
diff --git a/src/modules/rtpengine/rtpengine_funcs.h b/src/modules/rtpengine/rtpengine_funcs.h
index 6071fb9..b92298e 100644
index a1221bd..ea0a720 100644
--- a/src/modules/rtpengine/rtpengine_funcs.h
+++ b/src/modules/rtpengine/rtpengine_funcs.h
@@ -27,8 +27,7 @@
#include "../../core/parser/msg_parser.h"
#include "../../core/parser/contact/contact.h"
-int extract_body(struct sip_msg * , str *);
-int check_content_type(struct sip_msg * );
+int extract_body(struct sip_msg * , str *, str *);
-int extract_body(struct sip_msg *, str *);
-int check_content_type(struct sip_msg *);
+int extract_body(struct sip_msg *, str *, str *);
int get_callid(struct sip_msg *, str *);
int get_to_tag(struct sip_msg *, str *);
int get_from_tag(struct sip_msg *, str *);

@ -12,7 +12,7 @@ values from Headers. If no value, skip header creation.
4 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/src/modules/sca/sca.c b/src/modules/sca/sca.c
index c0042b9..bdcc2ab 100644
index 2c0dc32..dc1e806 100644
--- a/src/modules/sca/sca.c
+++ b/src/modules/sca/sca.c
@@ -70,6 +70,8 @@ unsigned short from_uri_avp_type;

@ -9,7 +9,7 @@ Subject: sca-debug
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/src/modules/sca/sca_appearance.c b/src/modules/sca/sca_appearance.c
index 78ee5d8..dca2421 100644
index c467137..c141a6e 100644
--- a/src/modules/sca/sca_appearance.c
+++ b/src/modules/sca/sca_appearance.c
@@ -911,8 +911,10 @@ int sca_appearance_update_index(sca_mod *scam, str *aor, int idx, int state,

@ -16,7 +16,7 @@ Subject: sca-line-seize
10 files changed, 410 insertions(+), 201 deletions(-)
diff --git a/src/modules/sca/sca.c b/src/modules/sca/sca.c
index 07dac39..c2347bb 100644
index c856a2a..0298610 100644
--- a/src/modules/sca/sca.c
+++ b/src/modules/sca/sca.c
@@ -64,6 +64,12 @@ db_func_t dbf; // db api

@ -10,7 +10,7 @@ Subject: sca-rr-is-direction
4 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/src/modules/sca/sca.c b/src/modules/sca/sca.c
index c2347bb..c0042b9 100644
index 0298610..2c0dc32 100644
--- a/src/modules/sca/sca.c
+++ b/src/modules/sca/sca.c
@@ -62,6 +62,7 @@ sca_mod *sca = NULL;

@ -102,7 +102,7 @@ index 0000000..5e44ba1
+
+#endif
diff --git a/src/modules/tmrec/tmrec_mod.c b/src/modules/tmrec/tmrec_mod.c
index cc97cc9..e574af1 100644
index 5cb57aa..7195a55 100644
--- a/src/modules/tmrec/tmrec_mod.c
+++ b/src/modules/tmrec/tmrec_mod.c
@@ -41,6 +41,7 @@
@ -113,28 +113,28 @@ index cc97cc9..e574af1 100644
MODULE_VERSION
@@ -50,7 +51,9 @@ static int child_init(int);
@@ -50,7 +51,9 @@ static int child_init(int);
static void mod_destroy(void);
static int w_tmrec_match(struct sip_msg* msg, char* rec, char* t);
+static int w_tmrec_match_ical(struct sip_msg* msg, char* rec, char* t);
static int fixup_tmrec_match(void** param, int param_no);
+static int fixup_ical(void** param, int param_no);
static int w_is_leap_year(struct sip_msg* msg, char* t, char* p2);
static int fixup_is_leap_year(void** param, int param_no);
static int fixup_time_period_match(void** param, int param_no);
@@ -65,6 +68,10 @@ static cmd_export_t cmds[]={
0, ANY_ROUTE},
{"tmrec_match", (cmd_function)w_tmrec_match, 2, fixup_tmrec_match,
0, ANY_ROUTE},
+ {"tmrec_match_ical", (cmd_function)w_tmrec_match_ical, 1, fixup_ical,
+ 0, ANY_ROUTE},
+ {"tmrec_match_ical", (cmd_function)w_tmrec_match_ical, 2, fixup_ical,
+ 0, ANY_ROUTE},
{"is_leap_year", (cmd_function)w_is_leap_year, 0, fixup_is_leap_year,
0, ANY_ROUTE},
{"is_leap_year", (cmd_function)w_is_leap_year, 1, fixup_is_leap_year,
@@ -254,6 +261,45 @@ static int w_tmrec_match(struct sip_msg* msg, char* rec, char* t)
static int w_tmrec_match(struct sip_msg *msg, char *rec, char *t);
+static int w_tmrec_match_ical(struct sip_msg *msg, char *rec, char *t);
static int fixup_tmrec_match(void **param, int param_no);
+static int fixup_ical(void **param, int param_no);
static int w_is_leap_year(struct sip_msg *msg, char *t, char *p2);
static int fixup_is_leap_year(void **param, int param_no);
static int fixup_time_period_match(void **param, int param_no);
@@ -64,6 +67,10 @@ static cmd_export_t cmds[] = {{"tmrec_match", (cmd_function)w_tmrec_match, 1,
fixup_tmrec_match, 0, ANY_ROUTE},
{"tmrec_match", (cmd_function)w_tmrec_match, 2, fixup_tmrec_match, 0,
ANY_ROUTE},
+ {"tmrec_match_ical", (cmd_function)w_tmrec_match_ical, 1, fixup_ical, 0,
+ ANY_ROUTE},
+ {"tmrec_match_ical", (cmd_function)w_tmrec_match_ical, 2, fixup_ical, 0,
+ ANY_ROUTE},
{"is_leap_year", (cmd_function)w_is_leap_year, 0, fixup_is_leap_year, 0,
ANY_ROUTE},
{"is_leap_year", (cmd_function)w_is_leap_year, 1, fixup_is_leap_year, 0,
@@ -242,6 +249,45 @@ static int w_tmrec_match(struct sip_msg *msg, char *rec, char *t)
return ki_tmrec_match_timestamp(msg, &rv, ti);
}
@ -177,10 +177,10 @@ index cc97cc9..e574af1 100644
+ return rc;
+}
+
static int fixup_tmrec_match(void** param, int param_no)
static int fixup_tmrec_match(void **param, int param_no)
{
if(param_no==1)
@@ -268,6 +314,20 @@ static int fixup_tmrec_match(void** param, int param_no)
if(param_no == 1) {
@@ -255,6 +301,20 @@ static int fixup_tmrec_match(void **param, int param_no)
return 0;
}
@ -198,6 +198,6 @@ index cc97cc9..e574af1 100644
+ return 0;
+}
+
static int fixup_time_period_match(void** param, int param_no)
static int fixup_time_period_match(void **param, int param_no)
{
if(param_no==1)
if(param_no == 1) {

@ -3,23 +3,23 @@ Date: Thu, 26 Mar 2020 10:06:46 +0100
Subject: usrloc_dbro
---
src/modules/usrloc/usrloc_mod.c | 65 +++++++++++++++++++++++++++++++++++++++++
src/modules/usrloc/usrloc_mod.c | 68 ++++++++++++++++++++++++++++++++++++++++-
src/modules/usrloc/usrloc_mod.h | 2 ++
2 files changed, 67 insertions(+)
2 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/src/modules/usrloc/usrloc_mod.c b/src/modules/usrloc/usrloc_mod.c
index dc31c6f..55c5b6e 100644
index de75545..fcbb171 100644
--- a/src/modules/usrloc/usrloc_mod.c
+++ b/src/modules/usrloc/usrloc_mod.c
@@ -167,6 +167,7 @@ str ulattrs_avalue_col = str_init(ULATTRS_AVALUE_COL); /*!< Name of column conta
str ulattrs_last_mod_col = str_init(ULATTRS_LAST_MOD_COL); /*!< Name of column containing the last modified date */
@@ -198,6 +198,7 @@ str ulattrs_last_mod_col = str_init(
ULATTRS_LAST_MOD_COL); /*!< Name of column containing the last modified date */
str ul_db_url = str_init(DEFAULT_DB_URL); /*!< Database URL */
+str ul_db_url_ro = STR_NULL; /*!< Read-Only Database URL */
int ul_timer_interval = 60; /*!< Timer interval in seconds */
int ul_db_mode = 0; /*!< Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
int ul_db_load = 1; /*!< Database load after restart: 1- true, 0- false (only the db_mode allows it) */
@@ -201,6 +202,8 @@ static cmd_export_t cmds[] = {
str ul_db_url = str_init(DEFAULT_DB_URL); /*!< Database URL */
+str ul_db_url_ro = STR_NULL; /*!< Read-Only Database URL */
int ul_timer_interval = 60; /*!< Timer interval in seconds */
int ul_db_mode =
0; /*!< Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
@@ -239,6 +240,8 @@ static cmd_export_t cmds[] = {
{0, 0, 0, 0, 0, 0}
};
@ -28,17 +28,17 @@ index dc31c6f..55c5b6e 100644
/*! \brief
* Exported parameters
@@ -217,6 +220,7 @@ static param_export_t params[] = {
{"flags_column", PARAM_STR, &ul_flags_col },
{"cflags_column", PARAM_STR, &ul_cflags_col },
{"db_url", PARAM_STR, &ul_db_url },
+ {"db_url_ro", PARAM_STR, &ul_db_url_ro.s },
{"timer_interval", INT_PARAM, &ul_timer_interval },
{"db_mode", INT_PARAM, &ul_db_mode },
{"db_load", INT_PARAM, &ul_db_load },
@@ -288,6 +292,38 @@ struct module_exports exports = {
destroy /*!< destroy function */
@@ -255,6 +258,7 @@ static param_export_t params[] = {
{"flags_column", PARAM_STR, &ul_flags_col},
{"cflags_column", PARAM_STR, &ul_cflags_col},
{"db_url", PARAM_STR, &ul_db_url},
+ {"db_url_ro", PARAM_STR, &ul_db_url_ro.s},
{"timer_interval", INT_PARAM, &ul_timer_interval},
{"db_mode", INT_PARAM, &ul_db_mode},
{"db_load", INT_PARAM, &ul_db_load},
@@ -327,6 +331,39 @@ struct module_exports exports = {
};
/* clang-format on */
+/*!
+ * \brief check ro db
@ -72,13 +72,15 @@ index dc31c6f..55c5b6e 100644
+ if (con) ul_dbf_ro.close(con);
+ return -1;
+}
+
/*! \brief
* Module initialization function
@@ -392,6 +428,21 @@ static int mod_init(void)
*/
@@ -430,7 +467,22 @@ static int mod_init(void)
}
}
- if(ul_nat_bflag == (unsigned int)-1) {
+ /* Shall we use read-only db ? */
+ if (ul_db_mode == DB_ONLY && ul_db_url_ro.len > 0) {
+ if (db_bind_mod(&ul_db_url_ro, &ul_dbf_ro) < 0) { /* Find database module */
@ -94,10 +96,11 @@ index dc31c6f..55c5b6e 100644
+ LM_DBG("ul_db_url_ro detected and checked\n");
+ }
+
if (ul_nat_bflag==(unsigned int)-1) {
+ if (ul_nat_bflag == (unsigned int)-1) {
ul_nat_bflag = 0;
} else if (ul_nat_bflag>=8*sizeof(ul_nat_bflag) ) {
@@ -485,6 +536,16 @@ static int child_init(int _rank)
} else if(ul_nat_bflag >= 8 * sizeof(ul_nat_bflag)) {
LM_ERR("bflag index (%d) too big!\n", ul_nat_bflag);
@@ -524,6 +576,16 @@ static int child_init(int _rank)
LM_ERR("child(%d): failed to connect to database\n", _rank);
return -1;
}
@ -112,9 +115,9 @@ index dc31c6f..55c5b6e 100644
+ LM_DBG("read-only connection init\n");
+ }
/* _rank==PROC_SIPINIT is used even when fork is disabled */
if (_rank==ul_load_rank && ul_db_mode!=DB_ONLY && ul_db_load) {
if(_rank == ul_load_rank && ul_db_mode != DB_ONLY && ul_db_load) {
/* if cache is used, populate domains from DB */
@@ -515,6 +576,10 @@ static void destroy(void)
@@ -554,6 +616,10 @@ static void destroy(void)
ul_dbf.close(ul_dbh);
}
@ -126,7 +129,7 @@ index dc31c6f..55c5b6e 100644
/* free callbacks list */
diff --git a/src/modules/usrloc/usrloc_mod.h b/src/modules/usrloc/usrloc_mod.h
index 8c24e12..f227c69 100644
index 7192c9c..4fe237b 100644
--- a/src/modules/usrloc/usrloc_mod.h
+++ b/src/modules/usrloc/usrloc_mod.h
@@ -89,6 +89,8 @@ extern int ul_handle_lost_tcp;

@ -3,23 +3,23 @@ Date: Thu, 26 Mar 2020 10:06:46 +0100
Subject: usrloc_dbro_pinger
---
src/modules/usrloc/dlist.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
src/modules/usrloc/dlist.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index 4e54f96..bca621d 100644
index 57a9b4a..50dd4c1 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -305,6 +305,8 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
db_op_t ops1[4];
@@ -307,6 +307,8 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
db_op_t ops1[4];
db_key_t keys2[6]; /* select */
int n[2] = {2,6}; /* number of dynamic values used on key1/key2 */
+ db1_con_t* dbh = ul_dbh;
+ db_func_t* dbf = &ul_dbf;
int n[2] = {2, 6}; /* number of dynamic values used on key1/key2 */
+ db1_con_t *dbh = ul_dbh;
+ db_func_t *dbf = &ul_dbf;
cp = buf;
shortage = 0;
@@ -351,22 +353,26 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
@@ -353,23 +355,27 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
vals1[n[0]].nul = 0;
vals1[n[0]].val.int_val = server_id;
n[0]++;
@ -31,25 +31,27 @@ index 4e54f96..bca621d 100644
/* TODO: use part_idx and part_max on keys1 */
for (dom = _ksr_ul_root; dom!=NULL ; dom=dom->next) {
- if (ul_dbf.use_table(ul_dbh, dom->d->name) < 0) {
+ if (ul_dbf.use_table(dbh, dom->d->name) < 0) {
for(dom = _ksr_ul_root; dom != NULL; dom = dom->next) {
- if(ul_dbf.use_table(ul_dbh, dom->d->name) < 0) {
+ if(ul_dbf.use_table(dbh, dom->d->name) < 0) {
LM_ERR("sql use_table failed\n");
return -1;
}
- if (ul_dbf.query(ul_dbh, keys1, ops1, vals1, keys2,
+ if (dbf->query(dbh, keys1, ops1, vals1, keys2,
n[0], n[1], NULL, &res) <0 ) {
- if(ul_dbf.query(
- ul_dbh, keys1, ops1, vals1, keys2, n[0], n[1], NULL, &res)
+ if(dbf.query(
+ dbh, keys1, ops1, vals1, keys2, n[0], n[1], NULL, &res)
< 0) {
LM_ERR("query error\n");
return -1;
}
if( RES_ROW_N(res)==0 ) {
if(RES_ROW_N(res) == 0) {
- ul_dbf.free_result(ul_dbh, res);
+ dbf->free_result(dbh, res);
+ dbf.free_result(dbh, res);
continue;
}
@@ -489,7 +495,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
@@ -487,7 +493,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
len -= needed;
} /* row cycle */

@ -9,7 +9,7 @@ Subject: pv_headers: compare result of pvh_set_xavi() with NULL for error
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/modules/pv_headers/pvh_xavp.c b/src/modules/pv_headers/pvh_xavp.c
index 6f63015..3bc32d2 100644
index fb9a714..b715baa 100644
--- a/src/modules/pv_headers/pvh_xavp.c
+++ b/src/modules/pv_headers/pvh_xavp.c
@@ -618,11 +618,11 @@ int pvh_set_header(

Loading…
Cancel
Save