Hello, after the discussion regarding http and http_async, I started some labs to make a comparison and see what’s the trade off and the associated cost.
Main problem (to me) is im not clear on how transactions behave. Im running some fast tests now before I start to deploy the final scenarios and
1. A new transaction is created before the http_async call (as the module example shows for http_async_query function
2. The http_async_query call is executed, receives a response and the HTTP_REPLY route for http_async_query is executed.
3. As we need to redirect the call, im adding Contact information with append_to_reply and then calling t_reply(302,”Redirect)
Up to here INVITE is received, a 100 is answered and then the 302 with the expected Contact information (collected and built from the http_async_query response), problem is that the 302 is retransmitted 3 more times.
So, im not even sure that im doing the correct actions to process the call this way. Is there a document/book/reference I can read to understand transactions better?
By now I can not handle the call to be processed correctly (without the retransmissions) and finish the transaction the correct way.
Any help, link, guide, will be appreciated.
Regards.
Hello!
for this ST/SH project, we are using Kamailio 5.8.4 in stateless mode,
making HTTP requests to a REST API (Java Spring) that will reply with a
JSON object, and then Kamailio replaces the Contact header and sends a SIP
300 Multiple Choice reply to the SBC that sent the initial INVITE.
Kamailio is running on a VM with 4vCPUs and 4GB RAM and 2 NICs.
On NIC ens224 there is a Virtual IP managed by Keepalived.
Kamailio is listening on port 5060 on ens224 and set with 32 children
process (tried with 8, 16, 24 and also 64, but with this value it was a lot
worst).
We are doing load performance tests on our PreProd environment. With the
SBC we are sending 450 to 600 CAPS to Kamailio, and what we noticed is that
above 450 CAPS, and after less than 1 minute, Kamailio only replies SIP 100
to some INVITEs. We also could figure out that Kamailio is not receiving
all the INVITES, despite having proved that ALL invites are sent to the
server.
It seems to me that, for some reason, the OS is somehow not able to deliver
*all* SIP packets to Kamailio, because:
- sngrep does capture all the SIP packets and shows the flows
- though the flow shows SIP invite coming from SBC to Kamailio Server,
there is no SIP 100 replied back to SBC, even though this is the 1st thing
kamailio does, so, for me, Kamailio did not received the SIP Invite
- picking a call with reinvites, which after some seconds, SBC cancels, if
I copy the Call-ID value and grep on kamailio's logs, I just do not find
any content!
I have read some "network tuning" articles, including Linux Tune Network
Stack (Buffers Size) To Increase Networking Performance - nixCraft
<https://www.cyberciti.biz/faq/linux-tcp-tuning/> and Tuning Kamailio for
high throughput and performance | Evariste Systems Blog
<https://blog.evaristesys.com/2016/02/15/tuning-kamailio-for-high-throughput…>
and
when running the following command I get:
$ ss -4 -n -l | grep 5060
udp UNCONN 0 0 10.242.17.125:5060 0.0.0.0:*
udp UNCONN 324224 0 10.242.17.146:5060 0.0.0.0:*
According to the article, the 3rd column should be as near 0 as possible,
ideally 0.
While I am waiting for some sysadmin with root permissions to be available
and modify some of the network parameters on this VM, I wonder if anyone
has some tips to share on how to solve this behaviour. I'm not sure,
either, what parameters to change or if they should be changed! The goal is
to have a minimum 750 CAPS.
Lastly, some parts of the code:
Kamailio.cfg:
> ### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
> debug=1
> log_stderror=no
> rundir="/tmp"
> memdbg=5
> memlog=5
> log_facility=LOG_LOCAL0
> # configure the prefix for all log messages
> log_prefix_mode = 1
> log_prefix="{$mt $hdr(CSeq) $ci} "
> /* number of SIP routing processes */
> children=32 # ------------- ALREADY TRIED WITH 8,16,24... no results.....
> /* uncomment the next line to disable TCP (default on) */
> disable_tcp=no
> /* uncomment the next line to disable the auto discovery of local aliases
> * based on reverse DNS on IPs (default on) */
> # auto_aliases=no
> /* add local domain aliases */
> # alias="sip.mydomain.com"
>
####### Custom Parameters #########
/* These parameters can be modified runtime via RPC interface
* - see the documentation of 'cfg_rpc' module.
*
* Format: group.id = value 'desc' description
* Access: $sel(cfg_get.group.id) or @cfg_get.group.id */
####### Modules Section ########
/* set paths to location of modules */
loadmodule "db_mysql.so"
loadmodule "db_cluster.so"
loadmodule "http_client.so"
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "jansson.so"
loadmodule "snmpstats.so"
loadmodule "file_out.so"
loadmodule "ctl.so"
loadmodule "permissions.so"
loadmodule "xhttp.so"
loadmodule "xhttp_rpc.so"
####### Other Args and Env Vars #########
/* listen addresses */
include_file "listen.cfg"
include_file "db_conn.cfg"
# ----------------- setting module-specific parameters --------------
# --- DB Cluster params ---
# minimum requirement is to have DBURL1 defined
#!ifdef DBURL1
modparam("db_cluster", "connection" , DBURL1)
#!endif
#!ifdef DBURL2
modparam("db_cluster", "connection" , DBURL2)
#!endif
#!ifdef DBURL3
modparam("db_cluster", "connection" , DBURL3)
#!endif
#!ifdef DBURL4
modparam("db_cluster", "connection" , DBURL4)
#!endif
#!ifdef DBURL5
modparam("db_cluster", "connection" , DBURL5)
#!endif
modparam("db_cluster", "cluster", DBCLUSTER)
# --- Permissions params ---
modparam("permissions", "db_url", "cluster://k1")
modparam("permissions", "db_mode", 1)
#modparam("permissions", "reload_delta", 30)
# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)
/* set the path to RPC fifo control file */
modparam("jsonrpcs", "fifo_name", "/tmp/kamailio_rpc.fifo")
/* set the path to RPC unix socket control file */
modparam("jsonrpcs", "dgram_socket", "/tmp/kamailio_rpc.sock")
modparam("jsonrpcs", "transport", 0)
# ----- ctl params -----
/* set the path to RPC unix socket control file */
modparam("ctl", "binrpc", "unix:/tmp/kamailio_ctl")
# ----- http_async_client params -----
modparam("http_client", "query_result", 0)
modparam("http_client", "keep_connections", 0)
modparam("http_client", "connection_timeout",2)
modparam("http_client", "timeout_mode",2)
modparam("http_client", "config_file",
"/usr/local/etc/kamailio/http_client.cfg")
# ---- SNMP Stats params ----
modparam("snmpstats", "sipEntityType", "proxyServer")
modparam("snmpstats", "sipEntityType", "redirectServer")
modparam("snmpstats", "sipEntityType", "other")
modparam("snmpstats", "snmpgetPath", "/usr/bin/")
modparam("snmpstats", "MsgQueueMinorThreshold", 20)
modparam("snmpstats", "MsgQueueMajorThreshold", 100)
modparam("snmpstats", "dlg_minor_threshold", 20)
modparam("snmpstats", "dlg_major_threshold", 100)
modparam("snmpstats", "snmpCommunity", "kamailio")
# ---- File_Out params ----
modparam("file_out", "base_folder", "/data/sabire002/log/kamailio/")
modparam("file_out", "file",
"name=stsh_requests;interval=1440;extension=.log")
modparam("file_out", "file", "name=cdr;interval=1440;extension=.log")
modparam("file_out", "file", "name=http;interval=1440;extension=.log")
####### Routing Logic ########
include_file "includes/reqinit.cfg"
include_file "includes/handle_options.cfg"
include_file "includes/handle_cancel.cfg"
include_file "includes/handle_stir_shaken_stateless.cfg"
include_file "includes/handle_http_rpc.cfg"
request_route {
$avp(START_TIME)=$utimef(%Y-%m-%d %H:%M:%S);
$avp(GROUPID) = allow_address_group($si, $sp);
if ( $avp(GROUPID) == 100 || !allow_address_group($si, $sp) ) {
xlog("L_INFO", "INIT - $si:$sp is not in the allowed ACL Group ID
!\n");
#sl_reply("401", "Address not allowed");
exit;
};
if (is_method("ACK") ) { #&& t_check_trans() ){
exit;
}
if (is_method("INVITE")) {
file_out("cdr","$rm|$ft|$tt|$ci|$rs|$rr|$Ts|$avp(START_TIME)|$fU|$fd|$si|$tU|$rU|$rd|$utimef(%Y-%m-%d
%H:%M:%S)");
send_reply("100","Trying");
}
route(HANDLE_OPTIONS);
route(REQINIT);
xlog("L_INFO"," ********** Route START ***********");
# log the basic info regarding this call
xlog("L_INFO","=================================================== \n");
xlog("L_INFO","New SIP message $rm with call-ID $ci received $pr request
$rm $ou source $si:$sp from $fu to $tu \n");
xlog("L_INFO","=================================================== \n");
route(HANDLE_STIRSHAKEN);
route(HANDLE_CANCEL);
if (method == "INVITE"){
route(RELAY);
}
}
route[RELAY] {
# Sends a 300 Multiple Choices back to the proxy that requested the
routing lookup
xlog("L_INFO","RELAY - send reply \n");
file_out("cdr","RELAY|$ft|$tt|$ci|$rs|$rr|$Ts|$avp(START_TIME)|$fU|$fd|$si|$tU|$rU|$rd|$utimef(%Y-%m-%d
%H:%M:%S)");
send_reply("300", "Multiple Choices");
exit;
}
As for the HANDLE_STIRSHAKEN route, where the main process is:
route[HANDLE_STIRSHAKEN]
{
if (!is_method("INVITE")) {
return;
}
$xavp(requestTime) = $utimef(%s);
$var(post) = $null; // resets and makes sure the $var(post) variable is
null before usage
[.... get some header values ...]
$var(res) = http_connect("api1", "/stsh", "application/json",
"$var(post)", "$var(result)");
jansson_xdecode($var(result), "json");
if ( $xavp(json=>sip-response-code) == 300 )
{
remove_hf("Contact");
append_to_reply("Contact: $xavp(json=>contact)\r\n");
}
else
{
# add error message to reply
sl_reply("$xavp(json=>sip-response-code)","$xavp(json=>sip-response-text)");
exit;
}
}
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
Hello,
I've started testing/learning KEMI and decide to use python3(s). I'm using default config with kamailio-basic-kemi-python3s.py (just deleted a couple of routes for simplicity). First thing I noticed is that reloading is not working. I've changed simple log line and did kamcmd app_python3s.reload. I'm compiling from source (inside Docker container, Debian bookworm as base), and have noticed it stopped working after thees commits for python3s:
62b4ee4a0d0b62b35c8bdf67e5daf9cbe9a28499 app_python3s: refactor GIL and thread state handling
c81b2b3383c5900aba83672da024c812d8e6d89d app_python3s: initial support for free-threading Python
And for python3
0ffe157bc13e7759ae1cee63a584fad4ac9eb38f app_python3: refactor GIL and thread state handling
Am I missing some new parameter for module or compile flag? What I've noticed it's not only that it not reload, it also does not go through complete config file.
While reloading, I see marking for reload. But nothing after that:
22(774) DEBUG: ctl [../../core/io_wait.h:368]: io_watch_add(): processing io_watch_add(0x748d1dfb83c0, 11, 3, 0x5f0adde454d0) - fd_no=1
22(774) DEBUG: ctl [io_listener.c:438]: handle_new_connect(): new connection (1) on /var/run/kamailio//kamailio_ctl
22(774) DEBUG: ctl [io_listener.c:499]: handle_stream_read(): bytes read: 29
22(774) INFO: app_python3s [apy3s_kemi.c:868]: app_python3s_rpc_reload(): marking for reload Python script file: /etc/kamailio/kamailio-basic-kemi-python3s.py (0 => 1)
22(774) DEBUG: ctl [io_listener.c:520]: handle_stream_read(): bytes processed: 29
22(774) DEBUG: ctl [io_listener.c:496]: handle_stream_read(): handle_stream read: eof on /var/run/kamailio//kamailio_ctl
22(774) DEBUG: ctl [../../core/io_wait.h:599]: io_watch_del(): DBG: io_watch_del (0x748d1dfb83c0, 11, -1, 0x10) fd_no=2 called
Hi Gang
When a CPE behind nat registers, I have the alias added to the AOR
contact. It has format ip~port~transport
Let's say: bob@1.2.3.4:5060;alias=5.6.7.8~7777~1
On an invite to that CPE behind nat, the contact is retrieved from
the location record and I assumed I could call handle_ruri_alias in the
branch route to that CPE and this would sent the call to that ip port
via transport in the alias.
I observe that the port is not taken into account. The INVITE to bob is
sent to ip 5.6.7.8 but to port 5060 instead of 7777
In the example config, handle_ruri_alias() is only used for in dialog
requests (has_totag).
Have I misunderstood how CPE behind NAT should be registered and that
registration resolved?
--
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
______________________________________________________
Dear Kamailio Community,
I hope this message finds you well.
I have recently developed an install.sh script aimed at simplifying the process of installing Kamailio directly from source. My goal is to streamline the installation process while adhering to best practices for Kamailio deployment.
I would greatly appreciate your feedback, suggestions, or any corrections to help improve the script’s robustness and ensure it aligns with the community’s standards.
You can find the script in my GitHub repository: https://github.com/AL-CALL-LLC/KamailioBuilder.git
Feel free to test it, share your thoughts, or open issues on GitHub for any recommendations or areas that need refinement.
Thank you in advance for your time and valuable expertise. I am more than happy to provide further details or engage in discussions if needed.
Best regards,
Fabien Brou
Developer
Hello,
I'm getting this warning WARNING: <core> [core/dset.c:690]: print_dset(): no r-uri or branches when working with async worker.
here is below the code used:
request_route {
if (is_method("INVITE")) {
append_to_reply("Contact: <sip:+1234;myparam=test@$si:$sp>\r\n");
send_reply("302", "Moved Temporarily");
exit;
}
}
Can you please help?
Hi,
we have the following situation:
Multiple UAs are subscribed to the proxy and get INVITEd via parallel
forking.
Now one of the UAs sends us a 302 status, we would like to handle this
like a failure. So we'd like to CANCEL all the other branches, and
forward the 302 status to the original INVITE.
We have tried t_reply("302", "$T(reply_reason)") in the response, which
almost solves this, however we cannot pass the required headers form the
302 response in it.
BTW, could there have been a change in the default behavior of Kamailio?
We think it used to "just work" in the past.
Thank you very much
Christian Berger
--
Christian Berger - berger(a)sipgate.de
Telefon: +49 (0)211-63 55 55-0
Telefax: +49 (0)211-63 55 55-22
sipgate GmbH - Gladbacher Str. 74 - 40219 Düsseldorf
HRB Düsseldorf 39841 - Geschäftsführer: Thilo Salmon, Tim Mois
Steuernummer: 106/5724/7147, Umsatzsteuer-ID: DE219349391
www.sipgate.de - www.sipgate.co.uk
Hello,
the formal notification that the development for the next major version
6.0.0 is now frozen. The focus has to be on testing the master branch.
Also, the master branch should not get commits with new features till
the branch 6.0 is created, expected to happen in 2-4 weeks, a matter of
how testing goes on. Meanwhile, the commits with new features in the C
code can be pushed to personal branches, new pull requests can still be
done, but they will be merged after branching 6.0.
Can still be done commits with documentation improvements, enhancements
to related tools (e.g., kamctl, kamcmd), merging exiting pull requests
at this moment, exporting missing KEMI functions and completing the
functionality of the new modules added for 6.0.
Once the branch 6.0 is created, new features can be pushed again to
master branch as usual. From that moment, the v6.0.0 should be out very
soon, time used for further testing but also preparing the release of
packages.
If someone is not sure if a commit brings a new feature, just make a
pull request and it can be discussed there on github portal or via
sr-dev mailing list.
A summary of what is new in upcoming 6.0 is going to be built at:
* https://www.kamailio.org/wikidocs/features/new-in-6.0.x/
Upgrade guidelines will be collected at:
* https://www.kamailio.org/wikidocs/install/upgrade/5.8.x-to-6.0.0/
Everyone is more than welcome to contribute to the above wiki pages,
especially to the upgrade guidelines, to help everyone else during the
migration process from v5.8.x to 6.0.x.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Hello,
I propose to aim freezing the development for 6.0.x series at the end of
the 16th of December 2024 (Monday).
New features that one wants to get in this release series have to be
pushed to git repository or pull requests made for them. Afterwards
usually follows a 4-6 weeks of testing till the first release 6.0.0.
Unfreezing will happen earlier, after the first weeks of testing when
the 6.0 branch will be created.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com