Hello,
A bit generic question, does Kamailio supports CRLF keepalive per
https://www.rfc-editor.org/rfc/rfc5626#section-4.4.1 ?
It's more for tracking TCP connection states, as seems tcp_keepalive_enable
is not super reliable especially in mobile networks.
--
Best regards,
Ihor (Igor)
Hi List
I am just wondering...
When I am sending the initial INVITE to a customer CPE, this goes
throug the whole location lookup and through a branch route in which I
make some last adjustments to the headers, like removing header the
customer shall not get (like P-Asserted-Identity which would reveal the
caller identity on a callerid restricted call).
On a Re-Invite (session timer refresh) the call is being routed by
loose_route() and immediately sent to RELAY.
uac_replace and uac_restore seem to work fine for stuff like To and
From Header. But how do I prevent unwanted header to disclose
information to the customer which should ne be disclosed?
Do I need to re-arm the branch trigger also for within dialog calls?
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
______________________________________________________
Hi
https://lists.kamailio.org/pipermail/sr-users/2020-July/109801.html
I have the exact same issue.
When the B side is starting a new transaction (UPDATE to refresh the
session in my case) without topos enabled, that transaction contains
one or multiple route header and a to_tag.
Therefore loose_route() is true and the call is more or less sent to
route(RELAY) immediately without further checks.
If topos is enabled, all record-route header are removed and only one
Via sent to the CPE.
So when the CPE replies, there is no Route header.
Therefore loose_route returns false.
This makes me wonder, at which stage is topos restoring the route
headers? Shouldn't that happen before loose_route is evaluated?
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
______________________________________________________
Hi everybody,
I'm a little bit confused about the documentation of the Userblacklist
module as I think it has to be Userblocklist since version 5.x. Also
some of the commands and some column names in the database have changed.
I can remember that the documentation was right at some point, but the
it has been changed back to Userblacklist. I wonder if nobody noticed
that because the old commands do not work.
BR, Björn
--
Björn Klasen, Senior Specialist (VoIP)
TNG Stadtnetz GmbH, TNG-Technik
Gerhard-Fröhler-Straße 12
24106 Kiel・Deutschland
T +49 431 7097-10
F +49 431 7097-555
bklasen(a)tng.de
https://www.tng.de
Executive board (Geschäftsführer):
Dr. Sven Willert (CEO/Vorsitz),
Gunnar Peter, Sven Schade,
Carsten Tolkmit, Bernd Sontheimer
Amtsgericht Kiel HRB 6002 KI
USt-ID: DE225201428
Die Information über die Verarbeitung Ihrer Daten
gemäß Artikel 12 DSGVO können Sie unter https://www.tng.de/datenschutz/ abrufen.
______________________________________________________________________
Hi
I am running kamailio 5.4 on debian
I have carrierfailureroute configured incase of primary service provider
fails. I also have Stirshaken configured to add Identity header on outbound
calls. Issue is when call fail overs to carrierfailureroute,
http_async_query changes $ru to the primary carrier
From the debug logs, when primary carrier sends a 488 (primary carrier
expects SIP TLS but my call is UDP - to test the failover scenario)
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} tmx
[t_var.c:561]: pv_get_tm_reply_code(): reply code is <488>
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn}
carrierroute [cr_func.c:178]: set_next_domain_on_rule(): searching for
matching routing rules39(285) INFO: {1 18398 INVITE
8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} carrierroute [cr_func.c:197]:
set_next_domain_on_rule(): next_domain is 47987
Carrier route rewrites the failover carrier
39(285) INFO: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn}
carrierroute [cr_func.c:706]: cr_do_route(): uri 14371234567 was rewritten
to sip:14371234567@sip.primaryprovider.com, carrier 1, domain 47987
Before http_async_query rd and ru are still the failover carrier
39(285) INFO: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} <script>:
[callid: 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn] - [cfg:2976] - Debug testing
----- rd is sip.primaryprovider.com ----- ru is
sip:14371234567@sip.primaryprovider.com
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn}
http_async_client [async_http.c:469]: async_send_query(): transaction
suspended [5261:1830449764]
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn}
http_async_client [async_http.c:625]: async_push_query(): query sent [
https://authn-uat.ccid.neustar.biz/ccid/authn/v2/identity?apiKey=randomkey]
(0x7fdcad097e60) to worker 1
However, when the route is being called after the http_async_query it
changes to the primary one:
26(272) DEBUG: tm [t_lookup.c:1612]: t_lookup_ident_filter(): transaction
found
26(272) DEBUG: http_async_client [async_http.c:235]: async_http_cb():
resuming transaction (5261:1830449764)
26(272) DEBUG: tm [t_lookup.c:1612]: t_lookup_ident_filter(): transaction
found
26(272) INFO: <script>: [callid: 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn] -
[cfg:2995] - Debug testing ----- rd is 1.2.3.4 ----- ru is
sip:14371234567@1.2.3.4:5061;transport=TLS
Due to this, call keeps going to the primary and it fails
if ( http_async_query(STIRSHAKEN_AS_URL, "AS_RESPONSE") == -1 ) {
xlog("L_ERR ", "[cfg:$cfg(line)] Failed to connect AS service for token $fu
-> $tu \n");
return;
}
route[AS_RESPONSE] {
xlog("L_INFO", "[callid: $ci] - [cfg:$cfg(line)] - Debug testing ----- rd
is $rd ----- ru is $ru\n");
if ($http_ok) {
xlog("L_INFO", "[cfg:$cfg(line)] Resuming outbound call transaction for $fu
-> $tu Received - $http_rb \n");
# Add identity and Date headers
if (jansson_get("identity", $http_rb, "$var(identity)")) {
insert_hf("Identity: $var(identity)\n", "Content-Length");
}
if (jansson_get("date", $http_rb, "$var(date)")) {
if ($hdr(Date) != $null){
remove_hf("Date");
}
insert_hf("Date: $var(date)\n", "Identity");
}
} else {
xlog("L_ERR", "[cfg:$cfg(line)] Resuming outbound call transaction. Error -
$http_err)\n");
}
route(RELAY);
exit;
}
Please help to understand why rd / ru changes to primary carrier.
Regards,
Maharaja Azhagiah
We have some scripts that are setting values in an htable for various things, one of which is to disable options replies to take a system “out of service”. We discovered today upon deploying 5.8.0 that the “htable.seti” command appears to be broken.
[root@ip-10-52-42-102 ~]# kamcmd htable.seti system_settings option_pings_off 1
error: 500 - Not enough parameters (htable name, key name and value)
however if we do htable.sets it works fine (although not an integer so it’s breaking our shutdown scripts).
[root@ip-10-52-42-102 ~]# kamcmd htable.sets system_settings option_pings_off 1
Ok. Key set to new value.
[root@ip-10-52-42-102 ~]#
I’ve looked through the commit history for htable and haven’t found anything that really stands out as a possible issue, so can the gurus please take a look?
Thanks!
Brooks Bridges
Sr. Developer
[https://files.skyetel.com/logo.png]
Direct: (888) 444‑1111
Office: (561) 453‑4085
Email: bbridges(a)skyetel.com
902 Clint Moore Road
Suite 206
Boca Raton, FL 33487
www.skyetel.com
Confidentiality Notice: This e-mail, and any attachment to it, contains privileged and confidential information intended only for the use of the individual(s) or entity named on the e-mail. If the reader of this e-mail is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that reading this e-mail is strictly prohibited. If you have received this e-mail in error, please immediately return it to the sender and delete it from your system.
Hello Experts,
I'm not an expert in Kamailio, but thanks to some excellent online resources, I managed to set up a basic interconnection between Teams and Kamailio.
So far, outbound calls, as well as blind and attended call transfers, are working smoothly. However, I'm facing a challenge with call disconnection for outbound calls. Specifically, when an outbound call is made and the called party hangs up, the BYE message isn't being relayed properly towards the Teams side.
In my routing configurations, I remove the Record-Route header received from Teams and add a new Record-Route header with Kamailio's IP before forwarding it to my IP PBX (FreeSwitch). For the BYE message to be processed correctly, Microsoft Teams requires the original contact in the Request URI (RURI) and the Route header to match the initial Record-Route included in the INVITE. Currently, my BYE message appears as follows:
BYE sip:api-du-a-auea.pstnhub.microsoft.com:443;x-i=5e96d703-b1e7-449c-aebf-a87bfa628176;x-c=f61b674bc597513ab8d888dbe7c560fb/d/8/9a6c508a9cbd44ebb892b62c33ba9b67 SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:5060;branch=z9hG4bKeab5.b657e3455b6d11ed6975c69882632a27.0
Via: SIP/2.0/UDP x.x.x.x;received=x.x.x.x;rport=5060;branch=z9hG4bKK3HKQBUvX42ya
Max-Forwards: 69
From: <sip:+61403225xxx@kamsbc.xyzdomain.com:5061;user=phone>;tag=j5gptBSXXrXDc
To: "XYZ Pty Ltd" <sip:+61291455xxx@sip.pstnhub.microsoft.com:5061;user=phone>;tag=3a5f0c9e32bc4eb1bffed29dc954118f
Call-ID: f61b674bc597513ab8d888dbe7c560fb
CSeq: 80555743 BYE
User-Agent: Unknown/v1.0
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, path, replaces
Reason: MVTSLocal;cause=10;text="BYE received"
Content-Length: 0
Kamailio conducts a lookup for api-du-a-auea.pstnhub.microsoft.com but ends up sending the BYE message to an incorrect IP.
Below is a snippet of my routing block configurations:
####### Routing Logic ########
/* Main SIP request routing logic
* - processing of any incoming SIP request starts with this route
* - note: this is the same as route { ... } */
request_route {
# per request initial checks
route(REQINIT);
#check who is the sender
route(INITCHECK);
# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) {
route(RELAY);
}
exit;
}
# handle retransmissions
if (!is_method("ACK")) {
if(t_precheck_trans()) {
t_check_trans();
exit;
}
t_check_trans();
}
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE")) {
record_route();
}
# account only INVITEs
if (is_method("INVITE")) {
setflag(FLT_ACC); # do accounting
}
if ($rU==$null) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# update $du to set the destination address for proxying
#$du = "sip:" + $rd + ":9";
route(RELAY);
exit;
}
route[INITCHECK] {
if(from_uri =~ ".*microsoft.com")
{
setflag(FROM_TEAMS);
$du = "sip:" + "MY_PBX_IP" + ":" + "5060";
//added by SHK
remove_hf("Record-Route"); // Remove existing Record-Route header
append_hf("Record-Route: <sip:KAM_IP:5060;transport=udp>\r\n");
route(HANDLE_RTP_FROM_TEAMS);
}
if(from_uri =~ ".*" + "MY_PBX_IP")
{
setflag(FROM_PBX);
$du="sip:sip.pstnhub.microsoft.com;transport=tls";
route(HANDLE_RTP_FROM_PBX);
}
}
#Manage RTP & transcoding comming from Teams to PBX
route[HANDLE_RTP_FROM_TEAMS] {
t_on_reply("PBX_REPLY_TO_TEAMS");
if (has_body("application/sdp"))
{
rtpengine_manage("RTP codec-mask=all codec-transcode=PCMA replace-origin replace-session-connection ICE=remove media-address=HOST_IP");
// record_route();
t_relay_to_udp("MY_PBX_IP","5060");
}
else
{
rtpengine_manage();
}
}
#Manage RTP & transcoding comming from PBX to Teams
route[HANDLE_RTP_FROM_PBX] {
t_on_reply("TEAMS_REPLY_TO_PBX");
if (has_body("application/sdp"))
{
rtpengine_manage("SRTP codec-mask=all ICE=force codec-transcode=PCMA replace-origin replace-session-connection media-address=ADVERTISE_IP");
$rd = "sip.pstnhub.microsoft.com";
$td = "kamsbc.xyzdomain.com";
$fd = "kamsbc.xyzdomain.com";
// record_route();
#Set TLS SNI (server name & server id)
$xavp(tls=>server_name) = "kamsbc.xyzdomain.com";
$xavp(tls=>server_id) = "kamsbc.xyzdomain.com";
t_relay();
}
else
{
rtpengine_manage();
}
}
# Wrapper for relaying requests
route[RELAY] {
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
}
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
}
if (is_method("INVITE")) {
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
# Per SIP request initial checks
route[REQINIT] {
if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") {
# silent drop for scanners - uncomment next line if want to reply
# sl_send_reply("200", "OK");
exit;
}
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(is_method("OPTIONS")) {
sl_send_reply("200","Keepalive");
exit;
}
if(!sanity_check("1511", "7")) {
xlog("Malformed SIP message from $si:$sp\n");
exit;
}
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
if (!has_totag()) return;
#Teams reINVITEs
if(isflagset(FROM_TEAMS)) {
loose_route();
t_relay();
exit;
}
if(isflagset(FROM_PBX)) {
#Set TLS SNI (server name & server id)
$xavp(tls=>server_name) = "kamsbc.xyzdomain.com";
$xavp(tls=>server_id) = "kamsbc.xyzdomain.com";
loose_route();
t_relay();
exit;
}
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
#set coresponding cert on transactions
if($fd == "kamsbc.xyzdomain.com") {
$xavp(tls=>server_name) = "kamsbc.xyzdomain.com";
$xavp(tls=>server_id) = "kamsbc.xyzdomain.com";
}
} else if ( is_method("NOTIFY") ) {
# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
record_route();
}
route(RELAY);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# no loose-route, but stateful ACK;
# must be an ACK after a 487
# or e.g. 404 from upstream server
route(RELAY);
exit;
} else {
# ACK without matching transaction ... ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
exit;
}
# Manage outgoing branches
branch_route[MANAGE_BRANCH] {
xdbg("new branch [$T_branch_idx] to $ru\n");
}
# Manage incoming replies
onreply_route[MANAGE_REPLY] {
xdbg("incoming reply\n");
}
#PBX On Reply
onreply_route[PBX_REPLY_TO_TEAMS]
{
if (has_body("application/sdp"))
{
rtpengine_manage("SRTP codec-mask=all codec-transcode=PCMA replace-origin replace-session-connection media-address=ADVERTISE_IP");
}
else
{
rtpengine_manage();
}
//added by SHK
if (status == "200" && method == "INVITE") {
remove_hf("Contact"); # Remove existing Contact header
append_hf("Contact: <sip:kamsbc.xyzdomain.com:5061;transport=tls>\r\n");
}
if (status=="200")
{
remove_hf("ALLOW:");
append_hf("ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY \r\n","CONTENT-TYPE");
}
}
#From Teams On Reply
onreply_route[TEAMS_REPLY_TO_PBX]
{
if (has_body("application/sdp"))
{
rtpengine_manage("RTP codec-mask=all codec-transcode=PCMA replace-origin replace-session-connection media-address=HOST_IP");
}
else
{
rtpengine_manage();
}
}
# Manage failure routing cases
failure_route[MANAGE_FAILURE] {
if (t_is_canceled()) exit;
}
event_route[tm:local-request] {
if(is_method("OPTIONS") && $ru =~ "pstnhub.microsoft.com") {
append_hf("Contact: <sip:kamsbc.xyzdomain.com:SBC_PORT;transport=tls>\r\n");
}
xlog("L_INFO", "Sent out tm request: $mb\n");
}
####### Routing Logic End ########
Given these details, I suspect the issue might be related to how I'm handling the Record-Route headers or potentially a misconfiguration in directing the BYE message. I would greatly appreciate any insights, suggestions, or guidance on how to correctly relay the BYE message back to Teams, or further refine my existing configuration.
Thank you in advance for your help and support!
Regards,
Shah Hussain
hi,
i have kamailio acting as SBC
i need hide topology like this
ds_select_dst(DSP_GRP_TRUNK, "6");
$tu = $(tu{re.subst,/PRIVATE_IP/IP_OF_CURRENT_SELECTED_DISPATCHER/g});
what is best way for IP extraction from $du?
thanks
Marek
Hello,
I have an issue with SCSF which challenge again after a successful first registration.
I have an error after the second register saying that no matching auth vector found.
I attach the logs and pcap file.
I don't see where is the issue. Could you help me?
Thanks a lot.
Anthony
I'm trying to add something simple like the following:
append_hf("X-testheader: True\r\n", "From");
However, I don't see my X-testheader in a packet capture. Are there
any common pitfalls that would prevent append_hf from working as
expected?
Hi all
I've set up a kamailio server on a public IP address to serve public clients.
- The clients REGISTER over a mix of TCP and TLS, so kamailio has
listeners on the same IP address: port 5060 for UDP/TCP and port 5061
for TLS.
- Some clients REGISTER from the same public IP address, behind the same NAT.
- Sometimes, the client-side NAT can use the same client-side IP
address and port for two concurrent connections - one TCP and one TLS
- which is normal because the server-side port is different (they're
different 5-tuples).
- Now when a request comes to kamailio, to be routed to a client, the
the t_relay_to_tls() function sometimes can relay the request over a
TCP connection instead of a TLS connection.
I've enabled tcp_connection_match=1. This is helpful, but it doesn't
completely resolve the problem. It helps when both connections (TCP
and TLS) are open, because the TLS connection will always be used for
TLS requests. However, when there's no TLS connection open, kamailio
will erroneously use the TCP connection.
Note that this setup depends on TCP/TLS connections being made from
the client to the server, not the other way around.
I've made a cut-down version of this setup to demonstrate the problem.
- Client: 11.15.32.1
- Server: 11.15.32.11
- version: kamailio 5.9.0-dev0 (x86_64/linux)
#################################################################
#!KAMAILIO
enable_tls=yes
listen=tls:11.15.32.11:5061
listen=tcp:11.15.32.11:5060
listen=udp:11.15.32.11:5060
loadmodule "tm"
loadmodule "tls"
loadmodule "pv"
loadmodule "rr"
fork=yes
log_facility=LOG_LOCAL0
log_stderror=no
children=2
debug=3
tcp_connection_match=1
modparam("tls", "low_mem_threshold1", -1)
modparam("tls", "low_mem_threshold2", -1)
modparam("tls", "certificate", "/usr/local/etc/kamailio/certs/chain")
modparam("tls", "private_key", "/usr/local/etc/kamailio/certs/key")
request_route {
loose_route();
$fs="tls:11.15.32.11:5061";
t_relay_to_tls();
}
#################################################################
This is a BYE message to be sent from internally in the network.
###########################
BYE sip:user3@11.15.32.1:33333;transport=tls SIP/2.0
Via: SIP/2.0/UDP 0.0.0.0:11111;rport;branch=z9hG4bK-d8754z-cc2c63344f5218d3-1
Route: <sip:11.15.32.11:5060;transport=tcp;r2=on;lr;ftag=ZUrDU2m4Z9Zam>
Route: <sip:11.15.32.11:5061;transport=tls;r2=on;lr;ftag=ZUrDU2m4Z9Zam>
f: <sip:user1@server>;tag=ZUrDU2m4Z9Zam
t: <sip:user3@server>;tag=gK0ea97395
i:sdfg8we790t874ujk
CSeq: 102 BYE
Content-Length: 0
###########################
When I send that to kamailio over UDP, kamailio relays it over a TCP
connection, as seen with socat here (socat runs on the machine with
address 11.15.32.1).
###########################
$ socat - TCP:11.15.32.11:5060,bind=:33333
BYE sip:user3@11.15.32.1:33333;transport=tls SIP/2.0
Via: SIP/2.0/TLS
11.15.32.11:5061;branch=z9hG4bKd2bf.137932ff9a937cde941fd1790db040c9.0
Via: SIP/2.0/UDP
0.0.0.0:11111;received=11.15.32.11;rport=11111;branch=z9hG4bK-d8754z-cc2c63344f5218d3-1
f: <sip:user1@server>;tag=ZUrDU2m4Z9Zam
t: <sip:user3@server>;tag=gK0ea97395
i:sdfg8we790t874ujk
CSeq: 102 BYE
Content-Length: 0
###########################
Note that
- the RURI has transport=tls in it,
- kamailio is forcing the TLS socket,
- kamailio is using the t_relay_to_tls function,
- the Route header field tells that TLS should be used, and
- the Via header field shows that kamailio tried to send this over TLS, but
- the BYE was sent over unencrypted TCP.
If I use this socat command instead, then I can receive the BYE,
showing that kamailio is able to use TLS if there's a connection
available.
- socat - OPENSSL:11.15.32.11:5061,bind=:33333,verify=no
I can't find any setting to control this, so it looks to me like a
kamailio bug. At that, I see this as a security flaw, because the SIP
traffic should always be encrypted but now is leaked.
Can anyone help?
James
Hi,
I use KEMI/Lua. I have simple lua class:
myclass = {}
myclass.event = function()
KSR.xlog.xinfo("Event working...\n")
end
In kamailio.conf have:
modparam("xhttp", "event_callback", "myclass.event")
In debug log have:
Mar 12 13:21:30 kamailio DEBUG: app_lua [app_lua_api.c:549]: sr_lua_reload_script(): No need to reload [/etc/kamailio/donjon.lua] is version 0
Mar 12 13:21:30 kamailio DEBUG: app_lua [app_lua_api.c:733]: app_lua_run_ex(): executing Lua function: [[myclass.event]]
Mar 12 13:21:30 kamailio DEBUG: app_lua [app_lua_api.c:735]: app_lua_run_ex(): lua top index is: 40
Mar 12 13:21:30 kamailio DEBUG: app_lua [app_lua_mod.c:164]: sr_kemi_config_engine_lua(): execution of route type 513 with name [myclass.event] returned 1
The problem is that the event function in the myclasses class is not called.
Is there any other way or syntax to do this? Of course, if I define a function without a class, it works.
Thanks
Michal
My SIP proxy didn't start with Kamailio 5.8 using the same config that
starts OK with 5.7. The error is:
2024-03-11T06:56:06.457107+02:00 lohi /usr/bin/sip-proxy[2358954]: DEBUG: acc [acc_mod.c:362]: parse_failed_filter(): failed_filter 0 = 407
2024-03-11T06:56:06.457265+02:00 lohi /usr/bin/sip-proxy[2358954]: ERROR: acc [acc_mod.c:369]: parse_failed_filter(): response code is not followed by comma or end of string
2024-03-11T06:56:06.457436+02:00 lohi /usr/bin/sip-proxy[2358954]: ERROR: acc [acc_mod.c:439]: mod_init(): failed to parse failed_filter param
The relevant params are:
modparam("acc", "failed_transaction_flag", 8)
modparam("acc", "failed_filter", "407")
I didn't find any difference in acc_mod.c source code between 5.7 and
5.8 and parse_failed_filter function looked OK.
Then I added a debug statement in the beginning of parse_failed_filter
function:
LM_DBG("parsing failed_filter %s\n", s);
and got to syslog:
cc_mod.c:341]: parse_failed_filter(): parsing failed_filter 407rmissions|pua|rtpengine)$
That explains the parse_failed_filter error, but where does that bogus
param value come from?
Before acc params I have:
modparam("auth_db|dialplan|domain|htable|lcr|msilo|mtree|permissions|pua|rtpengine", "db_url", "mysql://xxxx/sip_proxy")
modparam("registrar|nathelper", "received_avp", "$avp(received_uri)")
So it from there, but why? Is there a bug somewhere or is my SIP proxy
running out of memory or something? Before the above error messages,
there are no other error messages.
-- Juha
Hello Kamailians!
Before I start going down this path - anyone that has written a Kamailio Yocto layer and want to share either layer or experience or both?
For those that doesn’t know: Yocto is a toolkit for building your own Linux distros for embedded systems.
/O
Hi everyone
I have a small question:
i want to set up a basic SIP Redirect Server
so I install Kamailio v5.3
and comment default request route and set simple
request_route {
rewritehostport("1.2.3.4");
sl_send_reply("302", "Moved Temporarily");
}
but for some reason, Kamailio does not care about the port and sends a
reply to 5060
[image: image.png]
i also tried to delete rewritehostport
but it only deletes Contact: from the reply
but reply itself is still sent to 5060 port
[image: image.png]
--
*Antony*
satskiy.a(a)gmail.com
+380669197533
+48727830247
Kamailio 5.8 build generates on my Debian 12 the following warning:
core/mem/q_malloc.c:996:14: warning: 'qm_strnstr' defined but not used [-Wunused-function]
996 | static void *qm_strnstr(const void *b1, int l1, const void *b2, int l2)
| ^~~~~~~~~~
Perhaps the definition of the function should be #ifdef'ed by
DBG_QM_MALLOC.
-- Juha
I've been tasked to use LD_PRELOAD to log SSL keys for TLS connections
using a Diffie-Hellman cipher. The first attempt did not work, so I wanted
to sanity check whether Kamailio's TLS support is built in such a way that
would defeat LD_PRELOAD.
The instructions from the vendor are to update /etc/init.d/kamailio like
this:
env SSLKEYLOG_UDP='127.0.0.1:1234'
LD_PRELOAD="/usr/local/src/voipmonitor-git/tools/ssl_keylogger/sslkeylog.so
/usr/lib/x86_64-linux-gnu/libssl.so.3" \
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON -- $OPTIONS || log_failure_msg " already
running"
Is there anything special in Kamailio (5.7.3 on Debian 12) that would
prevent this from working? Not necessarily something to defeat a keylogger,
but maybe the way tls.so gets loaded?
The only discrepancy I've noticed is the vendor docs refer to libssl.so.3
not libssl.so.1, but the vendor said that should be OK.
I'd love to hear from someone already using VoIPmonitor with Diffie-Hellman
ciphers and Kamailio.
Hi kamailio community,
I have an issue with a Kamailio 5.7. It's listening both in TCP and
UDP. In my scenario requests arrive from devices on TCP, but I want to
forward to the next hops on UDP. I am avoiding using any type of DNS
resolution; since I am always forwarding to predefined next hops I am
using the dispatcher module (defined with the IP addresses and
transport=udp) or I wrote config files using t_relay_to_udp or
t_relay_to with a udp: followed by IP address. I never set up FQDNS
only IP addresses and in all of them I explicitly mention UDP.
In all of these scenarios I have tried Kamailio insists in trying to use
TCP with the next hop and failing because the next_hop is only UDP. I
guess because the message arrived using TCP Kamilio does that but I find
the behavior very confusing.
I nailed down that in my situation its the tm module function
prepare_new_uac (in file src/modules/tm/t_fwd.c line 119) being the one
that missbehaves. The documentation of the function says literraly :
"* t->uac[branch].request.dst will be filled if next_hop !=0 with the result
* of the DNS resolution (next_hop, fproto and fsocket).
* If next_hop is 0 all the dst members except the send_flags are read-only
* (send_flags it's updated) and are supposed to be pre-filled."
I found out that even when next_hop is 0 the function changes the
t->uac[branch].request.dst proto, socket etc. its there that the
kamailio takes the wrong decision, until that function is called within
add_auc, the destination proto or the fproto etc is always 1 (UDP)
which is what I am trying to force from the config file or the
dispatcher definition (I tried both ways). But after calling that
function then it comes as a 2 (TCP)
The problematic function is a monster of 500 lines and I would like to
avoid having to understand it. Since I think the scenario is not so
unusual I just want to ask if maybe I am missing something that I should
do to avoid the Kamailio to select TCP and in order to have the tm
module respecting my preference for UDP (either with dispatcher module
and the transport param or with t_relay_to or t_relay_to_udp I don't
care the way).
Any hints are welcome.
Best regards
alberto
Hi all!
got a weird behavior that I cannot understand the reason for...
In our LAB environment, we have 2 Asterisk instances (version 13.38.3
and chan_sip) and 1 Kamailio 5.7 in between.
All servers are in the same network, so, there is no NAT involved. No
RTPEngine either.
Network is 10.20.0.0/24 and Asterisk #1 has IP .1 Asterisk #2 has IP
.3 and Kamailio has IP .5
The Asterisk servers are used only for testing, nothing serious.
However, Kamailio is setup to use RTJson requesting routes to a
Routing Server on the same network. And it works fine.
Both Asterisk servers have the same dialplan, which only Answers the
call and plays MOH on both ends so that RTP audio streams both ways.
When making a call on Asterisk Server #1 via command line to go
directly to Asterisk Server #2 without using Kamailio (CLI> channel
originate SIP/123(a)10.20.0.3 application MusicOnHold() ) the Asterisk
#2 receives the call, answers and plays MOH too and I can see RTP
streams coming from both ends correctly.
However, if I use Kamailio to proxy the call generated from Asterisk
#1 to Asterisk #2, using similar command line instruction (CLI>
channel originate SIP/123(a)10.20.0.5 application MusicOnHold() ), the
call is indeed received on Kamailio who then sends it to Asterisk #2,
who answers the call and plays MOH, *but* despite the audio stream
being sent to Asterisk #1 it is never received, however audio from
Asterisk #1 is received by Asterisk #2, which configures a typical One
Way Audio issue due to NAT.
This is where it gets strange, because there is no NAT, SDP on INVITE
and SIP 200 messages seem OK, as far as I understand it.
Also, Asterisk servers have SIP configuration with directmedia enabled
and NAT disabled to make sure that media is direct. But I have also
tried with directmedia disabled and NAT enabled and get identical
results.
I am most probably missing some tiny detail, but I have no clue....
and I bet it is simple and stupid....
Could another pair of eyes help me with this? What is wrong? Do I
really need RTPEngine even when the network has no NAT? I am sure it
would work that way, but it doesn't make sense...
Here are some screenshots:
Call Scenario #1 - direct call from Asterisk #1 to Asterisk #2 without
Kamailio in between:
Invite from Asterisk #1 to Asterisk #2 with direct media between both ends:
https://drive.google.com/file/d/1eLjT3nr_Rc-UBaf4QhIgZ95bjETOVvxo/view?usp=…
Replies from Asterisk #2 to Asterisk #1 with direct media between both ends:
https://drive.google.com/file/d/11lLcB-V8rWGSrVqWiit-q9WX2FfqB6BZ/view?usp=…
Call Scenario #2 - call from Asterisk #1 using Kamailio to relay call
to Asterisk #2, with one way audio
Invite from Asterisk #1 to Asterisk #2 via Kamailio with SDP details:
https://drive.google.com/file/d/1Cp9xrGcwNmQ9Ks36N_oD1Dj7lxfu-tbH/view?usp=…
Invite from Kamailio relayed to Asterisk #2 with SDP details from
Asterisk #1 identical to above:
https://drive.google.com/file/d/1mi3FCNjM3luXfENEp-0088XLgcyfXRK6/view?usp=…
Reply from Asterisk #2 to Kamailio with SDP details:
https://drive.google.com/file/d/1TpMGe2tvpX_5SIpSbm2b3Zro9EuYwcO-/view?usp=…
Reply from Kamailio to Asterisk #2 with SDP details from Asterisk #2
identical to above:
https://drive.google.com/file/d/12jq5APfFwVVPc0vJ3RkcXyN1hBE51fnQ/view?usp=…
As we can see, SDP details seem OK, but if I check call flow on
Asterisk #1, I can only find 1 RTP channel with audio coming from
Asterisk #2
https://drive.google.com/file/d/1iEfvkylZVbthHM5kxkurWh-GAYCYLytl/view?usp=…
and the same on Asterisk #2 :
https://drive.google.com/file/d/12rvf9Lrwp-MNZvGCwlXEEBsBRmfcinph/view?usp=…
My Kamailio.cfg is as follows:
#!KAMAILIO
#
# config file for SIPProxy
# - load balancing of VoIP calls
# - no TPC listening
#
# Kamailio (OpenSER) SIP Server v3.2
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
# - define WITH_DEBUG
#
#!define WITH_DEBUG
###!define WITH_NAT
#!define WITH_PSTN
/* enables Accounting Log functions */
#!define FLT_ACC 1
/* enable Accounting of missed or failed calls */
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3
/* defines DB connection string */
#!ifndef DBURL
#!define DBURL "mysql://kamailio:kamailio@10.20.0.1:3306/kamailio"
#!endif
# - the value for 'use_domain' parameters
#!define MULTIDOMAIN 1
####### Global Parameters #########
#!ifdef WITH_DEBUG
debug=4
log_stderror=no
#!else
debug=2
log_stderror=no
#!endif
#!define FLT_DISPATCH_SETID 1
#!define FLT_FS 10
#!define FLT_NATS 5
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7
#!define FLT_SRC_ALLOWED 8
#!define FLT_DST_INTERNAL_IP 9
#!define FLT_SRC_INTERNAL_IP 10
#!substdef "!INTERNAL_IP_NET!10.20.0.0/24!g"
#!substdef "!INTERNAL_IP_ADDR!10.20.0.2!g"
#!substdef "!EXTERNAL_IP_ADDR!10.20.0.2!g"
#!ifndef HTTP_ASYNC_CLIENT_WORKERS
#!define HTTP_ASYNC_CLIENT_WORKERS 8
#!endif
/* add API http timeout */
#!define HTTP_API_TIMEOUT 5000
#!define HTTP_API_ROUTING_ENDPOINT "http://10.246.212.40:7778/get_route"
/* DMQ SIP message sharing */
#!define DMQ_PORT 5062
#!define DMQ_LISTEN "sip:10.20.0.2:5062"
#!define DMQ_SERVER_ADDRESS "sip:10.20.0.2:5062"
#!define DMQ_NOTIFICATION_ADDRESS "sip:10.20.0.4:5062"
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
fork=yes
children=8
/* comment the next line to enable TCP - all trunks are UDP only */
disable_tcp=yes
/* uncomment the next line to disable the auto discovery of local aliases
based on revers DNS on IPs (default on) */
auto_aliases=no
port=5060
/* uncomment and configure the following line if you want Kamailio to
bind on a specific interface/port/proto (default bind on all available) */
listen=udp:10.20.0.5:5060 advertise 10.20.0.5:5060
listen=tcp:10.20.0.5:5060 advertise 10.20.0.5:5060
listen=udp:10.20.0.2:5062
advertised_address="10.20.0.5";
sip_warning=no;
use_dns_failover = on;
####### Modules Section ########
#set module path
mpath="/usr/local/lib64/kamailio/modules/"
loadmodule "db_mysql.so"
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "acc.so"
loadmodule "usrloc.so"
loadmodule "nathelper.so"
#loadmodule "rtimer.so"
#loadmodule "sqlops.so"
# --- CPS Limiter
# --- end of CPS Limiter
loadmodule "ipops.so"
loadmodule "textopsx.so"
loadmodule "sdpops.so"
loadmodule "http_async_client.so"
loadmodule "rtjson.so"
loadmodule "jansson.so"
loadmodule "dmq.so"
loadmodule "dmq_usrloc.so"
loadmodule "htable.so"
loadmodule "dialog.so"
#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif
#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "log_level_name", "exec")
#!endif
# ----------------- setting module-specific parameters ---------------
# ----- jsonrpcs params -----
modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
modparam("jsonrpcs", "pretty_format", 1)
# ----- rr params -----
modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
modparam("jsonrpcs", "pretty_format", 1)
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)
# ----- acc params -----
modparam("acc", "failed_transaction_flag", 3)
modparam("acc",
"log_extra","src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc",
"log_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
/* enhanced DB accounting */
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_url", DBURL)
modparam("acc",
"db_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
//;calltype=$avp(calltype)")
# ----- tm params -----
# ----- the TM module enables stateful processing of SIP requests
modparam("tm", "fr_timer", 5000)
modparam("tm", "fr_inv_timer", 60000)
modparam("tm", "remap_503_500", 0)
# ----- usrloc params -----
/* enable DB persistency for location entries */
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "use_domain", MULTIDOMAIN)
# params needed for NAT traversal in other modules
modparam("usrloc", "nat_bflag", FLB_NATB)
# ----- nathelper params -----
modparam("nathelper", "received_avp", "$avp(s:rcv)")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
modparam("nathelper", "sipping_from", "sip:ping@kamailio.org")
#modparam("rtimer", "timer", "name=cdr;interval=300;mode=1;")
#modparam("rtimer", "exec", "timer=cdr;route=CDRS")
#modparam("sqlops", "sqlcon",
"ca=>mysql://kamailio:kamailiorw@10.19.139.113:3306/kamailio")
#modparam("dmq", "server_socket", DMQ_SERVER_SOCKET )
modparam("dmq", "server_address", DMQ_SERVER_ADDRESS )
modparam("dmq", "notification_address", DMQ_NOTIFICATION_ADDRESS )
modparam("dmq", "multi_notify", 1)
modparam("dmq", "num_workers", 4)
modparam("dmq", "ping_interval", 60)
modparam("dmq_usrloc", "enable", 1)
# -- CPS Limiter
modparam("htable", "htable", "rhs=>size=32;initval=0;autoexpire=10;")
modparam("htable", "htable", "rhm=>size=32;initval=0;autoexpire=120;")
modparam("htable", "enable_dmq", 1)
modparam("htable", "dmq_init_sync", 1)
modparam("dialog", "profiles_with_value", "concurrent_calls")
modparam("dialog", "enable_dmq", 1)
# ----- http_async_client params -----
modparam("http_async_client", "workers", HTTP_ASYNC_CLIENT_WORKERS)
modparam("http_async_client", "connection_timeout", 2000)
####### Routing Logic ########
# main request routing logic
route {
if (is_method("KDMQ") && $Rp == 5062)
{
dmq_handle_message();
}
xlog("L_INFO"," ********** Route START ***********");
# log the basic info regarding this call
xlog("L_INFO","start|\n");
xlog("L_INFO","===================================================\n");
xlog("L_INFO","New SIP message $rm with call-ID $ci \n");
xlog("L_INFO","---------------------------------------------------\n");
xlog("L_INFO"," received $pr request $rm $ou\n");
xlog("L_INFO"," source $si:$sp\n");
xlog("L_INFO"," from $fu\n");
xlog("L_INFO"," to $tu\n");
xlog("L_INFO","---------------------------------------------------\n");
xlog("L_INFO","---------------------------------------------------\n");
# OPTIONS requests without a username in the Request-URI but one
# of our domains or IPs are addressed to the proxy itself and
# can be answered statelessly.
if (is_method("OPTIONS"))
{
sl_send_reply("200","OK");
exit;
}
if ($fU=="ping")
{
sl_send_reply("200","OK");
exit;
}
# extract original source ip / port from X-forwarded-For header
route(HANDLE_X_FORWARDED_FOR);
# per request initial checks
route(REQINIT);
# NAT detection
route(NATDETECT);
# handle requests within SIP dialogs
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans()){
route(RELAY);
}
exit;
}
# handle retransmissions
if (!is_method("ACK")) {
if(t_precheck_trans()) {
t_check_trans();
xlog("L_INFO", "ROUTE - Exiting after Retransmission check - method $rm");
exit;
}
t_check_trans();
}
route(WITHINDLG);
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
xlog("L_INFO", "ROUTE - Removing Headers");
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE")){
t_on_failure("MANAGE_FAILURE");
xlog("L_INFO", "ROUTE - Recording Route");
record_route();
if (is_method("INVITE") && is_request()) {
if (has_body("application/sdp")) {
xlog("L_INFO", "ROUTE - goiing to t_on_reply[ON_REPLY]\n");
t_on_reply("ON_REPLY");
}
}
}
if ($rU==$null)
{
# request with no Username in RURI
sl_send_reply("484","ROUTE - Address Incomplete");
exit;
}
route(TOCARRIER);
xlog("L_INFO", " ********** Route END *************");
}
# extract original source ip / port from X-forwarded-For header
route[HANDLE_X_FORWARDED_FOR] {
if (is_present_hf("X-Forwarded-For")) {
$var(source_ip) = $(hdr(X-Forwarded-For){s.select,0,:});
$var(source_port) = $(hdr(X-Forwarded-For){s.select,1,:});
} else {
$var(source_ip) = $si;
$var(source_port) = $sp;
}
$var(to_number) = $rU;
}
route[RELAY_API] {
xlog("L_INFO","RELAY_API - from_ip $var(source_ip):$var(source_port)
from_number $fU to_number $ru");
$http_req(all) = $null;
$http_req(suspend) = 1;
$http_req(timeout) = HTTP_API_TIMEOUT;
$http_req(method) = "POST";
$http_req(hdr) = "Content-Type: application/json";
jansson_set("string","from_ip",$var(source_ip), "$var(http_routing_query)");
jansson_set("string","from_port",$var(source_port), "$var(http_routing_query)");
jansson_set("string","from_number",$fU, "$var(http_routing_query)");
jansson_set("string","to_number",$var(to_number) , "$var(http_routing_query)");
xlog("L_INFO","RELAY_API - API ASYNC ROUTING REQUEST:
$var(http_routing_query)\n");
$http_req(body) = $var(http_routing_query);
t_newtran();
http_async_query(HTTP_API_ROUTING_ENDPOINT, "RELAY_API_RESPONSE");
}
# Relay request using the API (response)
route[RELAY_API_RESPONSE] {
if ($http_ok==1 && $http_rs==200)
{
xlog("L_INFO","RELAY_API_RESPONSE - RESPONSE: $http_rb\n");
if (jansson_get("rtjson", $http_rb, "$var(rtjson)")) {
xlog("L_INFO","RELAY_API_RESPONSE - $var(rtjson)");
rtjson_init_routes("$var(rtjson)");
rtjson_push_routes();
# relay the message
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
return;
}
}
send_reply(500, "API Not Available - http response = $http_rs $http_ok");
exit;
}
onreply_route[ON_REPLY] {
xlog("L_INFO", "ON_REPLY - In onreply_route[ON_REPLY] $rs");
# on reply
if (t_check_status("183|180|200")) {
xlog("L_INFO", "ON_REPLY - Fixing Contacts");
# subst_hf("Contact","/@.*:/@EXTERNAL_IP_ADDR:/","a");
//subst_hf("Record-Route","/INTERNAL_IP_ADDR/EXTERNAL_IP_ADDR/","f");
}
if (has_body("application/sdp")){
if (sdp_remove_line_by_prefix("a=maxptime")){
xlog("L_INFO", "ON_REPLY - remove maxptime ");
msg_apply_changes();
}
else{
xlog("L_INFO", "ON_REPLY - did not removed maxptime ");
}
}
if (t_check_status("408")) {
xlog("L_INFO", "ROUTE - Handling 408 Timeout\n");
}
}
route[TOCARRIER]{
#using rtjson, unsomment following line
route(RELAY_API);
}
# Per SIP request initial checks
route[REQINIT] {
xlog("L_INFO", "REQINIT - Starting");
if (!mf_process_maxfwd_header("10")) {
xlog("L_INFO", "REQINIT - 483 - Too Many Hops");
sl_send_reply("483","Too Many Hops");
exit;
}
if(!sanity_check("1511", "7"))
{
xlog("L_INFO","REQINIT - Sanity Check -> Malformed SIP message from $si:$sp\n");
exit;
}
}
# Caller NAT detection
route[NATDETECT] {
xlog("L_INFO", "NATDETECT - Entering");
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (is_method("REGISTER")) {
xlog("L_INFO", "NATDETECT - Fix Nated Register");
fix_nated_register();
} else {
if(is_first_hop()){
xlog("L_INFO", "NATDETECT - Set Contact Alias");
set_contact_alias();
}
}
xlog("L_INFO", "NATDETECT - Set FLT_NATS" + FLT_NATS);
setflag(FLT_NATS);
}
#!endif
xlog("L_INFO", "NATDETECT - NAT Detect set FLT_NTS = " + FLT_NATS);
return;
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
xlog("L_INFO", "WITHINDLG - Entering");
if (!has_totag()) return;
if (is_present_hf("Route") && $hdrc(Route)==1)
{
if (search_hf("Route", ".*EXTERNAL_IP_ADDR.*", "f"))
{
xlog("L_INFO", "WITHINDLG - Removing the route to self");
remove_hf("Route");
}
}
# sequential request within a dialog should
# take the path determined by record-routing
if (loose_route()) {
route(DLGURI);
if (is_method("BYE|CANCEL")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
}
else if ( is_method("ACK") ) {
# ACK is forwarded statelessy
xlog("L_INFO", "WITHINDLG - Going to NATMANAGE");
route(NATMANAGE);
}
else if ( is_method("NOTIFY") ) {
#Add Record-Route for in-dialog NOTIFY as per RFC 6665.
record_route();
}
if(is_method("BYE"))
xlog("L_INFO", "WITHINDLG - BYE message from $rU");
route(RELAY);
exit;
}
if ( is_method("ACK|BYE|INVITE|UPDATE") ) {
if ( t_check_trans() ) {
# no loose-route, but stateful ACK;
# must be an ACK after a 487
# or e.g. 404 from upstream server
route(RELAY);
exit;
} else {
# ACK without matching transaction. Try to route anyway - being optimistic
# since it has at least a To Tag
route(RELAY);
exit;
}
}
sl_send_reply("404","Not here");
xlog("L_INFO", "WITHINDLG - Finishing WITHINDLG");
exit;
}
# URI update for dialog requests
route[DLGURI] {
xlog("L_INFO", "WITHINDLG - Entering DLGURI");
#!ifdef WITH_NAT
if(!isdsturiset()) {
xlog("L_INFO", "WITHINDLG - Handle ruri ALIAS");
handle_ruri_alias();
}
#!endif
return;
}
# Routing to foreign domains ---> NOT USED
route[SIPOUT] {
xlog("L_INFO", "WITHINDLG - Entering SIPOUT");
if (uri==myself){
xlog("L_INFO", "WITHINDLG - URI is MySelf!");
return;
}
append_hf("P-hint: outbound\r\n");
xlog("L_INFO", "WITHINDLG - Finishing SIPOUT");
route(RELAY);
exit;
}
# Wrapper for relaying requests
route[RELAY] {
xlog("L_INFO", " ******** RELAY *******");
xlog("L_INFO", "RELAY - $si $su $ru");
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE|CANCEL|SUBSCRIBE|UPDATE")) {
if(!t_is_set("branch_route")) {
xlog("L_INFO", "RELAY - branch_route NOT SET!");
t_on_branch("MANAGE_BRANCH");
}
}
xlog("L_INFO", "RELAY - checking method");
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
xlog("L_INFO", "RELAY - is INVITE|SUBSCRIBE|UPDATE");
if(!t_is_set("onreply_route")) {
xlog("L_INFO", "RELAY - onreply_route NOT SET!");
t_on_reply("ON_REPLY"); # MANAGE_REPLY");
}
}
if (is_method("INVITE")) {
xlog("L_INFO", "RELAY - is INVITE");
t_on_failure("FAILED_RELAY");
if(!t_is_set("failure_route")) {
xlog("L_INFO", "RELAY - failure_route NOT SET!");
t_on_failure("MANAGE_FAILURE");
}
}
if (!t_relay()) {
xlog("L_INFO", "RELAY - t_relay returns FALSE");
route("MANAGE_FAILURE");
#sl_reply_error();
}
xlog("L_INFO", "RELAY - exiting");
exit;
}
failure_route[FAILED_RELAY] {
xlog("L_INFO", "FAILED_RELAY - Entering");
if (t_check_status("[4-5][0-9][0-9]")){
xlog("L_INFO", "FAILED_RELAY - Could not reach destination endpoint!");
if (rtjson_next_route()) {
xlog("L_INFO", "MANAGE_FAILURE - Getting next route");
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
}
}
}
route[NATMANAGE] {
xlog("L_INFO", "NATMANAGE - Entering");
#!ifdef WITH_NAT
if (is_request()) {
if(has_totag()) {
xlog("L_INFO", "NATMANAGE - nat=yes --- Setting FLB_NATB");
setbflag(FLB_NATB);
}
}
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB) ))
{
xlog("L_INFO", "NATMANAGE - NO FLT_NATS/B Set!!! Getting
out of NATMANAGE");
return;
}
if (is_request()) {
xlog("L_INFO", "NATMANAGE - is_request - $rm from $si");
if (!has_totag()) {
if(t_is_branch_route()) {
xlog("L_INFO", "NATMANAGE - adding nat=yes");
add_rr_param(";nat=yes");
}
}
}
if (is_reply()) {
xlog("L_INFO", "NATMANAGE - is_reply - $rm from $si");
if(isbflagset(FLB_NATB)) {
if(is_first_hop())
{
xlog("L_INFO", "NATMANAGE - Set Contact Alias");
set_contact_alias();
}
}
}
#!endif
return;
}
# Manage failure routing cases
route[MANAGE_FAILURE] {
xlog("L_INFO", "MANAGE_FAILURE - Entering ");
route(NATMANAGE);
xlog("L_INFO", "MANAGE_FAILURE - t_is_canceled");
if (t_is_canceled()) exit;
#!ifdef WITH_BLOCK3XX
# block call redirect based on 3xx replies.
if (t_check_status("3[0-9][0-9]")) {
xlog("L_INFO", "MANAGE_FAILURE - SIP 3XX returned!!");
t_reply("404","Not found");
exit;
}
#!endif
#!ifdef WITH_BLOCK401407
# block call redirect based on 401, 407 replies.
if (t_check_status("401|407")) {
xlog("L_INFO", "MANAGE_FAILURE - SIP 401|407 returned!!");
t_reply("404","Not found");
exit;
}
#!endif
if (t_check_status("503")){
xlog("L_INFO", "MANAGE_FAILURE - SIP 503 returned : no destination available");
t_reply("503", "Destination not available");
exit;
}
if (rtjson_next_route()) {
xlog("L_INFO", "MANAGE_FAILURE - Getting next route!!");
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
exit;
}
}
# Manage outgoing branches
branch_route[MANAGE_BRANCH] {
xlog("L_INFO","MANAGE_BRANCH - New branch [$T_branch_idx] to $ru\n");
xlog("L_INFO", "MANAGE_BRANCH - branch_route MANAGE_BRANCH 1 ");
rtjson_update_branch();
route(NATMANAGE);
}
Any help would be greatly appreciated.
Thanks in advance.
Sérgio Charrua
Kamailio v5.8.0 is out – it comes with 4 new modules and a large set of
improvements touching again more than 50 existing modules.
You can read a bit more detailed release notes at:
* https://www.kamailio.org/w/kamailio-v5-8-0-release-notes/
Many thanks to all developers and community members that made possible
this release.
v5.8.0 brings more flexibility and optimizations across many existing
components and modules, new parameters, functions, variables and
transformations.
Enjoy Kamailio v5.8.0!
Thank you for flying Kamailio!
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com
Hi all,
I am using uac_replace_to to replace the TO header on requests. I
understand it can only be called once per message and the recommendation is
to store the updated value in a pvar and apply it in the branch route.
However in my scenario I wish to first try one endpoint and then if it gets
a 4XX response forward it to another UAC, and update the TO accordingly.
Currently trying to call uac_replace_to twice shows an error and corrupts
the TO header. Is there a work around for this?
Thanks again
Matthew
Hello,
discussed a bit during the online Kamailio devel meeting, it is time to
set the milestones towards the next major Kamailio release series v5.8.x.
If no other suggestions that suit more developers, I would propose to
freeze by end of this month or early February, then test for about 4
weeks as usual and release by end of February or during March.
If anyone wants to add new features/modules, they have to be published
till freezing date, either pushed in the git repository or proposed as
pull request.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio Advanced Training, February 20-22, 2024 -- asipto.com
Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com
Hi all,
I am using Kamailio 5.7.4 on a Debian 12 machine, with a Python Kemi based
config. I am seeing some intermittent failures when accessing an instance
variable within a function called by rtimer.
I'm using the rtimer module with the following parameters:
modparam("rtimer", "timer", "name=hello;interval=5;mode=0;")
modparam("rtimer", "exec", "timer=hello;route=ksr_route_hello")
I initialise the kamailio class, and instance variable like this:
class kamailio:
def __init__(self):
self.hello = "hi"
Within the class I have the following route function:
def ksr_route_hello(self, msg, evname):
KSR.info("Running ksr_route_hello\n")
KSR.info(f"Hello? {self.hello}\n")
Then in the logs I see it sometimes works, and sometimes fails:
9(15) INFO: <core> [core/kemi.c:106]: sr_kemi_core_info(): Running
ksr_route_hello
9(15) INFO: <core> [core/kemi.c:106]: sr_kemi_core_info(): Hello? hi
9(15) INFO: <core> [core/kemi.c:106]: sr_kemi_core_info(): Running
ksr_route_hello
9(15) ERROR: app_python3 [python_support.c:167]:
python_handle_exception(): apy_exec: ksr_route_hello(rtimer): Unhandled
exception in the Python code:
TypeError: 'NoneType' object cannot be interpreted as an integer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/etc/kamailio/kamailio.py", line 1007, in ksr_route_hello
KSR.info("Running ksr_route_hello\n")
SystemError: <built-in function info> returned a result with an exception
set
Does anyone know where I'm going wrong?
Thanks
Matthew
Hi all,
it might be a minor issue, or it might not be an issue at all, but I stumbled over following statements in RFC 3261:
Chapter 16.6 Request Forwarding (of a proxy)
1. Copy request
The proxy starts with a copy of the received request. The copy
MUST initially contain all of the header fields from the
received request. Fields not detailed in the processing
described below MUST NOT be removed. The copy SHOULD maintain
the ordering of the header fields as in the received request.
The proxy MUST NOT reorder field values with a common field
name (See Section 7.3.1<https://www.rfc-editor.org/rfc/rfc3261.html#section-7.3.1>). The proxy MUST NOT add to, modify,
or remove the message body.
An actual implementation need not perform a copy; the primary
requirement is that the processing for each next hop begin with
the same request.
Chapter 16.7 Response Processing (at a proxy)
9. Forward response
After performing the processing described in steps "Aggregate
Authorization Header Field Values" through "Record-Route", the
proxy MAY perform any feature specific manipulations on the
selected response. The proxy MUST NOT add to, modify, or
remove the message body. Unless otherwise specified, the proxy
MUST NOT remove any header field values other than the Via
header field value discussed in Section 16.7<https://www.rfc-editor.org/rfc/rfc3261.html#section-16.7> Item 3. In
particular, the proxy MUST NOT remove any "received" parameter
On the other hand, everywhere in the Internet (starting with stackoverflow), you can read it is OK, if a SIP proxy modifies a body, and also kamailio allows it.
Might be a question for the coffee break.
All the best
Christoph
Trying to setup Kamailio with MS Teams Direct Routing.
I am familiar with the integration steps required by Microsoft (using contact header as FQDN, certified CA for certificate) aswell as the famous guide; https://skalatan.de/en/blog/kamailio-sbc-teams + https://learn.microsoft.com/en-us/microsoftteams/direct-routing-protocols-s…
Sending any SIP requests (Invite, ACK, BYE) toward MS is working fine (with provisional response received in Kamailio) - so there is obviously a working connection between Kamailio <-> MS Direct Routing environment.
HOWEVER, once Kamailio is forwarding SIP responses to MS (provisional responses/200 OK received from UAS), then Kamailio is closing the TCP connection.
Please see attached logs below.
Any idea why Kamailio is closing the connection when trying to send provisional responses to MS?
- Using t_realy on original invite from MS
- tcp_reuse_port=yes, tcp_rd_buf_size = 16384, tcp_connection_lifetime=3605, children=8, socket_workers=4
- No override rules in firewall
- OS; debian:11.7
- Notice that TLS connection is made on port :26627 - however, MS sends port :5061 in VIA header (on first Invite). This seems to me to be a conflict in ports.
https://www.kamailio.org/wiki/cookbooks/5.4.x/core#reply_route
"There is no network route that can be enforced for a SIP reply - it is sent based on Via header, according to SIP RFC3261"
-----
Handshake complete for 52.114.76.76:26627
19(43) DEBUG: tls [tls_domain.c:818]: sr_ssl_ctx_info_callback(): SSL handshake done
19(43) DEBUG: tls [tls_server.c:473]: tls_accept(): TLS accept successful
19(43) DEBUG: tls [tls_server.c:476]: tls_accept(): tls_accept: new connection from 52.114.76.76:26627 using TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256
19(43) DEBUG: tls [tls_server.c:480]: tls_accept(): tls_accept: local socket: 10.129.0.91:5061
19(43) DEBUG: tls [tls_server.c:420]: tls_dump_cert_info(): tls_accept: client certificate subject:/C=US/ST=WA/L=Redmond/O=Microsoft Corporation/CN=sip.pstnhub.microsoft.com
19(43) DEBUG: tls [tls_server.c:424]: tls_dump_cert_info(): tls_accept: client certificate issuer:/C=US/O=Microsoft Corporation/CN=Microsoft Azure RSA TLS Issuing CA 04
-----
Kamailio trying to forward SIP response "183" to MS (response received from UAS).
Kamailio finds active connection by ID 13 / 0x7f4ecad0be08
20(44) DEBUG: {2 1 INVITE e926eb82d1a25bdc9ba03048cdbc5c77} <core> [core/tcp_main.c:1722]: _tcpconn_find(): found connection by id: 13
20(44) DEBUG: {2 1 INVITE e926eb82d1a25bdc9ba03048cdbc5c77} <core> [core/tcp_main.c:2627]: tcpconn_send_put(): tcp connection found (0x7f4ecad0be08), acquiring fd
20(44) DEBUG: {2 1 INVITE e926eb82d1a25bdc9ba03048cdbc5c77} <core> [core/tcp_main.c:2637]: tcpconn_send_put(): c=0x7f4ecad0be08, n=16
23(47) DEBUG: <core> [core/tcp_main.c:3982]: handle_ser_child(): read response= 7f4ecad0be08, 2, fd -1 from 20 (44)
20(44) DEBUG: {2 1 INVITE e926eb82d1a25bdc9ba03048cdbc5c77} <core> [core/tcp_main.c:2665]: tcpconn_send_put(): after receive_fd: c= 0x7f4ecad0be08 n=8 fd=12
20(44) DEBUG: {2 1 INVITE e926eb82d1a25bdc9ba03048cdbc5c77} <core> [core/tcp_main.c:2842]: tcpconn_do_send(): sending...
20(44) DEBUG: {2 1 INVITE e926eb82d1a25bdc9ba03048cdbc5c77} <core> [core/tcp_main.c:2878]: tcpconn_do_send(): after real write: c= 0x7f4ecad0be08 n=1191 fd=12
-----
Kamailio immediately closes the connection due to EOF.
19(43) DEBUG: <core> [core/tcp_read.c:280]: tcp_read_data(): EOF on connection 0x7f4ecad0be08 (state: 0, flags: 4018) - FD 10, bytes 0, rd-flags 10000 ([52.114.76.76]:26627 -> [52.114.76.76]:5061)19(43) DEBUG: <core> [core/tcp_read.c:1544]: tcp_read_req(): EOF
19(43) DEBUG: <core> [core/io_wait.h:597]: io_watch_del(): DBG: io_watch_del (0x555b3cf20260, 10, -1, 0x10) fd_no=2 called
19(43) DEBUG: <core> [core/tcp_read.c:1927]: handle_io(): removing from list 0x7f4ecad0be08 id 13 fd 10, state 2, flags 4018, main fd 57, refcnt 2 ([52.114.76.76]:26627 -> [52.114.76.76]:5061)
19(43) DEBUG: <core> [core/tcp_read.c:1702]: release_tcpconn(): releasing con 0x7f4ecad0be08, state -1, fd=10, id=13 ([52.114.76.76]:26627 -> [52.114.76.76]:5061)
Hello all,
I can't seem to find a way to make interim accounting requests for RADIUS. Can you help me with this?
I can't find any native way for doing this. I've thought of getting a custom timer for each dialog and run a event route similar do dialog:start or dialog:end. Is that possible?
Cheers,
Duarte Rocha
Hello guys,
I'm trying to add an xml with a boundary to an outgoing INVITE. But if i do:
set_body_multipart("$rb", "application/sdp", "delimiter");
msg_apply_changes();
append_body_part("$var(something)", "application/pidf+xml");
msg_apply_changes();
but kamailio adds the SDP, but NOT the second $var(something). If i switch
them and add firs the var, and then the SDP. kamailio adds the contents of
$var(something) but NOT the SDP.... point is it doesn't add the second
append
Thanks!!!
Regards,
David Villasmil
email: david.villasmil.work(a)gmail.com
phone: +34669448337
hi,
i have kamailio gw (5.6.x) for voxbone. dispatcher module
voxbone has separated inbound/outboud and prohibit sip options to
"inbound" IP
#traffic from voxbone
20 sip:81.201.82.45:5060;transport=udp 1 0 duid=abc;socket=udp:x.x.x.x:5060
#traffic TO voxbone
30 sip:81.201.89.110:5060;transport=udp 0 0 duid=abc;socket=udp:x.x.x.x:5060
is it possible send sip options per GW with dispatcher module?
i tried flag "1 (bit at index 0 - 1 <<0) - inactive destination"
https://www.kamailio.org/docs/modules/devel/modules/dispatcher.html#idm1059
Marek
Hi all!
got a weird behavior that I cannot understand the reason for...
In our LAB environment, we have 2 Asterisk instances (version 13.38.3 and
chan_sip) and 1 Kamailio 5.7 in between.
All servers are in the same network, so, there is no NAT involved. No
RTPEngine neither.
Network is 10.20.0.0/24 and Asterisk #1 has IP .1 Asterisk #2 has IP .3
and Kamailio has IP .5
The Asterisk servers are used only for testing, nothing serious. However,
Kamailio is setup to use RTJson requesting routes to a Routing Server on
the same network. And it works fine.
Both Asterisk servers have the same dialplan, which only Answers the call
and plays MOH on both ends so that RTP audio streams both ways.
When making a call on Asterisk Server #1 via command line to go directly to
Asterisk Server #2 without using Kamailio (CLI> channel originate SIP/
123(a)10.20.0.*3* application MusicOnHold() ) the Asterisk #2 receives the
call, answers and plays MOH too and I can see RTP streams coming from both
ends correctly.
However, if I use Kamailio to proxy the call generated from Asterisk #1 to
Asterisk #2, using similar command line instruction (CLI> channel originate
SIP/123(a)10.20.0.5 application MusicOnHold() ), the call is indeed received
on Kamailio who then sends it to Asterisk #2, who answers the call and
plays MOH, *but* despite the audio stream being sent to Asterisk #1 it is
never received, however audio from Asterisk #1 is received by Asterisk #2,
which configures a typical One Way Audio issue due to NAT.
This is where it gets strange, because there is no NAT, SDP on INVITE and
SIP 200 messages seem OK, as far as I understand it.
Also, Asterisk servers have SIP configuration with directmedia enabled and
NAT disabled to make sure that media is direct. But I have also tried with
directmedia disabled and NAT enabled and get identical results.
I am most probably missing some tiny detail, but I have no clue.... and I
bet it is simple and stupid....
Could another pair of eyes help me with this? What is wrong? Do I really
need RTPEngine even when the network has no NAT? I am sure it would work
that way, but it doesn't make sense...
Here are some screenshots:
Call Scenario #1 - direct call from Asterisk #1 to Asterisk #2 without
Kamailio in between:
Invite from Asterisk #1 to Asterisk #2 with direct media between both ends:
[image: image.png]
Replies from Asterisk #2 to Asterisk #1 with direct media between both ends:
[image: image.png]
Call Scenario #2 - call from Asterisk #1 using Kamailio to relay call to
Asterisk #2, with one way audio
Invite from Asterisk #1 to Asterisk #2 via Kamailio with SDP details:
[image: image.png]
Invite from Kamailio relayed to Asterisk #2 with SDP details from Asterisk
#1 identical to above:
[image: image.png]
Reply from Asterisk #2 to Kamailio with SDP details:
[image: image.png]
Reply from Kamailio to Asterisk #2 with SDP details from Asterisk #2
identical to above:
[image: image.png]
As we can see, SDP details seem OK, but if I check call flow on Asterisk
#1, I can only find 1 RTP channel with audio coming from Asterisk #2
[image: image.png]
and the same on Asterisk #2 :
[image: image.png]
My Kamailio.cfg :
#!KAMAILIO
#
# config file for SIPProxy
# - load balancing of VoIP calls
# - no TPC listening
#
# Kamailio (OpenSER) SIP Server v3.2
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
# - define WITH_DEBUG
#
#!define WITH_DEBUG
###!define WITH_NAT
#!define WITH_PSTN
/* enables Accounting Log functions */
#!define FLT_ACC 1
/* enable Accounting of missed or failed calls */
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3
/* defines DB connection string */
#!ifndef DBURL
#!define DBURL "mysql://kamailio:kamailio@10.20.0.1:3306/kamailio"
#!endif
# - the value for 'use_domain' parameters
#!define MULTIDOMAIN 1
####### Global Parameters #########
#!ifdef WITH_DEBUG
debug=4
log_stderror=no
#!else
debug=2
log_stderror=no
#!endif
#!define FLT_DISPATCH_SETID 1
#!define FLT_FS 10
#!define FLT_NATS 5
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7
#!define FLT_SRC_ALLOWED 8
#!define FLT_DST_INTERNAL_IP 9
#!define FLT_SRC_INTERNAL_IP 10
#!substdef "!INTERNAL_IP_NET!10.20.0.0/24!g"
#!substdef "!INTERNAL_IP_ADDR!10.20.0.2!g"
#!substdef "!EXTERNAL_IP_ADDR!10.20.0.2!g"
#!ifndef HTTP_ASYNC_CLIENT_WORKERS
#!define HTTP_ASYNC_CLIENT_WORKERS 8
#!endif
/* add API http timeout */
#!define HTTP_API_TIMEOUT 5000
#!define HTTP_API_ROUTING_ENDPOINT "http://10.246.212.40:7778/get_route"
/* DMQ SIP message sharing */
#!define DMQ_PORT 5062
#!define DMQ_LISTEN "sip:10.20.0.2:5062"
#!define DMQ_SERVER_ADDRESS "sip:10.20.0.2:5062"
#!define DMQ_NOTIFICATION_ADDRESS "sip:10.20.0.4:5062"
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
fork=yes
children=8
/* comment the next line to enable TCP - all trunks are UDP only */
disable_tcp=yes
/* uncomment the next line to disable the auto discovery of local aliases
based on revers DNS on IPs (default on) */
auto_aliases=no
port=5060
/* uncomment and configure the following line if you want Kamailio to
bind on a specific interface/port/proto (default bind on all available)
*/
listen=udp:10.20.0.5:5060 advertise 10.20.0.5:5060
listen=tcp:10.20.0.5:5060 advertise 10.20.0.5:5060
listen=udp:10.20.0.2:5062
advertised_address="10.20.0.5";
sip_warning=no;
use_dns_failover = on;
####### Modules Section ########
#set module path
mpath="/usr/local/lib64/kamailio/modules/"
loadmodule "db_mysql.so"
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "acc.so"
loadmodule "usrloc.so"
loadmodule "nathelper.so"
#loadmodule "rtimer.so"
#loadmodule "sqlops.so"
# --- CPS Limiter
# --- end of CPS Limiter
loadmodule "ipops.so"
loadmodule "textopsx.so"
loadmodule "sdpops.so"
loadmodule "http_async_client.so"
loadmodule "rtjson.so"
loadmodule "jansson.so"
loadmodule "dmq.so"
loadmodule "dmq_usrloc.so"
loadmodule "htable.so"
loadmodule "dialog.so"
#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif
#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "log_level_name", "exec")
#!endif
# ----------------- setting module-specific parameters ---------------
# ----- jsonrpcs params -----
modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
modparam("jsonrpcs", "pretty_format", 1)
# ----- rr params -----
modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
modparam("jsonrpcs", "pretty_format", 1)
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)
# ----- acc params -----
modparam("acc", "failed_transaction_flag", 3)
modparam("acc",
"log_extra","src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable "append_fromtag"
in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc",
"log_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
/* enhanced DB accounting */
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_url", DBURL)
modparam("acc",
"db_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
//;calltype=$avp(calltype)")
# ----- tm params -----
# ----- the TM module enables stateful processing of SIP requests
modparam("tm", "fr_timer", 5000)
modparam("tm", "fr_inv_timer", 60000)
modparam("tm", "remap_503_500", 0)
# ----- usrloc params -----
/* enable DB persistency for location entries */
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "use_domain", MULTIDOMAIN)
# params needed for NAT traversal in other modules
modparam("usrloc", "nat_bflag", FLB_NATB)
# ----- nathelper params -----
modparam("nathelper", "received_avp", "$avp(s:rcv)")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
modparam("nathelper", "sipping_from", "sip:ping@kamailio.org")
#modparam("rtimer", "timer", "name=cdr;interval=300;mode=1;")
#modparam("rtimer", "exec", "timer=cdr;route=CDRS")
#modparam("sqlops", "sqlcon", "ca=>mysql://
kamailio:kamailiorw@10.19.139.113:3306/kamailio")
#modparam("dmq", "server_socket", DMQ_SERVER_SOCKET )
modparam("dmq", "server_address", DMQ_SERVER_ADDRESS )
modparam("dmq", "notification_address", DMQ_NOTIFICATION_ADDRESS )
modparam("dmq", "multi_notify", 1)
modparam("dmq", "num_workers", 4)
modparam("dmq", "ping_interval", 60)
modparam("dmq_usrloc", "enable", 1)
# -- CPS Limiter
modparam("htable", "htable", "rhs=>size=32;initval=0;autoexpire=10;")
modparam("htable", "htable", "rhm=>size=32;initval=0;autoexpire=120;")
modparam("htable", "enable_dmq", 1)
modparam("htable", "dmq_init_sync", 1)
modparam("dialog", "profiles_with_value", "concurrent_calls")
modparam("dialog", "enable_dmq", 1)
# ----- http_async_client params -----
modparam("http_async_client", "workers", HTTP_ASYNC_CLIENT_WORKERS)
modparam("http_async_client", "connection_timeout", 2000)
####### Routing Logic ########
# main request routing logic
route {
if (is_method("KDMQ") && $Rp == 5062)
{
dmq_handle_message();
}
xlog("L_INFO"," ********** Route START ***********");
# log the basic info regarding this call
xlog("L_INFO","start|\n");
xlog("L_INFO","===================================================\n");
xlog("L_INFO","New SIP message $rm with call-ID $ci \n");
xlog("L_INFO","---------------------------------------------------\n");
xlog("L_INFO"," received $pr request $rm $ou\n");
xlog("L_INFO"," source $si:$sp\n");
xlog("L_INFO"," from $fu\n");
xlog("L_INFO"," to $tu\n");
xlog("L_INFO","---------------------------------------------------\n");
xlog("L_INFO","---------------------------------------------------\n");
# OPTIONS requests without a username in the Request-URI but one
# of our domains or IPs are addressed to the proxy itself and
# can be answered statelessly.
if (is_method("OPTIONS"))
{
sl_send_reply("200","OK");
exit;
}
if ($fU=="ping")
{
sl_send_reply("200","OK");
exit;
}
# extract original source ip / port from X-forwarded-For header
route(HANDLE_X_FORWARDED_FOR);
# per request initial checks
route(REQINIT);
# NAT detection
route(NATDETECT);
# handle requests within SIP dialogs
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans()){
route(RELAY);
}
exit;
}
# handle retransmissions
if (!is_method("ACK")) {
if(t_precheck_trans()) {
t_check_trans();
xlog("L_INFO", "ROUTE - Exiting after Retransmission check - method $rm");
exit;
}
t_check_trans();
}
route(WITHINDLG);
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
xlog("L_INFO", "ROUTE - Removing Headers");
remove_hf("Route");
if (is_method("INVITE|SUBSCRIBE")){
t_on_failure("MANAGE_FAILURE");
xlog("L_INFO", "ROUTE - Recording Route");
record_route();
if (is_method("INVITE") && is_request()) {
if (has_body("application/sdp")) {
xlog("L_INFO", "ROUTE - goiing to t_on_reply[ON_REPLY]\n");
t_on_reply("ON_REPLY");
}
}
}
if ($rU==$null)
{
# request with no Username in RURI
sl_send_reply("484","ROUTE - Address Incomplete");
exit;
}
route(TOCARRIER);
xlog("L_INFO", " ********** Route END *************");
}
# extract original source ip / port from X-forwarded-For header
route[HANDLE_X_FORWARDED_FOR] {
if (is_present_hf("X-Forwarded-For")) {
$var(source_ip) = $(hdr(X-Forwarded-For){s.select,0,:});
$var(source_port) = $(hdr(X-Forwarded-For){s.select,1,:});
} else {
$var(source_ip) = $si;
$var(source_port) = $sp;
}
$var(to_number) = $rU;
}
route[RELAY_API] {
xlog("L_INFO","RELAY_API - from_ip $var(source_ip):$var(source_port)
from_number $fU to_number $ru");
$http_req(all) = $null;
$http_req(suspend) = 1;
$http_req(timeout) = HTTP_API_TIMEOUT;
$http_req(method) = "POST";
$http_req(hdr) = "Content-Type: application/json";
jansson_set("string","from_ip",$var(source_ip), "$var(http_routing_query)");
jansson_set("string","from_port",$var(source_port),
"$var(http_routing_query)");
jansson_set("string","from_number",$fU, "$var(http_routing_query)");
jansson_set("string","to_number",$var(to_number) ,
"$var(http_routing_query)");
xlog("L_INFO","RELAY_API - API ASYNC ROUTING REQUEST:
$var(http_routing_query)\n");
$http_req(body) = $var(http_routing_query);
t_newtran();
http_async_query(HTTP_API_ROUTING_ENDPOINT, "RELAY_API_RESPONSE");
}
# Relay request using the API (response)
route[RELAY_API_RESPONSE] {
if ($http_ok==1 && $http_rs==200)
{
xlog("L_INFO","RELAY_API_RESPONSE - RESPONSE: $http_rb\n");
if (jansson_get("rtjson", $http_rb, "$var(rtjson)")) {
xlog("L_INFO","RELAY_API_RESPONSE - $var(rtjson)");
rtjson_init_routes("$var(rtjson)");
rtjson_push_routes();
# relay the message
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
return;
}
}
send_reply(500, "API Not Available - http response = $http_rs $http_ok");
exit;
}
onreply_route[ON_REPLY] {
xlog("L_INFO", "ON_REPLY - In onreply_route[ON_REPLY] $rs");
# on reply
if (t_check_status("183|180|200")) {
xlog("L_INFO", "ON_REPLY - Fixing Contacts");
# subst_hf("Contact","/@.*:/@EXTERNAL_IP_ADDR:/","a");
//subst_hf("Record-Route","/INTERNAL_IP_ADDR/EXTERNAL_IP_ADDR/","f");
}
if (has_body("application/sdp")){
if (sdp_remove_line_by_prefix("a=maxptime")){
xlog("L_INFO", "ON_REPLY - remove maxptime ");
msg_apply_changes();
}
else{
xlog("L_INFO", "ON_REPLY - did not removed maxptime ");
}
}
if (t_check_status("408")) {
xlog("L_INFO", "ROUTE - Handling 408 Timeout\n");
}
}
route[TOCARRIER]{
#using rtjson, unsomment following line
route(RELAY_API);
}
# Per SIP request initial checks
route[REQINIT] {
xlog("L_INFO", "REQINIT - Starting");
if (!mf_process_maxfwd_header("10")) {
xlog("L_INFO", "REQINIT - 483 - Too Many Hops");
sl_send_reply("483","Too Many Hops");
exit;
}
if(!sanity_check("1511", "7"))
{
xlog("L_INFO","REQINIT - Sanity Check -> Malformed SIP message from
$si:$sp\n");
exit;
}
}
# Caller NAT detection
route[NATDETECT] {
xlog("L_INFO", "NATDETECT - Entering");
#!ifdef WITH_NAT
force_rport();
if (nat_uac_test("19")) {
if (is_method("REGISTER")) {
xlog("L_INFO", "NATDETECT - Fix Nated Register");
fix_nated_register();
} else {
if(is_first_hop()){
xlog("L_INFO", "NATDETECT - Set Contact Alias");
set_contact_alias();
}
}
xlog("L_INFO", "NATDETECT - Set FLT_NATS" + FLT_NATS);
setflag(FLT_NATS);
}
#!endif
xlog("L_INFO", "NATDETECT - NAT Detect set FLT_NTS = " + FLT_NATS);
return;
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
xlog("L_INFO", "WITHINDLG - Entering");
if (!has_totag()) return;
if (is_present_hf("Route") && $hdrc(Route)==1)
{
if (search_hf("Route", ".*EXTERNAL_IP_ADDR.*", "f"))
{
xlog("L_INFO", "WITHINDLG - Removing the route to self");
remove_hf("Route");
}
}
# sequential request within a dialog should
# take the path determined by record-routing
if (loose_route()) {
route(DLGURI);
if (is_method("BYE|CANCEL")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
}
else if ( is_method("ACK") ) {
# ACK is forwarded statelessy
xlog("L_INFO", "WITHINDLG - Going to NATMANAGE");
route(NATMANAGE);
}
else if ( is_method("NOTIFY") ) {
#Add Record-Route for in-dialog NOTIFY as per RFC 6665.
record_route();
}
if(is_method("BYE"))
xlog("L_INFO", "WITHINDLG - BYE message from $rU");
route(RELAY);
exit;
}
if ( is_method("ACK|BYE|INVITE|UPDATE") ) {
if ( t_check_trans() ) {
# no loose-route, but stateful ACK;
# must be an ACK after a 487
# or e.g. 404 from upstream server
route(RELAY);
exit;
} else {
# ACK without matching transaction. Try to route anyway - being optimistic
# since it has at least a To Tag
route(RELAY);
exit;
}
}
sl_send_reply("404","Not here");
xlog("L_INFO", "WITHINDLG - Finishing WITHINDLG");
exit;
}
# URI update for dialog requests
route[DLGURI] {
xlog("L_INFO", "WITHINDLG - Entering DLGURI");
#!ifdef WITH_NAT
if(!isdsturiset()) {
xlog("L_INFO", "WITHINDLG - Handle ruri ALIAS");
handle_ruri_alias();
}
#!endif
return;
}
# Routing to foreign domains ---> NOT USED
route[SIPOUT] {
xlog("L_INFO", "WITHINDLG - Entering SIPOUT");
if (uri==myself){
xlog("L_INFO", "WITHINDLG - URI is MySelf!");
return;
}
append_hf("P-hint: outbound\r\n");
xlog("L_INFO", "WITHINDLG - Finishing SIPOUT");
route(RELAY);
exit;
}
# Wrapper for relaying requests
route[RELAY] {
xlog("L_INFO", " ******** RELAY *******");
xlog("L_INFO", "RELAY - $si $su $ru");
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE|CANCEL|SUBSCRIBE|UPDATE")) {
if(!t_is_set("branch_route")) {
xlog("L_INFO", "RELAY - branch_route NOT SET!");
t_on_branch("MANAGE_BRANCH");
}
}
xlog("L_INFO", "RELAY - checking method");
if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
xlog("L_INFO", "RELAY - is INVITE|SUBSCRIBE|UPDATE");
if(!t_is_set("onreply_route")) {
xlog("L_INFO", "RELAY - onreply_route NOT SET!");
t_on_reply("ON_REPLY"); # MANAGE_REPLY");
}
}
if (is_method("INVITE")) {
xlog("L_INFO", "RELAY - is INVITE");
t_on_failure("FAILED_RELAY");
if(!t_is_set("failure_route")) {
xlog("L_INFO", "RELAY - failure_route NOT SET!");
t_on_failure("MANAGE_FAILURE");
}
}
if (!t_relay()) {
xlog("L_INFO", "RELAY - t_relay returns FALSE");
route("MANAGE_FAILURE");
#sl_reply_error();
}
xlog("L_INFO", "RELAY - exiting");
exit;
}
failure_route[FAILED_RELAY] {
xlog("L_INFO", "FAILED_RELAY - Entering");
if (t_check_status("[4-5][0-9][0-9]")){
xlog("L_INFO", "FAILED_RELAY - Could not reach destination endpoint!");
if (rtjson_next_route()) {
xlog("L_INFO", "MANAGE_FAILURE - Getting next route");
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
}
}
}
route[NATMANAGE] {
xlog("L_INFO", "NATMANAGE - Entering");
#!ifdef WITH_NAT
if (is_request()) {
if(has_totag()) {
xlog("L_INFO", "NATMANAGE - nat=yes --- Setting FLB_NATB");
setbflag(FLB_NATB);
}
}
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB) ))
{
xlog("L_INFO", "NATMANAGE - NO FLT_NATS/B Set!!! Getting out of
NATMANAGE");
return;
}
if (is_request()) {
xlog("L_INFO", "NATMANAGE - is_request - $rm from $si");
if (!has_totag()) {
if(t_is_branch_route()) {
xlog("L_INFO", "NATMANAGE - adding nat=yes");
add_rr_param(";nat=yes");
}
}
}
if (is_reply()) {
xlog("L_INFO", "NATMANAGE - is_reply - $rm from $si");
if(isbflagset(FLB_NATB)) {
if(is_first_hop())
{
xlog("L_INFO", "NATMANAGE - Set Contact Alias");
set_contact_alias();
}
}
}
#!endif
return;
}
# Manage failure routing cases
route[MANAGE_FAILURE] {
xlog("L_INFO", "MANAGE_FAILURE - Entering ");
route(NATMANAGE);
xlog("L_INFO", "MANAGE_FAILURE - t_is_canceled");
if (t_is_canceled()) exit;
#!ifdef WITH_BLOCK3XX
# block call redirect based on 3xx replies.
if (t_check_status("3[0-9][0-9]")) {
xlog("L_INFO", "MANAGE_FAILURE - SIP 3XX returned!!");
t_reply("404","Not found");
exit;
}
#!endif
#!ifdef WITH_BLOCK401407
# block call redirect based on 401, 407 replies.
if (t_check_status("401|407")) {
xlog("L_INFO", "MANAGE_FAILURE - SIP 401|407 returned!!");
t_reply("404","Not found");
exit;
}
#!endif
if (t_check_status("503")){
xlog("L_INFO", "MANAGE_FAILURE - SIP 503 returned : no destination
available");
t_reply("503", "Destination not available");
exit;
}
if (rtjson_next_route()) {
xlog("L_INFO", "MANAGE_FAILURE - Getting next route!!");
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY);
exit;
}
}
# Manage outgoing branches
branch_route[MANAGE_BRANCH] {
xlog("L_INFO","MANAGE_BRANCH - New branch [$T_branch_idx] to
$ru\n");
xlog("L_INFO", "MANAGE_BRANCH - branch_route MANAGE_BRANCH 1 ");
rtjson_update_branch();
route(NATMANAGE);
}
Any help would be greatly appreciated.
Thanks in advance.
*Sérgio *
Dear all,
Is there any other possibility to (automatically) check the plausibility/syntax of an existing kamailio.cfg, besides
kamailio -c -f kamailio.cfg
?
Thanks,
Christoph
Hi all!
I'm testing the DMQ module, but having difficulties setting it up.
[...]
My kamailio.cfg is as follows :
[...]
listen=udp:0.0.0.0:5060
listen=tcp:0.0.0.0:5060
[...]
modparam("dmq", "server_address", "sip:10.20.0.2:5062") #DMQ_SERVER_ADDRESS
modparam("dmq", "notification_address", "sip:10.20.0.4:5062
")#DMQ_NOTIFICATION_ADDRESS
modparam("dmq", "multi_notify", 1)
modparam("dmq", "num_workers", 4)
modparam("dmq", "ping_interval", 15)
modparam("dmq_usrloc", "enable", 1)
If I check syntax (using -c parameter) all is ok. Once I start Kamailio,
the following error appears on system log:
INFO: dmq [dmq.c:164]: make_socket_str_from_uri(): unknown transport
protocol - fall back to udp
ERROR: dmq [dmq.c:241]: mod_init(): server_uri is not a socket the proxy is
listening on
ERROR: <core> [core/sr_module.c:1030]: init_mod(): Error while initializing
module dmq (/usr/local/lib64/kamailio/modules/dmq.so)
I have used UDP as well as SIP as protocols for Server Address and
Notification Address, used port 5060 and 5062 (and others too), even added
a new listen=udp:0.0.0.0:5062, as well as listen=tcp:0.0.0.0:5062 but the
result is always the same.
Using Kamailio 5.7.4 on RHEL 9 with SELINUX set to enforcing (if relevant).
No firewall active.
local IP address is 10.20.0.1
second kamailio node IP address is 10.20.0.4
Any ideas? At first sight, it seems to be all set as per documentation.
I even found other configurations online, and apart from the IP address,
all is similar.
Thanks in advance,
*Sérgio Charrua*
*www.voip.pt <http://www.voip.pt/>*
Hi all!
I am having some difficulties/doubts on what would be the best approach to
let multiple Kamailio servers share their SIP sessions between each other.
The goal is to have HA on Kamailio cluster such that if a call is received
and initiated on Kamailio #1, and during any moment of the call (before or
while established) if the server #1 goes down or Kamailio stops working for
any reason, the call can be processed by Kamailio server #n available in
the cluster.
I do not want to mess with Virtual IPs or DNS, that is not the point, but
instead need to get a proper way to share SIP sessions between Kamailio
servers such that any server could continue the call without issue.
I have checked the Dialog and DMQ module, but I am not sure if that is the
way to go....
Could any one share a solution for this?
Greatly appreciated.
Cheers,
*Sérgio Charrua*
*www.voip.pt <http://www.voip.pt/>*
Hello,
I would like get further information on the "pv_www_authenticate" function from auth module. For the response code "-1", which is listed as "generic error", what exactly is covered when this function returns this? Is it just everything else that isn't listed reason (invalid password, nonce expired, no credentials, etc...). On my production system, I'm seeing this as a response code on some registration requests, and just want to know what is causing this (enabling full verbose logging is a bit difficult on my production system, and want to try to replicate it on my test environment, however just need clarification on what this covers).
Thank you.
Hi
I'm having another go at topos trying to solve an issue of sip messages
getting to big for certain clients to process.
Unfortunately some methods (ACK/PRACK/BYE probably CANCEL) do not
contain a contact header, therefore the topology is still revealed (and
potentially a lot of via header inserted increasing message size).
Is it safe to set methods_nocontact to an empty string to force
creation of a Contact header for every SIP method?
Is there another way to completely hide topology aka keeping header
small?
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
______________________________________________________
Hi
In the process of getting rid of our commercial B2Bua SBC and handling
all clients directly via Kamailio...
We have come across some (unfortunately many we have in use) CPE which
have an issue with fragmented packets or which simply do not allocate
enough memory to parse or create messages of a certain size. Their SIP
stack just crashes with errors like 'message to large for send buffer'
and similar.
This affects messages with containing as little as 5 via
and 4 record-route header and a couple of codec in the SDP.
Is there a recipe for trying to keep packets as small as possible?
I would like to avoid using the topos module as I issues with this
module completely failing in certain situations.
--
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
______________________________________________________
Hello,
the branch 5.8 was created, therefore the master branch is open for
adding new features, to be part of future release series v5.9.x (or
whatever version is decided for next series).
Any bug fix committed to master that applies to 5.8.x or older stable
branches should be backported as usual with "git cherry-pick -x ..." to
appropriate branches like 5.8 or 5.7.
Expect that v5.8.0 will be released in a few weeks from now.
Based on the workflow used during the past years, the next future
release v5.9.0 should be out after another 8-10 months of development,
plus 1-2 months of testing, so sometime during the last part of 2024 or
the beginning of 2025.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com
Hello,
the branch 5.8 has been created, to be used for releasing v5.8.x series.
To check out this branch, the following commands can be used:
git clone https://github.com/kamailio/kamailio kamailio-5.8
cd kamailio-5.8
git checkout -b 5.8 origin/5.8
Pushing commits in this branch:
git push origin 5.8:5.8
Note that 5.8 is an official stable branch, so only bug fixes, missing
kemi exports (discuss on sr-dev if not sure) or improvements to
documentation or helper tools can be pushed to this branch.
As usual, if there is a bug fixed, commit and push first to master
branch and then cherry pick to 5.8 branch:
git cherry-pick -x COMMITID
In few weeks, the first release from branch 5.8 will be out,
respectively Kamailio v5.8.0.
Cheers,
Daniel
--
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com
Hi,
for our workflow we build our own Debian packages for kamailio.
We are currently trying and failing to create a package for the kafka
modules.
What we have tried so far:
Adding the "Build-Depends:" entries for librdkafka-dev in debian/control
Adding a "Package" in debian/control
Adding kafka to the PACKAGE_GROUPS in debian/rules
So far it seems to build the module and a package for it, but the
package only contains metadata, but no .so file.
We are currently running out of ideas. What else can we do?
Best wishes
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,
When writing kemi cfg (python in my case), is there any way to get rid of standard cfg shared variables and use kemi cfg variables instead?
E.g. Instead of $shv(blabla) (in standard config) can I use some global python var called 'blabla'? Is it seen and shared by all kamailio processes? Or I still need to use KSR.pv.get/set("$shv(blabla)") ?
Thank you,
Stefan
Greetings,
I am new to Kamailio and seeking assistance. I have installed FreeSWITCH version 1.10.11 and Kamailio version 5.6.5. I have two inquiries:
I aim to configure FreeSWITCH with Kamailio. Could someone kindly guide me on achieving this integration?
I am curious about the storage location of Kamailio's log files. Could someone please provide information regarding this?
Thank you in advance for your help and guidance.
Hello are htable protected for multiple write access?
can i safely update htable from one process and be sure another process will access it for write operation ? if yes is the lock on all the htable or only on the bucket where the key belongs ?
Thanks.
Hello,
just a question about the https://rpm.kamailio.org/ repository, especially regarding git master builds. It seems that the git master build there was updated last autumn. It would be great if it could be updated, now as we want to test for the coming release.
Thank you,
Henning Westerholt
--
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://gilawa.com<https://gilawa.com/>
Hello all,
I'm currently developing some kamailio scripts with app_jsdt by migrating a
proxy of mine from Kamailio routing script to Js.
I've migrated some parts of my request_route and everything seems to be
working fine.
I am now trying to migrate my event routes to JS and I started with dialog.
dialog parameters : modparam("dialog", "event_callback", "dialogEvent")
Code :
function dialogEvent(event) {
KSR.info("Dialog event " + event + " in JS")
}
After this i try to make a call and in my logs i have :
"Dialog event unknown in JS"
"Dialog event dialog:start in JS"
Is this normal behaviour that I should ignore and only try to process
"start,end,failure" or is this a signal of something wrong in my code?
I also have this error in my code : "sr_kemi_cbname_lookup_idx(): index 1
is out of range". Does that mean that i have a JS function that calls a
missing function in kamailio script or the opposite? How can I identify the
root cause?
Thanks in advance,
Cheers
Hi List
avp stacking is starting to drive me crazy... Somehow I don't
understand what is going on in this situation:
I have a main branch, and add two more branches with append_branch()
I use a on_branch_route trigger:
branch_route[BR_TO_CPE]
{
[Here, some code setting $var(needbh)]
if ("yes" == $var(needbh)) {
xlog("L_INFO", "$cfg(route): BR_idx: $T_branch_idx BACKHAUL: YES to $nh(u) \n");
add_rr_param(";rtp=yes");
record_route();
$avp(backhaul) = "yes";
$avp(nexthop) = $nh(u);
rtpengine_manage($avp(rtp_to_cpe));
} else {
xlog("L_INFO", "$cfg(route): BR_idx: $T_branch_idx BACKHAUL: NO to $nh(u) \n");
record_route();
$avp(backhaul) = "yes";
$avp(nexthop) = $nh(u);
}
}
In the Logs, I see Branches Index 0,1,2 with the desired information.
So I have 3 values stacked in the avp backhaul and nexthop, right?
When I get a reply, I would like to determine if backhauling is required or not.
onreply_route[MANAGE_REPLY]
{
xlog("L_INFO", "MANAGE_REPLY: for BR_idx: $T_branch_idx\n");
while ($(avp(nexthop)[$var(i)]) != $null) {
xlog("L_INFO", "MANAGE_REPLY: DEBUG Branch: $T_branch_idx VAR IDX: $var(i) NH: $(avp(nexthop)[$var(i)]) \n");
$var(i) = $var(i) + 1;
}
}
So on EVERY reply, I would expect to get three "DEBUG" lines as I stacked 3 AVP..
Bug I get only 2!
Why I am missing one of the stacked AVP? (the last one as it looks like)
Or is there any other way to access a arbitrary variable specific to a
branch on the reply to that branch?
PS: I don't need $avp(nexthop). It's just an easy way to make sure I
get the correct avp index for the branch I am interested in.
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!
I have an issue with kamailio 5.6.5 after some time of flying there are
errors in logs:
<core> [core/mem/q_malloc.c:297]: qm_find_free():
> qm_find_free(0x7fc79c286010, 536); Free fragment not found!
mem_join=1 by default, but it seems that MEM_JOIN_FREE flag is not defined
in this build
kamailio -I
> Print out of kamailio internals
> Version: kamailio 5.6.5 (x86_64/linux)
> Default config: /etc/kamailio/kamailio.cfg
> Default paths to modules: /usr/lib/x86_64-linux-gnu/kamailio/modules
> Compile flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS,
> DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC,
> F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
> USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST,
> HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
> MAX_RECV_BUFFER_SIZE=262144
> MAX_URI_SIZE=1024
> BUF_SIZE=65535
> DEFAULT PKG_SIZE=8MB
> DEFAULT SHM_SIZE=64MB
> ADAPTIVE_WAIT_LOOPS=1024
> TCP poll methods: poll, epoll_lt, epoll_et, sigio_rt, select
> Source code revision ID: unknown
> Compiled with: gcc 10.2.1
> Compiled architecture: x86_64
> Compiled on:
> OS Debian 11 bullseye
However I noticed the flag exists in 5.7 installed from deb
Print out of kamailio internals
> Version: kamailio 5.7.4 (x86_64/linux)
> Default config: /etc/kamailio/kamailio.cfg
> Default paths to modules: /usr/lib/x86_64-linux-gnu/kamailio/modules
> Compile flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS,
> DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC,
> *MEM_JOIN_FREE*, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY,
> USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER,
> USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
> MAX_RECV_BUFFER_SIZE=262144
> MAX_URI_SIZE=1024
> BUF_SIZE=65535
> DEFAULT PKG_SIZE=8MB
> DEFAULT SHM_SIZE=64MB
> ADAPTIVE_WAIT_LOOPS=1024
> TCP poll methods: poll, epoll_lt, epoll_et, sigio_rt, select
> Source code revision ID: unknown
> Compiled with: gcc 10.2.1
> Compiled architecture: x86_64
> Compiled on:
OS Debian 11 bullseye
and now, what got me bit confused is that when I build 5.6.5 from source
"make printcdefs" gives me this flag, alongside with other flags which I do
not see later in "kamailio -v" output.
So I am not sure whether this flag was defined during 5.6.5 deb build time
or it has been somehow lost?
So I need your advice.
Regards,
Arsen
Hi
I have come across this challenge:
Initial invite (no to_tag) has is authenticated and has credentials. So
a lookup for the username is made to determine if the customer needs
backhauling, thus rtpengine needs to be engaged.
On a subsequent invite (re-invite to change codec or to refresh
session timer) there is a to_tag so it is being routed without sending
a challenge and has no auth username.
I don't use dialog on the registrar. This is another transaction. So I
don't know, if I need to engage rtpengine on that DSP or not.
What is the best way to find out, if rtpengine is already handling that
callid?
if(rtpengine_query_v("j", "$var(dummy)")) {
rtpengine_manage();
}
basically works, but generates a couple of ugly error messages in the
log as rtpengine_query_v does not find the call.
Is there a nicer way?
--
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
______________________________________________________
The connection registered by the client is normal, and the client can send messages and renew the registration normally, but the push message to the client using uac_req_send() from kamailio fails.
Location information after the client is registered:
]#kamcmd ul.lookup location test01
Received: sip:10.11.40.XX:57646;transport=tls
]#netstat -anp | grep 57646
"tcp 0 0 10.11.55.xx:5061 10.11.40.XX:57646 ESTABLISHED 3467/kamailio"
kamailio.lua
KSR.pv.sets("$uac_req(ouri)", rows.received)
In this way, most users can receive messages normally, but occasionally some users cannot receive messages but can renew their registration and send messages normally. Once this is the case for this user, the use of uac_req_send() will continue to fail until the client establishes a new connection.
If a problem occurs, the following logs are displayed on the server:
2024-02-20T10:01:25.329595+08:00 10.11.55.XX (72819) ERROR: <core> [core/tcp_main.c:4692]: tcpconn_main_timeout(): connect 10.11.40.XX:57646 failed (timeout)
The connection already exists and should be normal, why does "tcpconn_main_timeout(): connect 10.11.40.XX:57646 failed (timeout)" occur.
We have recently upgraded from 5.6.4 to 5.7.4.
No change in the KAMAILIO configuration.
On all upgraded servers we are now getting this message in the logs for
every destination when the dispatcher sends out OPTIONS to destinations
listed in the dispatcher list:
WARNING: <core> [core/tcp_main.c:1301]: find_listening_sock_info():
binding to source address X.X.X.X:YYYY failed: Address already in use [98]
The X.X.X.X being the servers IP address and YYYY being the servers
listening port for tcp and/or tls.
It's not consistent. For some servers it's every time OPTIONS is sent.
For others it's just now and then. udp destinations have no issues.
There are no other processes occupying these ports. Changing the
listening port on the KAMAILIO also results in the new port reported as
in use.
Dispatcher OPTIONS still seems to work for both tcp and tls.
Unsurprisingly using a dynamic, unprivileged port > 1023 and not the
server port as the source port, as it shouldn't. The packages are sendt
and a reply is registered. Inbound OPTIONS are processed as expected by
KAMAILIO on the listening port.
Have I missed something transitioning from 5.6 -> 5.7, or is this a bug?
Relevant config:
modparam("dispatcher", "ds_ping_method", "OPTIONS")
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_probing_threshold", 2)
modparam("dispatcher", "ds_ping_interval", 120)
modparam("dispatcher", "ds_ping_from", "sip:ping@xxxxxx.xxx")
modparam("dispatcher", "ds_ping_latency_stats", 1)
OS: Debian Bullseye
Kamailio installed from
https://deb.kamailio.org/kamailio57 bullseye
Best regards,
Jardar Leira