### Description
Currently the rtpengine_query function stores some values in predefined avps. I would like to have access to the whole output returned by the query to rtpengine. Sample provided at: https://github.com/sipwise/rtpengine#query-message
### Possible Solutions / Expected behavior
Introduce a new avp which stores the full output in json format.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2130
Hello all,
I've come across the following issue with topos on Kamailio 5.1.0-rc2.
### Description
Kamailio acts as a proxy for asterisk instances residing in a private IP range. Asterisk's peers are configured with their public IP address or hostname, but asterisk will dispatch requests to them to kamailio instead (because kamailio's IP is set in outboundproxy option in peer definition).
This works fine for INVITEs, but if qualify=yes is set for the peer, asterisk will send out OPTIONs to monitor these peers. If the topos module is loaded, 200 OK replies to these OPTIONs will be malformed when forwarded from kamailio to asterisk (no Via header present). Disabling the topos module will resolve this.
### Troubleshooting
#### Reproduction
Configure a peer in asterisk with outboundproxy option set to kamailio's IP address. Set qualify=yes.
Adjust kamailio's default configuration so that OPTIONs to other hosts besides itself are routed. Change the following section in request_route:
```
if ($rU==$null) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
```
to:
```
if ( ($rU==$null) && !(is_method("OPTIONS")) ) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# Permit asterisk's monitoring using options
if(is_method("OPTIONS") && uri!=myself) {
route(RELAY);
}
```
Enable and configure the topos module with database.
#### SIP Traffic
asterisk:5060 -> kamailio:5060
```
OPTIONS sip:peer.domain.tld SIP/2.0
Via: SIP/2.0/UDP asterisk:5060;branch=z9hG4bK460330cf;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>
Contact: <sip:asterisk@asterisk:5060>
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
User-Agent: myUA
Date: Sun, 03 Dec 2017 00:39:38 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
```
kamailio:5060 -> peer:5060
```
OPTIONS sip:peer.domain.tld SIP/2.0
Via: SIP/2.0/UDP kamailio:5060;branch=z9hG4bK460330cf;rport
Max-Forwards: 69
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>
Contact: <sip:asterisk@asterisk:5060>
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
User-Agent: myUA
Date: Sun, 03 Dec 2017 00:39:38 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
```
peer:5060 -> kamailio:5060
```
SIP/2.0 200 OK
Via: SIP/2.0/UDP kamailio;branch=z9hG4bKda8d.cc03bd2def8ad36e8c43f61ab31a636f.0;received=kamailio;rport=5060
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>;tag=as472874ee
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
Server: myUA
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:peer:5060>
Accept: application/sdp
Content-Length: 0
```
**kamailio:5060 -> asterisk:5060: Missing Via Header**
```
SIP/2.0 200 OK
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>;tag=as472874ee
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
Server: myUA
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:peer:5060>
Accept: application/sdp
Content-Length: 0
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.1.0-rc2 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, 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_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 6.3.0
```
* **Operating System**:
```
Debian 9.1
```
* **Other pertinent configuration information**:
This kamailio box has several network interfaces. mhomed is not used, instead force_send_socket is called where necessary. I'm mentioning this in case it's what might trigger this issue with topos.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1350
### Description
Example 1.21. kazoo_publish usage
contains string
```
$var(amqp_payload_request) = "{'Event-Category' : 'directory', 'Event-Name' : 'reg_success', 'Contact' : '" + $var(fs_contact) + "', 'Call-ID' : '" + $ci + "', 'Realm' : '" + $fd +"', 'Username' : '" + $fU + "', 'From-User' : '" + $fU + "', 'From-Host' : '" + $fd + "', 'To-User' : '" + $tU +"', 'To-Host' : '" + $td + "', 'User-Agent' : '" + $ua +"' ," + $var(register_contants)+ " }";
```
This example did not work because the string generates broken JSON:
1. here present value ` $var(register_contants)` but key is not present
2. JSON key and value must be started and terminated by `"` symbol (not by `'`)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2627
The db_redis module seems to only support connecting with a single redis instance. It is not evident from the documentation if it implements support for native redis cluster by honouring 'MOVED' replies.
ndb_redis seems to have support for native redis clusters, and supports both automatic (see allow_dynamic_nodes parameter of ndb_redis) and manual configuration of redis nodes.
Since both modules are based on the hiredis library, is it safe to assume this support could be easily implemented, with some code sharing between the two modules perhaps?
If db_redis supports clusters with automatic configuration only (by processing MOVED replies), perhaps the module's documentation should be updated to reflect that.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1997
<!-- 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)
- [ ] 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
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Removed not used variable "route_mode" in the tm module. This was discovered by @IvanRibakov when using a g++ compiler, which added more strict flags (Ivan's Github is [here](https://github.com/IvanRibakov))
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2406
-- Commit Summary --
* tm - remove not used route_mode var
-- File Changes --
M src/modules/tm/tm_load.h (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2406.patchhttps://github.com/kamailio/kamailio/pull/2406.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2406
### Description
<!--
On every startup of Kamailio I'm getting an error im my Log when Kamailio is going to load the globalblacklist table from MySQL Database
I tested this with version 5.4.1 build from git source.
With version 5.3.6 there are no errors like this. I diffed the source of userblacklist.c and saw some changes in the code. So there may be a bug.
-->
### Troubleshooting
#### Reproduction
<!--
Create a simple config an use check_blacklist()
Use db_mysql as database backend
-->
#### Debugging Data
#### Log Messages
```
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: <core> [core/route.c:885]: fix_actions(): fixing check_blacklist()
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: userblacklist [userblacklist.c:472]: add_source(): add table globalblacklist
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: <core> [dtrie.c:57]: dtrie_init(): allocate 16 bytes for root at 0x7fc29efa4ab0
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: <core> [dtrie.c:67]: dtrie_init(): allocate 80 bytes for 10 root children pointer at 0x7fc29efa4b28
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: ERROR: <core> [db.c:481]: db_use_table(): invalid parameter value
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: ERROR: userblacklist [db.c:123]: db_reload_source(): cannot use db table 'globalblacklist'
Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: ERROR: userblacklist [userblacklist.c:425]: load_source(): cannot load source from 'globalblacklist'
```
### Additional Information
```
Kamailio 5.4.1
```
* **Operating System**:
```
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Linux voip-lab-proxy03 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2480
### Description
According to design logic HELD request need to send a carrier LIS server. Now lost module sends this request to the preconfigured server via `http_client/httpcon` param.
I prefer to use dynamic LIS server discovery according to [rfc7216#section-4](https://tools.ietf.org/html/rfc7216#section-4) and [rfc5986#section-4](https://tools.ietf.org/html/rfc5986#section-4).
So dynamic LIS discovery works as:
1. Kamailio send reverse `.in-addr.arpa.` or `.ip6.arpa.` DNS request and caller host DNS name;
2. Kamailio send `LIS:HELD` NAPTR request for a resolved caller hostname and LIS server.
3. Kamailio send HELD request for resolved LIS address.
So do get working dynamic LIS discovery required to implement two DNS requests.
If any DNS request will fail, then `lost_held_query` function returns an error code.
To define required dynamic LIS discovery I suggest use an empty string ("") or NULL value ($null) as the first ("con") function param.
This feature request for discussion with lost module author (Wolfgang Kampichler @wkampich) and other interest devs.
The ticket may be closed at any time.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2574
### Description
According [RFC5985](https://tools.ietf.org/html/rfc5985)
> The POST method is the only method REQUIRED for HELD. If a LIS
chooses to support GET or HEAD, it SHOULD consider the kind of
application doing the GET.
So not all LIS servers support the GET method and only the POST method always present.
Also [rfc6753#section-3.2](https://tools.ietf.org/html/rfc6753#section-3.2)
> An HTTP GET request to a HELD URI produces a HELD response as if the
following HELD request had been sent using HTTP POST:
<locationRequest xmlns="urn:ietf:params:xml:ns:geopriv:held">
<locationType exact="false">
geodetic civic
</locationType>
</locationRequest>
### Expected behavior
Dereference Geolocation URLs using POST method with content according [rfc6753#section-3.2](https://tools.ietf.org/html/rfc6753#section-3.2)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2641
**Description**
facing crashes the server, raised by qm_debug_check_frag().
**Troubleshooting**
The error message:
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbdc31f360, fd 31166
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbcbf232a8, fd 31326
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbd990b9e8, fd 31327
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbd89cd1d8, fd 31360
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbcf0bab28, fd 31434
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbc6e031b0, fd 31471
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbdb7fd598, fd 31472
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbdeb334c8, fd 31494
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbddee6de8, fd 31524
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbdb91ef70, fd 31576
Jan 23 12:27:26 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: ERROR: <core> [core/tcp_main.c:4451]: handle_tcpconn_ev(): io_watch_del(3) failed: for 0x7fdbc76a1da8, fd 31690
Jan 23 12:27:31 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: CRITICAL: <core> [core/io_wait.h:596]: io_watch_del(): invalid fd 31327, not in [0, 2054)
Jan 23 12:27:31 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: CRITICAL: <core> [core/io_wait.h:596]: io_watch_del(): invalid fd 31360, not in [0, 2054)
Jan 23 12:27:31 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2893]: CRITICAL: <core> [core/io_wait.h:596]: io_watch_del(): invalid fd 31434, not in [0, 2054)
Jan 23 12:28:09 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2809]: ALERT: <core> [main.c:777]: handle_sigs(): child process 2858 exited by a signal 6
Jan 23 12:28:09 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2809]: ALERT: <core> [main.c:780]: handle_sigs(): core was generated
Jan 23 12:28:09 fep-1 /usr/local/fep-kamailio/sbin/kamailio[2809]: CRITICAL: <core> [core/mem/q_malloc.c:138]: qm_debug_check_frag(): BUG: qm: fragm. 0x7fdbd7e8a0e8 (address 0x7fdbd7e8a120) end overwritten (5fd4cd2e, abcdefed)! Memory allocator was called from core: core/usr_avp.c:626. Fragment marked by core: core/usr_avp.c:175. Exec from core/mem/q_malloc.c:511.
The output from GDB:
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/fep-kamailio/sbin/kamailio...done.
[New LWP 2809]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/local/fep-kamailio/sbin/kamailio -f /usr/local/fep-kamailio/etc/kamailio/k'.
Program terminated with signal 6, Aborted.
#0 0x00007fde7acbf277 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-21.el7.x86_64 glibc-2.17-222.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-19.el7.x86_64 libcom_err-1.42.9-12.el7_5.x86_64 libcurl-7.29.0-54.el7.x86_64 libgcc-4.8.5-36.el7_6.1.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-12.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64 libstdc++-4.8.5-36.el7_6.1.x86_64 libunistring-0.9.3-9.el7.x86_64 nspr-4.21.0-1.el7.x86_64 nss-3.44.0-4.el7.x86_64 nss-softokn-freebl-3.44.0-5.el7.x86_64 nss-util-3.44.0-3.el7.x86_64 openldap-2.4.44-5.el7.x86_64 openssl-libs-1.0.2k-12.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-17.el7.x86_64
(gdb) bt
#0 0x00007fde7acbf277 in raise () from /lib64/libc.so.6
#1 0x00007fde7acc0968 in abort () from /lib64/libc.so.6
#2 0x00000000006d7c95 in qm_debug_check_frag (qm=0x7fdbc25ae000, f=0x7fdbd7e8a0e8, file=0x817155 "core: core/usr_avp.c", line=626, efile=0x83f7c5 "core/mem/q_malloc.c", eline=511) at core/mem/q_malloc.c:140
#3 0x00000000006db99e in qm_free (qmp=0x7fdbc25ae000, p=0x7fdbd7e8a120, file=0x817155 "core: core/usr_avp.c", func=0x8189a0 <__FUNCTION__.8526> "destroy_avp_list_unsafe", line=626, mname=0x817150 "core") at core/mem/q_malloc.c:511
#4 0x00000000005e7ede in destroy_avp_list_unsafe (list=0x7fdbd7e8a950) at core/usr_avp.c:626
#5 0x00007fde38d4bd8f in free_cell_helper (dead_cell=0x7fdbd7e8a750, silent=1, fname=0x7fde38e4267f "h_table.c", fline=466) at h_table.c:255
#6 0x00007fde38d4c9e1 in free_hash_table () at h_table.c:466
#7 0x00007fde38df9cd0 in tm_shutdown () at t_funcs.c:88
#8 0x0000000000581960 in destroy_modules () at core/sr_module.c:746
#9 0x000000000041cda7 in cleanup (show_status=1) at main.c:563
#10 0x000000000041e682 in shutdown_children (sig=15, show_status=1) at main.c:706
#11 0x0000000000421715 in handle_sigs () at main.c:806
#12 0x000000000042b9a7 in main_loop () at main.c:1817
#13 0x0000000000433b96 in main (argc=9, argv=0x7ffea05cd2c8) at main.c:2856
(gdb) bt full
#0 0x00007fde7acbf277 in raise () from /lib64/libc.so.6
No symbol table info available.
#1 0x00007fde7acc0968 in abort () from /lib64/libc.so.6
No symbol table info available.
#2 0x00000000006d7c95 in qm_debug_check_frag (qm=0x7fdbc25ae000, f=0x7fdbd7e8a0e8, file=0x817155 "core: core/usr_avp.c", line=626, efile=0x83f7c5 "core/mem/q_malloc.c", eline=511) at core/mem/q_malloc.c:140
p = 0x7ffea05cc3b0
__FUNCTION__ = "qm_debug_check_frag"
#3 0x00000000006db99e in qm_free (qmp=0x7fdbc25ae000, p=0x7fdbd7e8a120, file=0x817155 "core: core/usr_avp.c", func=0x8189a0 <__FUNCTION__.8526> "destroy_avp_list_unsafe", line=626, mname=0x817150 "core") at core/mem/q_malloc.c:511
qm = 0x7fdbc25ae000
f = 0x7fdbd7e8a0e8
size = 408
next = 0x7fdbd7e8a5c8
prev = 0x7fdbd7e8a1d8
__FUNCTION__ = "qm_free"
#4 0x00000000005e7ede in destroy_avp_list_unsafe (list=0x7fdbd7e8a950) at core/usr_avp.c:626
avp = 0x7fdbd7e8a080
foo = 0x7fdbd7e8a120
__FUNCTION__ = "destroy_avp_list_unsafe"
#5 0x00007fde38d4bd8f in free_cell_helper (dead_cell=0x7fdbd7e8a750, silent=1, fname=0x7fde38e4267f "h_table.c", fline=466) at h_table.c:255
b = 0x0
i = 1
rpl = 0x0
tt = 0x0
foo = 0x7fde34a5df80 <__FUNCTION__.7259>
cbs = 0x0
cbs_tmp = 0x7fde388fe570
__FUNCTION__ = "free_cell_helper"
#6 0x00007fde38d4c9e1 in free_hash_table () at h_table.c:466
p_cell = 0x7fdbd7e8a750
tmp_cell = 0x7fdbc27e3060
i = 40845
__FUNCTION__ = "free_hash_table"
#7 0x00007fde38df9cd0 in tm_shutdown () at t_funcs.c:88
__FUNCTION__ = "tm_shutdown"
#8 0x0000000000581960 in destroy_modules () at core/sr_module.c:746
t = 0x7fde3c51e4c0
foo = 0x7fde3c51e020
__FUNCTION__ = "destroy_modules"
#9 0x000000000041cda7 in cleanup (show_status=1) at main.c:563
memlog = 0
__FUNCTION__ = "cleanup"
#10 0x000000000041e682 in shutdown_children (sig=15, show_status=1) at main.c:706
__FUNCTION__ = "shutdown_children"
#11 0x0000000000421715 in handle_sigs () at main.c:806
chld = 0
chld_status = 134
any_chld_stopped = 1
memlog = -1027733624
__FUNCTION__ = "handle_sigs"
#12 0x000000000042b9a7 in main_loop () at main.c:1817
i = 10
pid = 2893
si = 0x0
si_desc = "udp receiver child=9 sock=10.50.7.18:5060\000:0:0:1]:5060\000:5060)\000\000\000\004\000\000\000\000\000\000\000\000\340Z\302\333\177\000\000\000\000\000\000\000\000\000\000 \006\276\302\333\177\000\000`\315\\\240\376\177\000\000\220\006\276\302\333\177\000\000r\fb3\336\177\000\000P\246\222<\336\177\000"
nrprocs = 10
woneinit = 1
__FUNCTION__ = "main_loop"
#13 0x0000000000433b96 in main (argc=9, argv=0x7ffea05cd2c8) at main.c:2856
**Additional Information**
Kamailio Version - output of Kamailio -v
version: kamailio 5.4.2 (x86_64/linux) f8885c
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_BLACKLIST, HAVE_RESOLV_RES
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: f8885c
compiled on 04:30:53 Dec 16 2020 with gcc 4.8.5
**Operating System:**
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
**Note:**
It looks similar to the following issue
https://github.com/kamailio/kamailio/issues/2503
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2607
### Description
DNS core resolver fails in returning a valid IP when there are too many SRV results in the DNS reply.
It acts like if no records were found, so request is not relayed and a 478 reply is generated instead (in the example of a DNS name in $ru or $du).
### Troubleshooting
#### Reproduction
It is easy to reproduce with DNS failover + NAPTR enabled (cf parameters used far below)
and with such DNS records:
```
# dig +short NAPTR ko.sip.provider.com
50 30 "S" "SIP+D2U" "" _sip._udp.ko.sip.provider.com.
# dig +short SRV _sip._udp.ko.sip.provider.com.
10 10 5060 endpoint-01.k0.sip.provider.com.
10 10 5060 endpoint-02.k0.sip.provider.com.
10 10 5060 endpoint-03.k0.sip.provider.com.
10 10 5060 endpoint-04.k0.sip.provider.com.
10 10 5060 endpoint-05.k0.sip.provider.com.
10 10 5060 endpoint-06.k0.sip.provider.com.
10 10 5060 endpoint-07.k0.sip.provider.com.
10 10 5060 endpoint-08.k0.sip.provider.com.
10 10 5060 endpoint-09.k0.sip.provider.com.
# Each SRV result above has a corresponding
# 'A' record so that command below gives a correct IP:
# dig +short A endpoint-01.k0.sip.provider.com.
```
To reproduce, relay a request towards it, like:
`$du="sip:ko.sip.provider.com"`
#### Debugging data
One interesting thing is that Kamailio behaves exactly the same as the `sip-dig` tool.
But `sip-dig` seems to be limited on the DNS reply size it can handle (cf my comment below about the RFC).
Does Kamailio have this same kind of limitation regarding DNS resolution?
#### Log Messages
##### Failure example: with 9 SRV records
```
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (ko.sip.provider.com(26), 35), h=275
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff6a20f0000, 0x7ff6a27777d8), called from core: core/dns_cache.c: dns_destroy_entry(151)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff6a27777a0 alloc'ed from core: core/dns_cache.c: dns_cache_mk_rd_entry(1110)
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 58) called from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 64) returns address 0x7ff72363d8f8 frag. 0x7ff72363d8c0 (size=64) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 92) called from core: core/resolve.c: dns_naptr_parser(405)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 96) returns address 0x7ff72363d9a0 frag. 0x7ff72363d968 (size=96) on 1 -th hit
DEBUG: <core> [core/resolve.c:984]: get_record(): skipping 0 NS (p=0x558fb300dba7, end=0x558fb300dba7)
DEBUG: <core> [core/resolve.c:997]: get_record(): parsing 0 ARs (p=0x558fb300dba7, end=0x558fb300dba7)
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 216) called from core: core/dns_cache.c: dns_cache_mk_rd_entry(1110)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 216) returns address 0x7ff6a27748a8 frag. 0x7ff6a2774870 (size=232) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff72363d9a0), called from core: core/resolve.c: free_rdata_list(678)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff72363d968 alloc'ed from core: core/resolve.c: dns_naptr_parser(405)
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff72363d8f8), called from core: core/resolve.c: free_rdata_list(679)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff72363d8c0 alloc'ed from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/dns_cache.c:1633]: dns_get_related(): (0x7ff6a27748a8 (ko.sip.provider.com, 35), 35, *(nil)) (0)
DEBUG: <core> [core/dns_cache.c:739]: dns_cache_add_unsafe(): adding ko.sip.provider.com(26) 35 (flags=0) at 275
DEBUG: <core> [core/dns_cache.c:2614]: dns_naptr_sip_iterate(): found a valid sip NAPTR rr _sip._udp.ko.sip.provider.com, proto 1
DEBUG: <core> [core/resolve.c:1182]: naptr_choose(): o:-1 w:-1 p:0, o:50 w:30 p:1
DEBUG: <core> [core/resolve.c:1197]: naptr_choose(): changed
DEBUG: <core> [core/dns_cache.c:2625]: dns_naptr_sip_iterate(): choosed NAPTR rr _sip._udp.ko.sip.provider.com, proto 1 tried: 0x0
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (_sip._udp.ko.sip.provider.com(36), 33), h=989
DEBUG: <core> [core/dns_cache.c:3041]: dns_srv_resolve_ip(): ("_sip._udp.ko.sip.provider.com", 0, 0), ret=-5, ip=
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (_sip._udp.ko.sip.provider.com(36), 33), h=989
DEBUG: <core> [core/dns_cache.c:3041]: dns_srv_resolve_ip(): ("_sip._udp.ko.sip.provider.com", 0, 0), ret=-5, ip=
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (_sip._tcp.ko.sip.provider.com(36), 33), h=772
DEBUG: <core> [core/dns_cache.c:3041]: dns_srv_resolve_ip(): ("_sip._tcp.ko.sip.provider.com", 0, 0), ret=-5, ip=
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (_sips._tcp.ko.sip.provider.com(37), 33), h=786
DEBUG: <core> [core/dns_cache.c:3041]: dns_srv_resolve_ip(): ("_sips._tcp.ko.sip.provider.com", 0, 0), ret=-5, ip=
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (ko.sip.provider.com(26), 1), h=275
DEBUG: <core> [core/dns_cache.c:2803]: dns_a_resolve(): (ko.sip.provider.com, 0) returning -7
DEBUG: <core> [core/dns_cache.c:3167]: dns_srv_sip_resolve(): (ko.sip.provider.com, 0, 0), ip, ret=-7
ERROR: tm [ut.h:284]: uri2dst2(): failed to resolve "ko.sip.provider.com" :unresolvable A or AAAA request (-7)
```
##### Comparison with a working example (only 3 SRV records)
```
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (ok.sip.provider.com(26), 35), h=275
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 58) called from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 64) returns address 0x7ff723613ff8 frag. 0x7ff723613fc0 (size=64) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 92) called from core: core/resolve.c: dns_naptr_parser(405)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 96) returns address 0x7ff7236140a0 frag. 0x7ff723614068 (size=96) on 1 -th hit
DEBUG: <core> [core/resolve.c:984]: get_record(): skipping 0 NS (p=0x558fb300dba7, end=0x558fb300dba7)
DEBUG: <core> [core/resolve.c:997]: get_record(): parsing 0 ARs (p=0x558fb300dba7, end=0x558fb300dba7)
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 216) called from core: core/dns_cache.c: dns_cache_mk_rd_entry(1110)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 216) returns address 0x7ff6a27755b8 frag. 0x7ff6a2775580 (size=376) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff7236140a0), called from core: core/resolve.c: free_rdata_list(678)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff723614068 alloc'ed from core: core/resolve.c: dns_naptr_parser(405)
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff723613ff8), called from core: core/resolve.c: free_rdata_list(679)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff723613fc0 alloc'ed from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/dns_cache.c:1633]: dns_get_related(): (0x7ff6a27755b8 (ok.sip.provider.com, 35), 35, *(nil)) (0)
DEBUG: <core> [core/dns_cache.c:739]: dns_cache_add_unsafe(): adding ok.sip.provider.com(26) 35 (flags=0) at 275
DEBUG: <core> [core/dns_cache.c:2614]: dns_naptr_sip_iterate(): found a valid sip NAPTR rr _sip._udp.ok.sip.provider.com, proto 1
DEBUG: <core> [core/resolve.c:1182]: naptr_choose(): o:-1 w:-1 p:0, o:50 w:30 p:1
DEBUG: <core> [core/resolve.c:1197]: naptr_choose(): changed
DEBUG: <core> [core/dns_cache.c:2625]: dns_naptr_sip_iterate(): choosed NAPTR rr _sip._udp.ok.sip.provider.com, proto 1 tried: 0x0
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (_sip._udp.ok.sip.provider.com(36), 33), h=989
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 68) called from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 72) returns address 0x7ff723613ff8 frag. 0x7ff723613fc0 (size=72) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 46) called from core: core/resolve.c: dns_srv_parser(318)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 48) returns address 0x7ff7236140a8 frag. 0x7ff723614070 (size=48) on 1 -th hit
DEBUG: <core> [core/resolve.c:984]: get_record(): skipping 0 NS (p=0x558fb300dbb4, end=0x558fb300dbb4)
DEBUG: <core> [core/resolve.c:997]: get_record(): parsing 0 ARs (p=0x558fb300dbb4, end=0x558fb300dbb4)
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 176) called from core: core/dns_cache.c: dns_cache_mk_rd_entry(1110)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 176) returns address 0x7ff6a2775900 frag. 0x7ff6a27758c8 (size=176) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff7236140a8), called from core: core/resolve.c: free_rdata_list(678)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff723614070 alloc'ed from core: core/resolve.c: dns_srv_parser(318)
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff723613ff8), called from core: core/resolve.c: free_rdata_list(679)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff723613fc0 alloc'ed from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/dns_cache.c:1633]: dns_get_related(): (0x7ff6a2775900 (_sip._udp.ok.sip.provider.com, 33), 33, *(nil)) (0)
DEBUG: <core> [core/dns_cache.c:739]: dns_cache_add_unsafe(): adding _sip._udp.ok.sip.provider.com(36) 33 (flags=0) at 989
DEBUG: <core> [core/dns_cache.c:2222]: dns_srv_get_nxt_rr(): (0x7ff6a2775900, 0, 0, 1457300027): selected 0/1 in grp. 0 (rand_w=0, rr=0x7ff6a2775968 rd=0x7ff6a2775980 p=10 w=10 rsum=10)
DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): (endpoint.ok.sip.provider.com(38), 1), h=530
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 70) called from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 72) returns address 0x7ff723613ff8 frag. 0x7ff723613fc0 (size=72) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff7234f4010, 4) called from core: core/resolve.c: dns_a_parser(474)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff7234f4010, 8) returns address 0x7ff7236140a8 frag. 0x7ff723614070 (size=8) on 1 -th hit
DEBUG: <core> [core/resolve.c:984]: get_record(): skipping 0 NS (p=0x558fb300db8e, end=0x558fb300db8e)
DEBUG: <core> [core/resolve.c:997]: get_record(): parsing 0 ARs (p=0x558fb300db8e, end=0x558fb300db8e)
DEBUG: <core> [core/mem/q_malloc.c:374]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 136) called from core: core/dns_cache.c: dns_cache_mk_rd_entry(1110)
DEBUG: <core> [core/mem/q_malloc.c:419]: qm_malloc(): qm_malloc(0x7ff6a20f0000, 136) returns address 0x7ff6a2775a18 frag. 0x7ff6a27759e0 (size=136) on 1 -th hit
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff7236140a8), called from core: core/resolve.c: free_rdata_list(678)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff723614070 alloc'ed from core: core/resolve.c: dns_a_parser(474)
DEBUG: <core> [core/mem/q_malloc.c:482]: qm_free(): qm_free(0x7ff7234f4010, 0x7ff723613ff8), called from core: core/resolve.c: free_rdata_list(679)
DEBUG: <core> [core/mem/q_malloc.c:526]: qm_free(): freeing frag. 0x7ff723613fc0 alloc'ed from core: core/resolve.c: get_record(862)
DEBUG: <core> [core/dns_cache.c:1633]: dns_get_related(): (0x7ff6a2775a18 (endpoint.ok.sip.provider.com, 1), 1, *(nil)) (0)
DEBUG: <core> [core/dns_cache.c:739]: dns_cache_add_unsafe(): adding endpoint.ok.sip.provider.com(38) 1 (flags=0) at 530
DEBUG: <core> [core/dns_cache.c:2803]: dns_a_resolve(): (endpoint.ok.sip.provider.com, 0) returning 0
DEBUG: <core> [core/dns_cache.c:3041]: dns_srv_resolve_ip(): ("_sip._udp.ok.sip.provider.com", 0, 0), ret=0, ip=[RESOLVED_IP]
DEBUG: <core> [core/dns_cache.c:3241]: dns_naptr_sip_resolve(): (ok.sip.provider.com, 0, 0), srv0, ret=0
```
### Possible Solutions
I had a quick look inside the code and did not find any limitation about a maximum number of records.
There are some max defined in `dns_cache.c` but I did not found a relation between them and my issue.
Could there be a limitation in result size? Here is what I got from my RFCs reading regarding that:
* Extract from **RFC 2782 DNS RR** (mentioned in RFC 3263 as being the RFC to follow for implementing DNS in SIP):
> Currently there's a practical limit of 512 bytes for DNS replies.
> Until all resolvers can handle larger responses, domain administrators are strongly advised to keep their SRV replies below 512 bytes.
There is a RFC about how to deal with truncated messages:
> If a truncated response comes back from an SRV query, the rules described in RFC 2181 (https://tools.ietf.org/html/rfc2181#page-11) shall apply.
### Additional Information
* **Kamailio Version** - kamailio 5.3.8
```
dns_try_naptr=yes
dns_tcp_pref = 1
dns_udp_pref = 1
dns_tls_pref = 1
dns_srv_lb=yes
use_dns_failover=yes
use_dns_cache=yes
dns_cache_max_ttl=30
```
* **Operating System**: Debian 9.13 on Docker
Thanks
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2651