Situation: Two Kamailio nodes syncing dialog profiles via DMQ
Observation: When a dialog timeout is encountered, about half of the time, the timeout is triggered on the peer node not handling the dialog preventing the call to be correctly terminated and also leaving entries in the dialog database which never get deleted.
https://kamailio.org/docs/modules/5.7.x/modules/dialog.html#dialog.p.enable…
Makes clear, that only the node which is handling the dialog in question, can make changes not related to the dialog profiles. So when a dialog times out, it is this node which has to trigger the timeout, not any other one.
When looking at the source code, it is clear, that the 'lifetime' is transmitted via DMQ dialog message to the peer nodes, which in turn arm a timer. So it is obvious, this time will trigger, sometimes before the instance handling the dialog itself triggers that timer.
With some assistance of @oej I found a way to alter the JSON payload to extend the lifetime on the peer nodes:
```
route[DMQ_CAPTURE]
{
if(is_method("KDMQ"))
{
if(has_body("application/json") && $fU == 'dialog')
{
if (jansson_get("lifetime", $rb, "$var(lifetime)"))
{
$var(new_lifetime) = $var(lifetime) + 60; # Add 60 seconds on DMQ peer to make sure it expires AFTER main node.
$var(newrb) = $rb;
jansson_set("integer", "lifetime", $var(new_lifetime), "$var(newrb)");
set_body("$var(newrb)","application/json");
msg_apply_changes();
}
}
dmq_handle_message();
exit;
}
}
```
Testing with this config fixed the issue of the timeout firing on a peer node instead of the node handling the dialog.
Issue is present in 5.5, 5.6 and after looking at the code, I assume also on 5.7
-Benoît
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3656
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3656(a)github.com>
Module: kamailio
Branch: master
Commit: ba31a0065af34490650a205738328f52b95a784b
URL: https://github.com/kamailio/kamailio/commit/ba31a0065af34490650a205738328f5…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2024-07-16T10:31:11+02:00
modules: readme files regenerated - dispatcher ... [skip ci]
---
Modified: src/modules/dispatcher/README
---
Diff: https://github.com/kamailio/kamailio/commit/ba31a0065af34490650a205738328f5…
Patch: https://github.com/kamailio/kamailio/commit/ba31a0065af34490650a205738328f5…
---
diff --git a/src/modules/dispatcher/README b/src/modules/dispatcher/README
index 41f9d7bb812..16c10332df7 100644
--- a/src/modules/dispatcher/README
+++ b/src/modules/dispatcher/README
@@ -1883,6 +1883,7 @@ kamctl rpc dispatcher.hash 4 bob server.com
startup, useful when the hostname of the destination address
is a NAPTR or SRV record only. Such addresses cannot be
matched anymore with ds_is_from_list(...).
+ + 32 (bit at index 5 - 1 <<5) - no ping to destination
* priority: sets the priority in destination list (based on it is
done the initial ordering inside the set)
* attributes: extra fields in form of name1=value1;...;nameN=valueN.
Module: kamailio
Branch: master
Commit: abdd0bfaf6a2e50fb96e2f522f03a65f331b57b5
URL: https://github.com/kamailio/kamailio/commit/abdd0bfaf6a2e50fb96e2f522f03a65…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-07-16T10:10:06+02:00
dispatcher: new flag 32 to not send ping to destination
---
Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
---
Diff: https://github.com/kamailio/kamailio/commit/abdd0bfaf6a2e50fb96e2f522f03a65…
Patch: https://github.com/kamailio/kamailio/commit/abdd0bfaf6a2e50fb96e2f522f03a65…
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index d36141bbafd..287164f829d 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -4069,6 +4069,9 @@ void ds_ping_set(ds_set_t *node)
/* skip addresses set in disabled state by admin */
if((node->dlist[j].flags & DS_DISABLED_DST) != 0)
continue;
+ /* skip addresses with no-ping flag */
+ if((node->dlist[j].flags & DS_NOPING_DST) != 0)
+ continue;
/* If the Flag of the entry has "Probing set, send a probe: */
if(ds_ping_result_helper(node, j)) {
LM_DBG("probing set #%d, URI %.*s\n", node->id,
diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h
index 06410225a62..cf1842aeb47 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -46,7 +46,8 @@
#define DS_DISABLED_DST 4 /*!< admin disabled destination */
#define DS_PROBING_DST 8 /*!< checking destination */
#define DS_NODNSARES_DST 16 /*!< no DNS A/AAAA resolve for host in uri */
-#define DS_STATES_ALL 31 /*!< all bits for the states of destination */
+#define DS_NOPING_DST 32 /*!< no ping to destination */
+#define DS_STATES_ALL 63 /*!< all bits for the states of destination */
#define ds_skip_dst(flags) ((flags) & (DS_INACTIVE_DST|DS_DISABLED_DST))
<!-- 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
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] 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 #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
`handle_ruri_alias()` wasn't handling correctly the IP address in the alias, in case it was an IPv6. This adds `[` and `]` around the IP if v6 when composing a destination SIP URI, such that the downstream functions will handle it correctly and not be confused by the `:` before the port.
Arguably, nathelper is not needed in IPv6. Yet I have discovered a scenario where it could be quite helpful as a way to force some UE routing through an intermediary proxy.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3913
-- Commit Summary --
* nathelper: fixed handle_ruri_alias() for alias being an IPv6
-- File Changes --
M src/modules/nathelper/nathelper.c (34)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3913.patchhttps://github.com/kamailio/kamailio/pull/3913.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3913
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3913(a)github.com>
Hi,
I think there is an issue with writing CDRs on failover scenarios.
I have two servers with Kamailio. Both server running Debian 11 (bulleye) and latest Kamailio 5.6.1 from git.
I'm using DMQ to sync dialogs and htable between these servers, so both servers have the same knowledge of dialog state. Both Kamailio uses nobind option, so I can switch a VIP from one server to the other one. This is managed with keepalived. Switching the VIP from one server the other one works fine an while a call is running I can switch the VIP. I can see that the BYE Message is handled OK after I made a switch. I can see that acc is triggered but what is missing is acc_cdr in this case.
I'm using htable to fill all necessary variables to complete the CDR an I can see that all values are synced correctly.
The acc_cdr is created fine if there is no failover so i think it can't be an configuration issue.
Both server holds the same Kamailio configuration except the IP.
`version: kamailio 5.6.1 (x86_64/linux) bfc5c2-dirty
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: bfc5c2 -dirty
compiled with gcc 10.2.1`
`root@voip-lab-proxy01:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye`
`root@voip-lab-proxy01:~# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 38 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 23
Model name: Intel(R) Xeon(R) CPU E5420 @ 2.50GHz
Stepping: 10
CPU MHz: 2500.088
BogoMIPS: 5000.17
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 128 KiB
L1i cache: 128 KiB
L2 cache: 16 MiB
L3 cache: 16 MiB
NUMA node0 CPU(s): 0-3
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Mitigation; PTE Inversion; VMX EPT disabled
Vulnerability Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Unknown: No mitigations
Vulnerability Retbleed: Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid
tsc_known_freq pni vmx ssse3 cx16 pdcm sse4_1 x2apic tsc_deadline_timer xsave hypervisor lahf_lm cpuid_fault pti tpr_shadow vnmi flexpriority vpid tsc_adjust arat arch_capabilit
ies`
If you need more information, please let me know. As I'm running this on a test system I can reproduce the issue at any time.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3254
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3254(a)github.com>