### Description
Some UAC (notably Aastra Phones) use the sips: uri scheme without ;transport=tls when TLS is being used.
I observed kamailio 5.7.6 and most probably also 5.8.4 to insert the sips URI in the wrong Record-Route header causing replies not to reach the destination.
#### Reproduction
Find a UAC which uses the sips URI scheme when configured to use TLS. (AAstra IP Phones for example).
Important: The Registration looks like this, contains no transport attribute but the sips scheme with port 5061 and a path pointing to the SBC.
```
"Contact" : {
"Address" : "sips:315996608@157.161.4.237:5061",
"CFlags" : 0,
"CSeq" : 1446407115,
"Call-ID" : "3abf8e6af6391e7b",
"Expires" : 56,
"Flags" : 0,
"Instance" : "<urn:uuid:00000000-0000-1000-8000-00085D49FB42>",
"KA-Roundtrip" : 0,
"Keepalive" : 0,
"Last-Keepalive" : 1735827284,
"Last-Modified" : 1735827284,
"Methods" : 16095,
"Path" : "<sip:157.161.23.249;lr;r2=on>,<sip:157.161.23.249:5061;transport=tls;lr;r2=on>",
"Q" : 0.44,
"Received" : "[not set]",
"Reg-Id" : 0,
"Ruid" : "uloc-677695ae-20472d-23",
"Server-Id" : 0,
"Socket" : "udp:157.161.23.4:5060",
"State" : "CS_DIRTY",
"Tcpconn-Id" : -1,
"User-Agent" : "Aastra 6869i/6.3.0.1020"
}
```
Using this set-up:
UAC (TLS) - Kamailio SBC (rtpengine / nat) udp - Kamailio Registrar udp - Core Infrastructure
Call the UAC. Each hop is adding a Record-Route header which is then used by the UAC when creating a new transaction within the dialog.
In this example:
Transaction 1:
CORE => UAC: INVITE 100rel supported
UAC => CORE: 180 Ringing 100rel required
---
Transaction 2:
CORE => UAC: PRACK
During the first transaction, Record-Route header are accumulated to indicate the Route set to be taken by the in-dialog PRACK request.
In the INVITE, the UAC is presented with those Record-Route Header:
The first two header are added by the SBC (IP .249) with r2=on to indicate the change from UDP to TLS
The third header was added by the Registrar (IP .5)
The fourth header was added by the Core (IP .2)
```
02.01.2025 15:17:54.250 +01:00: 157.161.23.249:5061 -> 157.161.4.237:5061
INVITE sips:315996608@157.161.4.237:5061 SIP/2.0
Record-Route: <sips:157.161.23.249:5061;transport=tls;r2=on;lr;ftag=3944816274-1416360442>
Record-Route: <sips:157.161.23.249;r2=on;lr;ftag=3944816274-1416360442>
Record-Route: <sips:157.161.23.5;lr;ftag=3944816274-1416360442>
Record-Route: <sip:157.161.23.2;lr;ftag=3944816274-1416360442;did=e77.89e5>
```
UAC is ringing:
```
02.01.2025 15:17:54.368 +01:00: 157.161.4.237:5061 -> 157.161.23.249:5061
SIP/2.0 180 Ringing
Via: SIP/2.0/TLS 157.161.23.249:5061;branch=z9hG4bK5b72.d42e9bf4e341f690d8b383a0a96edeb3.0
Via: SIP/2.0/UDP 157.161.23.5;rport=5060;branch=z9hG4bK5b72.621bba23d60b529f876b92bf2ab718de.0
Via: SIP/2.0/UDP 157.161.23.2;branch=z9hG4bK5b72.2d88c4e6630f19da5ae24efb523564bf.0
Via: SIP/2.0/UDP 157.161.10.230:5060;branch=z9hG4bK100567609d7e7e9517ddfb1eaa7d684c
Record-Route: <sips:157.161.23.249:5061;transport=tls;r2=on;lr;ftag=3944816274-1416360442>, <sips:157.161.23.249;r2=on;lr;ftag=3944816274-1416360442>, <sips:157.161.23.5;lr;ftag=3944816274-1416360442>, <sip:157.161.23.2;lr;ftag=3944816274-1416360442;did=e77.89e5>
[...]
Contact: "Somebody" <sips:315996608@157.161.4.237:5061>;+sip.instance="<urn:uuid:00000000-0000-1000-8000-00085D49FB42>"
```
Origin of call takes this Record-Route to create the source Route header for new PRACK transaction:
```
02.01.2025 15:17:54.393 +01:00: 157.161.10.230:5060 -> 157.161.23.2:5060
PRACK sips:315996608@157.161.4.237:5061 SIP/2.0
Max-Forwards: 66
Route: <sip:157.161.23.2;lr;ftag=3944816274-1416360442;did=e77.89e5>
Route: <sips:157.161.23.5;lr;ftag=3944816274-1416360442>
Route: <sips:157.161.23.249;r2=on;lr;ftag=3944816274-1416360442>
Route: <sips:157.161.23.249:5061;transport=tls;r2=on;lr;ftag=3944816274-1416360442>
RAck: 1 1 INVITE
```
According to this route set, the call shall be routed from 157.161.23.2 to 157.161.23.5 via 'sips'
This fails as there is no TLS socket bound between those two instances.
`prepare_new_uac(): can't fwd to af 2, proto 3 (no corresponding listening socket)`
IMHO the issue is caused by the wrong URI scheme (sips instead of sip) being used when the registrar is adding it's Record-Route header. (And maybe also by the SBC when adding the double (r2=on) RR to indicate the change of transport.
I suspect this happens, because the UAC has registered it's contact with the sips uri scheme.
Repeating the same situation with an UAC which registers a sip:user@domain:5061;transport=tls URI when using TLS demonstrates this works fine. It only happens when an UAC uses the sips URI scheme.
If any more information is required like a SIP trace of the issue, I am glad to provide it.
-Benoît-
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4092
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4092(a)github.com>
Hello all,
As in previous years, I'm organising the VoIP dinner for FOSDEM (1 Feb @
19:00)
However unlike previous years (since the restaurant got upset about
splitting the bill 30 ways). I will ask everyone to order their meal and
pay in advance. (and I will pay the bill to the restaurant with my card)
If you are wanting to attend the dinner please fill out the following form
and follow the instructions for payment.
https://form.jotform.com/250012543310033
Contact details are also in the form if you want to reach out to me with
any further questions.
Kind regards
Torrey
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio…
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.o…
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
Note that an issue report may be closed automatically after about 2 months
if there is no interest from developers or community users on pursuing it, being
considered expired. In such case, it can be reopened by writing a comment that includes
the token `/notexpired`. About two weeks before considered expired, the issue is
marked with the label `stale`, trying to notify the submitter and everyone else
that might be interested in it. To remove the label `stale`, write a comment that
includes the token `/notstale`. Also, any comment postpone the `expire` timeline,
being considered that there is interest in pursuing the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
When starting Kam inside a docker container and the `auto_bind_ipv6` option is enabled, kam fails to start, see below for error logs.
Instead, inside the very same container, by executing it from a shell, it works. The difference is that starting from the entrypoint kam has pid 1, while starting from a shell as a different pid.
### Troubleshooting
#### Reproduction
Start kamailio inside a docker container,with network=host and the `auto_bind_ipv6` option enabled.
#### Log Messages
<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
2025-01-02T15:58:29.655278523Z 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: lo Fam: 2 Flg: 10049 Adr: 127.0.0.1
2025-01-02T15:58:29.655282371Z 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: eth0 Fam: 2 Flg: 11043 Adr: 188.34.182.80
2025-01-02T15:58:29.655286664Z 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: docker0 Fam: 2 Flg: 1003 Adr: 172.17.0.1
2025-01-02T15:58:29.655290864Z 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: br-1653739d678f Fam: 2 Flg: 11043 Adr: 172.18.0.1
2025-01-02T15:58:29.655295002Z 0(1) DEBUG: <core> [core/socket_info.c:1764]: add_interfaces(): If: br-kamnet Fam: 2 Flg: 11043 Adr: 172.23.42.1
2025-01-02T15:58:29.655299578Z 0(1) ERROR: <core> [core/socket_info.c:1349]: nl_bound_sock(): could not bind NETLINK sock to sockaddr_nl
2025-01-02T15:58:29.655303602Z 0(1) ERROR: <core> [core/socket_info.c:1666]: add_interfaces_via_netlink(): Could not get network interface list
2025-01-02T15:58:29.655482917Z 0(1) ERROR: <core> [core/socket_info.c:1789]: fix_hostname(): could not resolve 'matteo-ord-devel'
2025-01-02T15:58:29.655515080Z 0(1) ERROR: <core> [core/socket_info.c:2392]: fix_all_socket_lists(): fix_socket_list udp failed
2025-01-02T15:58:29.655519918Z failed to initialize list addresses
```
### Possible Solutions
I think that it boils down to the function [nl_bound_sock](https://github.com/kamailio/kamailio/blob/master/src/core/so… function, which sets the netlink struct Port ID with `getpid()` ( https://github.com/kamailio/kamailio/blob/master/src/core/socket_info.c#L13… ).
For some reason this does not work when kam is forking from pid 1.
According to [man 7 netlink](https://man7.org/linux/man-pages/man7/netlink.7.html) should be safe to set that pid to 0, and let the kernel assign one, since if assigned from the process, it must guarantee that is unique if when multiple sockets are requested.
I've tried to set that port id to `0` and works correctly:
```diff
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 2557a83b1e..662a3741c2 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1343,7 +1343,7 @@ static int nl_bound_sock(void)
bzero(&la, sizeof(la));
la.nl_family = AF_NETLINK;
la.nl_pad = 0;
- la.nl_pid = getpid();
+ la.nl_pid = 0;
la.nl_groups = 0;
if(bind(sock, (struct sockaddr *)&la, sizeof(la)) < 0) {
LM_ERR("could not bind NETLINK sock to sockaddr_nl\n");
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
5.8.4
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `lsb_release -a` and `uname -a`)
-->
Docker container based on ubuntu noble.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4094
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4094(a)github.com>
Creating an empty file `src/modules/topos_htable/README` allows the installation to complete without errors.
```
$ ninja install
[..]
CMake Error at src/modules/cmake_install.cmake:1588 (file):
file INSTALL cannot find
"/usr/src/kamailio/src/modules/topos_htable/README":
No such file or directory.
Call Stack (most recent call first):
src/cmake_install.cmake:96 (include)
cmake_install.cmake:47 (include)
FAILED: CMakeFiles/install.util
cd /usr/src/kamailio/build && /usr/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
$ touch ../src/modules/topos_htable/README && ninja install && echo $?
[..]
0
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4095
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4095(a)github.com>
Module: kamailio
Branch: master
Commit: fc182198c7182759cc2c10b4afa3569336a438c9
URL: https://github.com/kamailio/kamailio/commit/fc182198c7182759cc2c10b4afa3569…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2025-01-03T12:02:21+01:00
presence_dfks: added README file
- initial import, it is going to be autmatically generated from now on
---
Added: src/modules/presence_dfks/README
---
Diff: https://github.com/kamailio/kamailio/commit/fc182198c7182759cc2c10b4afa3569…
Patch: https://github.com/kamailio/kamailio/commit/fc182198c7182759cc2c10b4afa3569…
---
diff --git a/src/modules/presence_dfks/README b/src/modules/presence_dfks/README
new file mode 100644
index 00000000000..d965a6e4c6a
--- /dev/null
+++ b/src/modules/presence_dfks/README
@@ -0,0 +1,78 @@
+presence_dfks Module
+
+Maja Stanislawska
+
+ <maja.stanislawska(a)yahoo.com>
+
+Victor Seva
+
+ Sipwise GmbH
+ <vseva(a)sipwise.com>
+
+Edited by
+
+Victor Seva
+
+ Sipwise GmbH
+ <vseva(a)sipwise.com>
+
+ Copyright �� 2014 Maja Stanislawska
+
+ Copyright �� 2024 Victor Seva
+ __________________________________________________________________
+
+ Table of Contents
+
+ 1. Admin Guide
+
+ 1. Overview
+ 2. Dependencies
+
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
+
+ 3. Parameters
+
+Chapter 1. Admin Guide
+
+ Table of Contents
+
+ 1. Overview
+ 2. Dependencies
+
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
+
+ 3. Parameters
+
+1. Overview
+
+ This module for handling as-feature-event presence messages Provides
+ support for 'Device FeatureKey Synchronization', as described in
+ http://community.polycom.com/polycom/attachments/polycom/VoIP/2233/1/De
+ viceFeatureKeySynchronizationFD.pdf This 'protocol' was developed at
+ Broadsoft, and is used in Linksys/Cisco and Polycom phones and probably
+ some other too. It allows to set up features like dnd (No Not Disturb)
+ and call forwarding using phone interface and have that status updated
+ on aplication server/ proxy or otherway, set those features on
+ aplication server using some gui, and have this data provisioned on
+ phone. For Shared Line Appreance application this let You share status
+ on all phones.
+
+2. Dependencies
+
+ 2.1. Kamailio Modules
+ 2.2. External Libraries or Applications
+
+2.1. Kamailio Modules
+
+ The following modules must be loaded before this module:
+ * sl. presence. pua.
+
+2.2. External Libraries or Applications
+
+ The following libraries or applications must be installed before
+ running Kamailio with this module loaded:
+ * libxml2 - xml handling library.
+
+3. Parameters
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio…
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.o…
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
Note that an issue report may be closed automatically after about 2 months
if there is no interest from developers or community users on pursuing it, being
considered expired. In such case, it can be reopened by writing a comment that includes
the token `/notexpired`. About two weeks before considered expired, the issue is
marked with the label `stale`, trying to notify the submitter and everyone else
that might be interested in it. To remove the label `stale`, write a comment that
includes the token `/notstale`. Also, any comment postpone the `expire` timeline,
being considered that there is interest in pursuing the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
We are plotting the call success rate on each of our proxies.
Using the Kamailio snmpstats module, we try to obtain three counters in order to plot them on a graph:
- Total Calls
- Active Calls
- Error Calls
Most of the time, everything works well and we obtain sensible values:
`snmpwalk -c mycommunity -v 2c W.X.Y.Z 1.3.6.1.4.1.34352.3.1.3.1.3.2 -O n`
> .1.3.6.1.4.1.34352.3.1.3.1.3.2.1.0 = Gauge32: 309 -> Total Calls
.1.3.6.1.4.1.34352.3.1.3.1.3.2.2.0 = Gauge32: 95 -> Active Calls
.1.3.6.1.4.1.34352.3.1.3.1.3.2.3.0 = Gauge32: 214 -> Error calls
However, **when our proxies are facing intense peaks of failed calls in a short timespan**, sometimes, the **"Error Calls"** counter returns a value **higher than "Total Calls"**. As a result, **"Active Calls"** suddenly reaches a value close to the **maximum of a _Gauge32_** (because ${TotalCalls} - {ErrorCalls} < 0$).
`snmpwalk -c mycommunity -v 2c W.X.Y.Z 1.3.6.1.4.1.34352.3.1.3.1.3.2 -O n`
> .1.3.6.1.4.1.34352.3.1.3.1.3.2.1.0 = Gauge32: 153 -> Total Calls
.1.3.6.1.4.1.34352.3.1.3.1.3.2.2.0 = Gauge32: 4294967226 -> Active Calls
.1.3.6.1.4.1.34352.3.1.3.1.3.2.3.0 = Gauge32: 223 -> Error calls
As a result, our graphs make no more sense.
### Troubleshooting
There seems to be a bug causing Total calls to be lower than Error calls when a high number of failed calls are received in a short time window.
Moreover, there is an integer overflow resulting to the negative result of the substraction being converted to a _Gauge32_. Maybe setting it to 0 in case of a negative result would be safer ?
#### Reproduction
Using the following configuration for the snmpstats module of your Kamailio proxy:
```
# -------- snmpstats params -------
modparam("snmpstats", "snmpgetPath", "/usr/bin/")
modparam("snmpstats", "snmpCommunity", "mycommunity")
modparam("snmpstats", "sipEntityType", "proxyServer")
```
On intense peaks of failed calls, get the call success metrics using `snmpwalk` :
`snmpwalk -c mycommunity -v 2c W.X.Y.Z 1.3.6.1.4.1.34352.3.1.3.1.3.2 -O n`
> .1.3.6.1.4.1.34352.3.1.3.1.3.2.1.0 = Gauge32: 153 -> Total Calls
.1.3.6.1.4.1.34352.3.1.3.1.3.2.2.0 = Gauge32: 4294967226 -> Active Calls
.1.3.6.1.4.1.34352.3.1.3.1.3.2.3.0 = Gauge32: 223-> Error calls
### Additional Information
**Kamailio Version**:
`kamailio -v`
> version: kamailio 5.6.4 (x86_64/linux) a004cf
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_S R_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, U SE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SI ZE 65535, DEFAULT PKG_SIZE 64MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: a004cf
compiled on 16:10:41 May 22 2023 with gcc 4.4.7
* **Operating System**:
`uname -r`
> 2.6.32-279.el6.x86_64
`lsb_release -a`
> LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.3 (Santiago)
Release: 6.3
Codename: Santiago
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4006
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4006(a)github.com>
#### 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
- [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:
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Fixes an issue where setting the ``$rU`` for a SIPS R-URI containing ``user=phone`` would overwrite the scheme to ``sip``.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4093
-- Commit Summary --
* core: parser - set URI type to TELS_URI_T for user=phone SIPS R-URI
-- File Changes --
M src/core/parser/parse_uri.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4093.patchhttps://github.com/kamailio/kamailio/pull/4093.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4093
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4093(a)github.com>