Hello Daniel,
I’m using kamailio 5.7.2 currently and this misterious crash occurs again. Now core files are generated also, here is the trace:
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007fae9a2d0859 in __GI_abort () at abort.c:79
#2 0x00005614ad79afd8 in qm_debug_check_frag (qm=0x7fae78e77000, f=0x7fae79805028, file=0x7fae77c8c134 "uac: uac_send.c", line=860, efile=0x5614ad936f99 "core/mem/q_malloc.c", eline=511) at core/mem/q_malloc.c:129
#3 0x00005614ad79f7c1 in qm_free (qmp=0x7fae78e77000, p=0x7fae79805060, file=0x7fae77c8c134 "uac: uac_send.c", func=0x7fae77c8cf10 <__func__.15157> "uac_send_tm_callback", line=860, mname=0x7fae77c8c014 "uac") at core/mem/q_malloc.c:511
#4 0x00005614ad7ab410 in qm_shm_free (qmp=0x7fae78e77000, p=0x7fae79805060, file=0x7fae77c8c134 "uac: uac_send.c", func=0x7fae77c8cf10 <__func__.15157> "uac_send_tm_callback", line=860, mname=0x7fae77c8c014 "uac") at core/mem/q_malloc.c:1350
#5 0x00007fae77c3686b in uac_send_tm_callback (t=0x7fae797dcf40, type=131072, ps=0x7fff8bd990d0) at uac_send.c:860
#6 0x00007fae783abc27 in run_trans_callbacks_internal (cb_lst=0x7fae797dcfe8, type=131072, trans=0x7fae797dcf40, params=0x7fff8bd990d0) at t_hooks.c:241
#7 0x00007fae783abd1e in run_trans_callbacks (type=131072, trans=0x7fae797dcf40, req=0x0, rpl=0x0, code=0) at t_hooks.c:261
#8 0x00007fae782bd8cb in free_cell_helper (dead_cell=0x7fae797dcf40, silent=0, fname=0x7fae783e9f62 "timer.c", fline=653) at h_table.c:165
#9 0x00007fae7837649c in wait_handler (ti=724701450, wait_tl=0x7fae797dcff8, data=0x7fae797dcf40) at timer.c:653
#10 0x00005614ad50be68 in timer_list_expire (t=724701450, h=0x7fae78ef5d18, slow_l=0x7fae78ef95e0, slow_mark=33641) at core/timer.c:857
#11 0x00005614ad50c3a7 in timer_handler () at core/timer.c:922
#12 0x00005614ad50c8d5 in timer_main () at core/timer.c:961
#13 0x00005614ad45fbf3 in main_loop () at main.c:1833
#14 0x00005614ad46ae93 in main (argc=14, argv=0x7fff8bd99b48) at main.c:3086
I think it occurs only if $uac_req(evroute) is set to 1 and I define the event_route[uac:reply] route.
My uac_reply route is easy:
if ($uac_req(evcode)==200) {
xlog("L_INFO", "Registration for user $fU has been refreshed successfully.");
$sht(vtp=>asterisk_restarted) = $null;
route(SAVE_REG);
}
else {
xlog("L_INFO", "Registration failed: $uac_req(evcode)");
}
the SAVE_REG route is the following:
route[SAVE_REG] {
xlog("L_INFO", "Saving pbx registration...:$fU");
$var(maxExpiry) = MAX_PBX_REG_EXPIRY;
route(GET_CLIENT_ID);
sql_pvquery("ca", "select count(*) from pbxusers where user = '$fU'", "$var(pbxusersCnt)");
if ($var(pbxusersCnt)>0) {
if ($var(clientId) == 0) {
sql_query("ca", "update pbxusers set expiry = TIMESTAMPADD(SECOND, $var(maxExpiry), SYSDATE()), online=1 where user = '$fU'");
}
else {
sql_query("ca", "update pbxusers set client_id = '$var(clientId)', expiry = TIMESTAMPADD(SECOND, $var(maxExpiry), SYSDATE()), online=1 where user = '$fU'");
}
}
else {
sql_query("ca", "insert into pbxusers (user, expiry, client_id, online) values ('$fU', TIMESTAMPADD(SECOND, $var(maxExpiry), SYSDATE()), '$var(clientId)', 0)");
}
}
And GET_CLIENT_ID route is:
route[GET_CLIENT_ID] {
$var(clientId) = 0;
if (is_present_hf("X-AT-ClientId")) {
$var(clientId) = $hdr(X-AT-ClientId);
}
}
Any idea, is it a bug or I do something wrong in config files?
Peter
From: Dr. Barabás Péter via sr-users <sr-users(a)lists.kamailio.org>
Date: Sunday, 2023. October 8. 18:49
To: miconda(a)gmail.com <miconda(a)gmail.com>, Kamailio (SER) - Users Mailing List <sr-users(a)lists.kamailio.org>
Cc: Dr. Barabás Péter <dr.peter.barabas(a)gmail.com>
Subject: [SR-Users] Re: uac_req_send + evroute + crash
Hello Daniel,
I do not see any “failed to send request with authentication”.
The next CRITICAL log appears after calling uac_req_send():
CRITICAL: <core> [core/mem/q_malloc.c:519]: qm_free(): BUG: freeing already freed pointer (0x7f114995ada8), called from uac: uac_send.c: uac_send_tm_callback(860), first free uac: uac_send.c: uac_resend_tm_callback(732) - ignoring
Now we use kamailio 5.7.2 and no crash has come, but the critical logs above exist.
I saw a ticket in github: https://github.com/kamailio/kamailio/issues/3522, may the crash be similar or the same to that?
I will make a try next week with downgrading to 5.6.2 and try to reproduce the crash.
Peter
From: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Friday, 2023. October 6. 13:55
To: Dr. Barabás Péter <dr.peter.barabas(a)gmail.com>, Kamailio (SER) - Users Mailing List <sr-users(a)lists.kamailio.org>
Subject: Re: [SR-Users] uac_req_send + evroute + crash
Hello,
do you also get error log messages that include "failed to send request with authentication"?
Which CRITICAL log appears when you call uac_req_send()? You pasted a couple of them in the initial email?
Cheers,
Daniel
On 05.10.23 17:32, Dr. Barabás Péter wrote:
Hello,
I used kamailio version 5.6.2. I refreshed to 5.7.2 today.
As I remember it was in kamailio long time ago therefore I could skip evroute route.
But this CRITICAL log appears always when I call uac_req_send().
I call it with settings:
$uac_req(auser) = $var(username);
$uac_req(apasswd) = $var(password);
Where username and password are retrived from web service before call.
In event_route I got first 401 after 200.
Peter
From: Daniel-Constantin Mierla <miconda(a)gmail.com><mailto:miconda@gmail.com>
Date: Thursday, 2023. October 5. 17:25
To: Kamailio (SER) - Users Mailing List <sr-users(a)lists.kamailio.org><mailto:sr-users@lists.kamailio.org>
Cc: Dr. Barabás Péter <dr.peter.barabas(a)gmail.com><mailto:dr.peter.barabas@gmail.com>
Subject: Re: [SR-Users] uac_req_send + evroute + crash
Hello,
On 05.10.23 16:34, Dr. Barabás Péter via sr-users wrote:
Hi All,
I use kamailio In front of Asterisk and kamailio needs to refresh registrations periodically towards Asterisk to ensure the availability of users from Asterisk side.
I use uac module and call uac_req_send() for sending REGISTER requests.
I set $uac_req(evroute)=1
The event_route[uac:reply] is called fine, but in kamailio logs I see the next lines:
CRITICAL: <core> [core/mem/q_malloc.c:519]: qm_free(): BUG: freeing already freed pointer (0x7f114995ada8), called from uac: uac_send.c: uac_send_tm_callback(860), first free uac: uac_send.c: uac_resend_tm_callback(732) - ignoring
After some time, kamailio has crashed.
CRITICAL: <core> [core/mem/q_malloc.c:519]: qm_free(): BUG: freeing already freed pointer (0x7f114995ada8), called from uac: uac_send.c: uac_send_tm_callback(860), first free uac: uac_send.c: uac_resend_tm_callback(732) – ignoring
CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 34
ALERT: <core> [main.c:774]: handle_sigs(): child process 1407950 exited by a signal 6
what version of Kamailio are you using? Is Asterisk challenging for authentication?
Does it happen every time or seldom?
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
Kamailio Advanced Training - Online - Nov 14-16, 2023 -- asipto.com
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
Kamailio Advanced Training - Online - Nov 14-16, 2023 -- asipto.com
Hi
I'm still looking for a better way to tell Kamailio that we want to
enter 'maintenance' and STAY in maintenance after a restart.
Maintenance is: Reject all messages without totag with 503 to prevent
creating new dialogues.
I could use a shared pv and the use kamcmd pv.shvSet to toggle it.
But when kamailio is restarted, that pv is also reset to it's initial
state. Not good, if I want to make sure the node stays in maintenance
mode after a restart as for example after pushing a config change via
ansible.
So what comes to my mind is to check for the presence of a file.
something like:
route[CHECK_MAINTENANCE]
{
if (!has_totag() && is_method("INVITE")) {
if (file_exist("/etc/kamailio/maintenance.flag")) {
xlog("L_ERR", "Maintenance flag present! Rejecting INVITE\n");
t_send_reply("503", "Maintenance mode - no new calls accepted");
exit;
}
}
}
Mit freundlichen Grüssen
-Benoît Panizzon-
--
I m p r o W a r e A G - Leiter Commerce Kunden
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00
CH-4133 Pratteln Fax +41 61 826 93 01
Schweiz Web http://www.imp.ch
______________________________________________________
Hello everyone,
I have previously set up Kamailio 5.7.2 IMS configuration (including P-CSCF, S-CSCF and I-CSCF) and successfully made voice calls. Now I'm trying to set up an IP-SM-GW AS using the example here (with some tweaks):
https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/example…
Currently I'm trying to send the SMS using a SIP software client (MicroSIP).
The problem is, while the SMS is received at the AS and stored in the database, it does not send it to the callee.
While troubleshooting the problem, I've found that reg_fetch_contacts("location", "$var(uri)", "caller") in route[SEND_SMS] cannot find the contact which was added by reginfo_handle_notify("location") in route[NOTIFY] in the usrloc database. By tracing the problem more, I've found that reginfo_handle_notify (when handling reg event NOTIFY) adds the complete AoR in the "username" field in the location table, e.g. as "bob(a)ims.mnc001.mcc001.3gppnetwork.org". But reg_fetch_contacts (when trying to send the SMS) looks up the table using only the user part in the "username" field, e.g. "bob". So it cannot find the callee contact and the configuration assumes the callee is still not registered; so it tries to send out a SUBSCRIBE every time it tries to send an SMS to the callee, instead of actually sending the SMS.
Does anybody have any idea on what could have caused this inconsistent behavior between reginfo_handle_notify and reg_fetch_contacts?
Hi List
I wanted to take one of our cores down gracefully by not destroy
running dialogues to be able to implement a config change on Kamailio
5.5
For this I did:
kamctl dispatcher.remove ID SIP-URI, for every IC
This worked fine, Kamailio is instructed to reply 503 on out of
dialogue traffic from unknown endpoints causing the endpoints to
re-route traffic to the other core, eventually making it possible to
stop and restart Kamailio without harm.
dialog count was steadily decreasing, until after about 10 minutes
after removing the dispatcher URI's it started to increase again.
kamctl dispatcher.list shows me, all dispatcher URI I removed are back!
There is no ds_reload() being executed by calls.
In the module description, I find no hint, that the dispatcher config
is being reloaded from file in some interval or so.
What could be the cause of my removed dispatcher suddenly being back?
--
Mit freundlichen Grüssen
-Benoît Panizzon- @ HomeOffice und normal erreichbar
--
I m p r o W a r e A G - Leiter Commerce Kunden
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00
CH-4133 Pratteln Fax +41 61 826 93 01
Schweiz Web http://www.imp.ch
______________________________________________________
Hi,
since we use git also for our kamailio stuff, we need to check in also
host specific stuff.
(same kamailio.cfg but different addresses and ... )
For this I thought an include_file for different hosts would be nice,
but I can not check in the different host specific files,
because I can not use something like:
|include_file "$HN(n).cfg"
It is not allowed in kamailio 5.6.x
Or better: the pseudo variable is not replaced.
Is there a way to work arround, or is it possible to make it possible?
Best regards
Bernd
|
Good evening everyone,
I'm trying to set a scenario with my extensions registered against kamailio via wss and then once authenticated forward the register to my asterisk.
After this, I use dispatcher module to balance invites to my asterisks.
I have a few questions, the first part seems to be working as I want but when asterisk receives an invite and responds with INVITE (SDP) it doesn't appear on my kamailio (but every other message appears) You can see it in this sngrep captures
Kamailio:
[cid:image001.png@01DA0E88.5F82F510]
Asterisk
[cid:image002.png@01DA0E88.5F82F510]
I guess it is because something in my asterisk pjsip configuration is wrong but I can't figure out what. So I'm start to think that maybe It is because I need to configure an rtpproxy app to change SDP and make RTP traffic go through kamailio
Maybe there's something else I need to do, or there's a guide to do this. But I can't find anything
Any help will be very appreciated
Thank you in advance
Samuel Moya Tinoco
Departamento de Sistemas y Redes
Móvil: (+34) 606985997
smoya(a)vivelibre.es<mailto:smoya@vivelibre.es>
[cid:image003.png@01DA0E88.5F82F510]
Soluciones inteligentes
para la autonomía personal
Hello,
following the Kamailio Developers Meeting discussions and provided that
GNU/Linux malloc() aligns allocated memory to 16 bytes on x86_64 (64b
CPUs), I just updated the native Kamailio qm (quick malloc - the default
one) and fm (fast malloc) memory managers to also align to 16 bytes:
-
https://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.ht…
By default they do it to 16 also for 32b CPUs, the overhead at startup
with default config was rather insignificant (like 5000 bytes for
private memory set to 8MB), so I didn't want to bother that much (that's
also because some 32b CPUs could require larger alignment that the size
of the pointer address), but for flexibility I added the an option to
set the alignment size at compile time with KSR_MEMORY_ALIGN define
(e.g., -DKSR_MEMORY_ALIGN=8UL).
The main benefit at this moment is that Kamailio should be able to use
the OS distribution (e.g., Debian) packaged libwolfssl instead of
bundling and building the library inside it to compile with custom
flags, like it is done now. Also, it is safe for the future to use other
libraries that leverage internally the OS memory alignment size for
specific optimizations.
I also increased the optimize factor to 15, which should speed up a bit
dealing with larger chunks of memory (now up to 32KB, previously was up
to 16KB). Considering that it is more and more common to deal with
larger SIP messages (e.g., a webrtc invite can easily be like 20KB) as
well as tls/encryption needs addition space that the unencrypted udp/tcp.
Hopefully these updates don't have side effects, it was nothing
consistent changed, a few defines and fields to match the new alignment
constraints. But testing is important, try to play with the master and
your configs whenever you have any chance.
Unfortunately the tlsf memory manager seems to be specifically designed
for aligning to 8 bytes, a rather old related issue in that project is
not concluded:
- https://github.com/mattconte/tlsf/issues/16
That means the tls_wolfssl module linked with the officially packaged
libwolfssl has to be used with qm or fm malloc from now on. Or it has to
be built like so far to use tlsf memory manager. The tls/tlsa module can
still be used with tlsf memory manager.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
Hello,
during the Kamailio Developers Meeting 2023 in Dusseldorf early this
week, Victor Seva shared how one can setup own development environment
for facilitating the automatic checks for clang-format and few other
useful bits (e.g., training white spaces) using pre-commit tool. So I
thought it would be useful to shared further to both developers and
users communities (as the later can make patches and pull requests as well).
If I forgot something, Victor should amend me, but the main steps are:
- install pre-commit package (either via apt or via pip3)
- install clang-format (debian/ubuntu should have it as a package)
- go to the folder with git clone of Kamailio source and run:
pre-commit install
The above command can take some time, but it is needed only once.
After that, on evey commit, the checks should be performed a summary
should be presented on screen, like:
$ git commit src/
check yaml...........................................(no files to
check)Skipped
check xml............................................(no files to
check)Skipped
fix end of
files.........................................................Passed
trim trailing
whitespace.................................................Passed
check for merge
conflicts................................................Passed
mixed line
ending........................................................Passed
clang-format.............................................................Passed
If the check of clang-format results in "Failed", like:
clang-format.............................................................Failed
the pre-commit hooks will correct it, so you can just run again the
commit command and the 2nd time should be good to go.
If for whatsoever reasons pre-commit is installed but you need to
ignore/skip the pre-commit hooks, just provide -n or --no-verify to the
commit command, like:
$ git commit -n src/
By using pre-commit hooks, one could easily avoid making pull requests
that are failing to meet the code formatting checks on github portal as
well as ensure that as developer one does no forget to run clang-format
before commit.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
I'm encountering an issue with dialog handling in Kamailio. Initially, everything functions correctly, and if a connection terminates within two minutes, the BYE method works as expected. However, if the call exceeds two minutes, the BYE method doesn't seem to be recognized, and there are no related entries in the logs.
As someone new to working with Kamailio, I'm finding this quite perplexing. Could anyone offer guidance or troubleshooting steps to resolve this issue?
Thank you for your assistance.
Hello,
We have a Kamailio configuration with the following, however all the load
is going to the server at 22.22.22.22 (hiding the real IP obviously)
instead of being shared evenly between 22.22.22.22 and 33.33.33.33. Can
anyone please tell me why? The rtpengine server at 11.11.11.11 is intended
to only receive calls if the other two are offline. Thank you very much.
#!define RTPENGINE_ADDR "udp:11.11.11.11:7724=1 udp:22.22.22.22:7724=99999999
udp:33.33.33.33:7724=99999999"
modparam( "rtpengine", "rtpengine_sock", RTPENGINE_ADDR )
--
David Cunningham, Voisonics Limited
http://voisonics.com/
USA: +1 213 221 1092
New Zealand: +64 (0)28 2558 3782