#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [x] Related to issue #4315
#### Description
Added a function to check the flow token.
Useful to make sure the client TCP connection is alive.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4449
-- Commit Summary --
* outbound: added check_flow_token function
* outbound: docbook - fixed 'Attribute "xmlns:xi" must be declared for element type'
* outbound: fixed xml validation errors
* outbound: added check_flow_token documentation
-- File Changes --
M src/modules/outbound/doc/outbound.xml (3)
M src/modules/outbound/doc/outbound_admin.xml (78)
M src/modules/outbound/outbound_mod.c (149)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4449.patchhttps://github.com/kamailio/kamailio/pull/4449.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4449
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4449(a)github.com>
sergey-safarov created an issue (kamailio/kamailio#4315)
### Description
Use case WebRTC client connected to Kaamilio Edge proxy.
For network connectivity reasons, the flow token may no longer be valid. In this case, behavior should be described in the [RFC5626, 5.3.1 Processing Incoming Requests](https://datatracker.ietf.org/doc/html/rfc5626#section-5.3.1)
> If the flow no longer exists, the proxy SHOULD send a 430 (Flow Failed) response to the request.
Also [9.3 Incoming Call and Proxy Crash](https://datatracker.ietf.org/doc/html/rfc5626#section-9.3)
> Bob's authoritative proxy first tries the flow to EP1, but EP1 no longer has a flow to Bob, so it responds with a 430 (Flow Failed) response.
To get it working, it will be fine to use construction like
```
if (!loose_route()) {
switch($rc) {
case -4:
sl_send_reply("403", "Flow Failed");
exit;
case -2:
sl_send_reply("403", "Forbidden");
exit;
default:
xlog("L_ERR", "in request_route\n");
sl_reply_error();
exit;
}
}
```
Where `loose_route` returns a new error code (`-4` for example). This error code is generated when the flow token points to not existing TCP/TLS/WSS connection.
### Expected behavior
Kamailio `loose_route` allows the check of flow token validity before messages related via non-existent TCP/TLS/WSS connections.
#### Actual observed behavior
For now, Kamailio tries to relay messages to non-existent client connections and generate an error message like
```
477 Unfortunately error on sending to next hop occurred (477/TM)
500 Message processing error (2/TM)
```
#### How to reproduce
Required to start Kamailio with a config like
```
listen=udp:127.0.0.1:5060
listen=tcp:127.0.0.1:5060
loadmodule "pv.so"
loadmodule "xlog.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "siputils.so"
loadmodule "rr.so"
loadmodule "stun.so"
loadmodule "outbound.so"
modparam("outbound", "force_outbound_flag", 1)
modparam("outbound", "flow_token_secret", "kamailio")
loadmodule "debugger.so"
modparam("debugger", "cfgtrace", 1)
modparam("debugger", "log_level_name", "exec")
request_route {
loose_route();
switch($rc) {
case -3:
xlog("L_ERR", "loose_route code -3\n");
break;
case -2:
xlog("L_ERR", "loose_route code -2\n");
break;
case -1:
xlog("L_ERR", "loose_route code -1\n");
break;
case 1:
xlog("L_ERR", "loose_route code 1\n");
break;
case 2:
xlog("L_ERR", "loose_route code 2\n");
break;
}
record_route();
if (has_totag()) {
t_relay();
} else {
t_relay_to_udp("127.0.0.1", "5080");
}
}
```
Then need to start SIPp server script using the command
```
sipp -sf uas.xml -p 5080 -d 4000 -bind_local 127.0.0.1
```
And then start SIPp client script using the command
```
sipp -sf uac.xml -m 1 -t t1 127.0.0.1
```
Where `uac.xml` and `uas.xml` are attached
[sipp-scripts.tar.gz](https://github.com/user-attachments/files/21187724/sip…
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4315
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4315(a)github.com>
sergey-safarov created an issue (kamailio/kamailio#4484)
```
/root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:671:69: warning: ‘rpl_sdp_session’ may be used uninitialized [-Wmaybe-uninitialized]
671 | ipB = rpl_sdp_session->ip_addr;
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:560:47: note: ‘rpl_sdp_session’ was declared here
560 | sdp_session_cell_t *req_sdp_session, *rpl_sdp_session;
| ^~~~~~~~~~~~~~~
/root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:620:35: warning: ‘rpl_sdp_stream’ may be used uninitialized [-Wmaybe-uninitialized]
620 | if(rpl_sdp_stream) {
| ^
/root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:561:45: note: ‘rpl_sdp_stream’ was declared here
561 | sdp_stream_cell_t *req_sdp_stream, *rpl_sdp_stream;
| ^~~~~~~~~~~~~~
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4484
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4484(a)github.com>
sergey-safarov created an issue (kamailio/kamailio#4457)
### Description
For now, `htable` exporting `table_spec` and `init_tables`. [Link](https://github.com/kamailio/kamailio/blob/18beef305002e6b2a4a6504273a…
When spec contains `dbmode=1`, then data is not loaded from the database, and `htable` cache data is not available after Kamailio restart.
It would be fine to expose `ht_db_load_tables` via `htable` API and other Kamailio modules can get cache after Kamailio restart.
### Expected behavior
htables defined via API with param dbmode=1 loaded after Kamailio restart.
#### Actual observed behavior
htables cache is not loaded after Kamailio restart if the table is created via API.
### Possible Solutions
Probably it can be done using this change
```diff
From 72e1aea56efa16ecd50806baa94a5cc0f62d37d6 Mon Sep 17 00:00:00 2001
From: Nikolay Ivanuschak <ivanuschak.nikolay(a)gmail.com>
Date: Wed, 29 Oct 2025 22:57:49 +0300
Subject: [PATCH] htable: added db API functions
---
src/modules/htable/api.c | 25 +++++++++++++++++++++++++
src/modules/htable/api.h | 9 +++++++++
2 files changed, 34 insertions(+)
diff --git a/src/modules/htable/api.c b/src/modules/htable/api.c
index 94095d3d5d..02b299d8c4 100644
--- a/src/modules/htable/api.c
+++ b/src/modules/htable/api.c
@@ -26,6 +26,7 @@
#include "../../core/dprint.h"
#include "ht_api.h"
+#include "ht_db.h"
#include "api.h"
#include "ht_dmq.h"
@@ -157,6 +158,26 @@ int ht_api_init_tables(void)
return ht_init_tables();
}
+int ht_api_db_open_con(void)
+{
+ return ht_db_open_con();
+}
+
+int ht_api_db_close_con(void)
+{
+ return ht_db_close_con();
+}
+
+int ht_api_db_load_tables(void)
+{
+ return ht_db_load_tables();
+}
+
+int ht_api_db_sync_tables(void)
+{
+ return ht_db_sync_tables();
+}
+
/**
*
*/
@@ -175,5 +196,9 @@ int bind_htable(htable_api_t *api)
api->get_expire = ht_api_get_cell_expire;
api->rm_re = ht_api_rm_cell_re;
api->count_re = ht_api_count_cells_re;
+ api->db_open_con = ht_api_db_open_con;
+ api->db_close_con = ht_api_db_close_con;
+ api->db_load_tables = ht_api_db_load_tables;
+ api->db_sync_tables = ht_api_db_sync_tables;
return 0;
}
diff --git a/src/modules/htable/api.h b/src/modules/htable/api.h
index 2e84f2e0da..1f0a547434 100644
--- a/src/modules/htable/api.h
+++ b/src/modules/htable/api.h
@@ -38,6 +38,11 @@ typedef int (*ht_api_set_cell_expire_f)(
typedef int (*ht_api_get_cell_expire_f)(
str *hname, str *name, unsigned int *val);
+typedef int (*ht_api_db_open_con_f)(void);
+typedef int (*ht_api_db_close_con_f)(void);
+typedef int (*ht_api_db_load_tables_f)(void);
+typedef int (*ht_api_db_sync_tables_f)(void);
+
typedef int (*ht_api_rm_cell_re_f)(str *hname, str *sre, int mode);
typedef int (*ht_api_count_cells_re_f)(str *hname, str *sre, int mode);
@@ -52,6 +57,10 @@ typedef struct htable_api
ht_api_get_cell_expire_f get_expire;
ht_api_rm_cell_re_f rm_re;
ht_api_count_cells_re_f count_re;
+ ht_api_db_open_con_f db_open_con;
+ ht_api_db_close_con_f db_close_con;
+ ht_api_db_load_tables_f db_load_tables;
+ ht_api_db_sync_tables_f db_sync_tables;
} htable_api_t;
typedef int (*bind_htable_f)(htable_api_t *api);
--
2.51.0
```
Here exposed `db_open_con`, `db_close_con`, also because required to make sure database connections are present before reading the database.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4457
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4457(a)github.com>
wedhornsipgate created an issue (kamailio/kamailio#4426)
**Description:**
We're missing a KEMI function in the htable module that provides the same functionality as the PV function `$shtcn(table=>pattern)` to count the number of keys in an htable that match a given pattern (prefix/suffix/regex). The goal is to let KEMI scripts perform pattern counts without constructing dynamic PV expressions, which currently causes unbounded pv_cache growth in PKG memory.
**Use case / motivation:**
We implemented rolling-window rate limiting by writing short-lived, per-call entries into an htable and then counting keys that match a number-derived pattern. Using $shtcn() works well for the logic, but in KEMI (JS/TypeScript) we must call it via pv.gete("$shtcn(...)"). Because the PV string varies per INVITE (different pattern/key each time), these dynamic PV expressions accumulate in the PV cache, growing PKG/private memory over time.
We’d like a native KEMI function to perform the same count/match so we can avoid the PV layer entirely.
**Environment**
Kamailio: 5.8.6 on Debian 12
Scripting: KEMI (JavaScript/TypeScript)
Symptom: steady PKG/private memory increase over ~24h under load when using pv.gete("$shtcn(...)"). Disabling the $shtcn() call stops the growth.
Related log line: the one discussed in [#3440](https://github.com/kamailio/kamailio/issues/3440) (“pv cache … pkg memory may get filled with pv declarations”).
Current line in our script:
```if (ksr.pv.gete(`$shtcn(${htable_count}=>%~${number})`) > threshold) { ... }```
**Current workaround**
Restarting the Kamailio every day or disabling rate limit on instances with KEMI.
**Idea for API**
Minimal, PV-parity:
```
// KEMI export
int shtcn_match(str table, str pattern, int mode /* 0=exact, 1=prefix, 2=suffix, 3=regex */);
```
JS example:
`const n = KSR.htable.shtcn_match("from_number_count", number, 3); // regex`
More explicit helpers (avoids integer modes):
```
KSR.htable.shtcn_exact(table, key) -> int
KSR.htable.shtcn_prefix(table, prefix) -> int
KSR.htable.shtcn_suffix(table, suffix) -> int
KSR.htable.shtcn_regex(table, pattern) -> int
```
**Behavioral notes / expectations**
Should mirror $shtcn() semantics where reasonable (esp. regex behavior), but returning an integer directly to KEMI.
Must not allocate PV expressions or interact with pv_cache.
**Why this belongs in htable KEMI**
$shtcn() is already offered at the PV level; parity in KEMI keeps feature consistency across scripting engines.
It enables memory-safe implementations of rolling-window rate limits and similar patterns (without touching PV).
**Alternatives considered**
Replace pattern counting with per-bucket counters (sht_inc), which leads to other problems like increment/decrement handling and locking.
Use ratelimit/pike modules—useful for IP/method limits, but our use case is PAI/From/To based and currently hinges on pattern counts.
**Acceptance criteria**
A KEMI function exists to count matching keys in an htable without PV parsing.
Verified that repeated calls with dynamic patterns do not grow PV cache / PKG memory.
Basic tests for exact/prefix/suffix/regex modes (and skip_expired if implemented).
Thank you!
This would let KEMI users keep $shtcn()-style logic with the same performance characteristics, but without the PV-cache side effects.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4426
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4426(a)github.com>
- add sht_is_null route function
- add sht_inc route function
- add sht_dec route function
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Implementing the identical functions from KEMI in the route functions.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4499
-- Commit Summary --
* htable: feature parity with kemi funcs
-- File Changes --
M src/modules/htable/doc/htable.xml (2)
M src/modules/htable/doc/htable_admin.xml (105)
M src/modules/htable/htable.c (95)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4499.patchhttps://github.com/kamailio/kamailio/pull/4499.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4499
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4499(a)github.com>
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #4426
#### Description
<!-- Describe your changes in detail -->
This PR add the functionaility discussed in the referenced issue for KEMI!
- PV shtcn equivalent
- match with mode
- seperate specific functions for exact, prefix, suffix, regex
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4492
-- Commit Summary --
* Add more KEMI functions
-- File Changes --
M src/modules/htable/htable.c (102)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4492.patchhttps://github.com/kamailio/kamailio/pull/4492.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4492
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4492(a)github.com>
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
This feature addition adds support for loading integer-type DB fields into AVPs, for the "extra" fields that are loaded when matching the authentication / route.
The following modules are effected by this change:
- dispatcher: support integer fields for ds_db_extra_attrs
- permissions: support integer fields for peer_tag
- htable: support integer fields for htable param (cols attribute key_name)
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4438
-- Commit Summary --
* htable: support for 32bit and 64bit integer keys
* permissions: support for integer peer_tag
* dispatcher: support for fields in ds_db_extra_attrs
-- File Changes --
M src/modules/dispatcher/dispatch.c (100)
M src/modules/dispatcher/doc/dispatcher.xml (9)
M src/modules/dispatcher/doc/dispatcher_admin.xml (4)
M src/modules/htable/doc/htable.xml (4)
M src/modules/htable/ht_db.c (55)
M src/modules/htable/ht_db.h (9)
M src/modules/permissions/address.c (87)
M src/modules/permissions/doc/permissions.xml (11)
M src/modules/permissions/doc/permissions_admin.xml (5)
M src/modules/permissions/trusted.c (189)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4438.patchhttps://github.com/kamailio/kamailio/pull/4438.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4438
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4438(a)github.com>