Currently digest authentication hash algorithm (MD5 or SHA-256) is
selected when auth module is loaded. How about allowing to select it
also dynamically using the function flags?
-- Juha
Hi all,
i set up a simple Kamailio SIP server with the latest stable versione.
Than, by following the documntation, i tried to set up a file log instead of the standard syslog log, so i changed the syslog.conf by adding this lines:
# don't log messages with LOG_LOCAL0 in /var/log/syslog anymore
*.*;auth,authpriv.none,local0.none -/var/log/syslog
#
# log messages with LOG_LOCAL0 in /var/log/kamailio.log
local0.* -/var/log/kamailio.log
Then, i created a kamailio file in /etc/logrotate.d with this content to manage the log rotation:
/var/log/kamailio.log {
su root root
daily
rotate 7
compress
delaycompress
missingok
notifempty
create 0640 syslog adm
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
I found all these information in https://www.kamailio.org/wikidocs/tutorials/3.2.x/syslog/
Unfortunatly, in my Ubuntu 22.04 server there isn't a syslogd.pid file in that path so the logrotation doesn't work.
Can anyone help me to understand the problem?
Thank you so much in advance
Christian
Hello,
I'm new to Kamailio and considering its use for our inbound/outbound proxy,
call rating, and billing system. I'd like to get your feedback on my
current approach and understand the best practices for this scenario.
Currently, I'm using SQL queries within my Kamailio configuration to handle
authorization and rating. Here's a simplified example:
# Call authorization
route[DISPATCH] {
if (is_method("INVITE") && isbflagset(FLB_SRC_CARRIER)) {
if ($au == $null) {
$var(acc_query) = $_s(SELECT ct.tag as tag,
ct.customer_id as customer_id, cast(cb.nobal_amt as integer) as
nobal_amount, cast(cb.cash as integer) as cash, ct.digits,
cast(ct.retail_rate as varchar) as retail_rate, cast(ct.wholesale_rate as
varchar) as wholesale_rate, ct.dispatcher_group, cast(ct.cps as integer) as
cps from customer_ip ip INNER JOIN customer_balance cb ON (ip.customer_id =
cb.customer_id) INNER JOIN customer_tariff ct ON (ip.customer_id =
ct.customer_id) INNER JOIN customers cust ON (ip.customer_id =
cust.customer_id) WHERE ip_address = '$si' AND '$rU' LIKE ct.digits || '%'
order by ct.digits desc limit 1;);
} else {
$var(acc_query) = $_s(SELECT ct.tag as tag,
ct.customer_id as customer_id, cast(cb.nobal_amt as integer) as
nobal_amount,cast(cb.cash as integer) as cash, ct.digits,
cast(ct.retail_rate as varchar) as retail_rate, cast(ct.wholesale_rate as
varchar) as wholesale_rate, ct.dispatcher_group, cast(ct.cps as integer) as
cps from customer_auth auth INNER JOIN customer_balance cb ON
(auth.customer_id = cb.customer_id) INNER JOIN customer_tariff ct ON
(auth.customer_id = ct.customer_id) INNER JOIN customers cust ON
(auth.customer_id = cust.customer_id) WHERE auth.subcriber = '$au' AND
'$rU' LIKE ct.digits || '%' order by ct.digits desc limit 1;);
$dlg_var(auth) = "1";
}
xalert("query is $var(acc_query)");
if (sql_xquery("dbh", "$var(acc_query)", "row") == 1) {
$dlg_var(account) = $xavp(row[0]=>customer_id);
$dlg_var(dispatcher_group) =
$xavp(row[0]=>dispatcher_group);
$dlg_var(retail_rate) = $xavp(row[0]=>retail_rate);
$dlg_var(wholesale_rate) =
$xavp(row[0]=>wholesale_rate);
$dlg_var(cps) = $xavp(row[0]=>cps);
$dlg_var(service_plan) = $xavp(row[0]=>tag);
# $var(cash) = $xavp(row[0]=>cash);
xalert("account: $xavp(row[0]=>customer_id) cash:
$xavp(row[0]=>cash) retail_rate: $xavp(row[0]=>retail_rate) wholesale rate:
$xavp(row[0]=>wholesale_rate) group: $xavp(row[0]=>dispatcher_group) cps:
$xavp(row[0]=>cps) tag: $xavp(row[0]=>tag) \n");
if ($xavp(row[0]=>cash) <=
$xavp(row[0]=>nobal_amount)) {
sl_send_reply("403", "Insufficient
balance");
exit;
}
append_hf("X-Account:
$dlg_var(account),$dlg_var(retail_rate),$dlg_var(wholesale_rate)\r\n");
} else {
sl_send_reply("500", "Server Error!");
exit;
}
#!ifdef WITH_CPSLIMIT
# perform pipe match for INVITE
if (is_method("INVITE")) {
$var(invlimit) = $(dlg_var(cps){s.int});
if ($var(invlimit) > 0) {
if
(!pl_check("$si-$dlg_var(dispatcher_group)", "TAILDROP", "$var(invlimit)"))
{
pl_drop("5");
exit;
}
}
}
#!endif
# round robin dispatching on gateways group '1'
if(!ds_select_dst("$dlg_var(dispatcher_group)", "4")) {
send_reply("404", "No destination");
exit;
}
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
}
……
…….
……
# Billing and Rating using acc_cdrs and a customer_balance table
event_route[dialog:end] {
$var(call_duration) = $DLG_lifetime; # Fetch call duration
$avp(originator) = $dlg_var(originator);
$avp(accountcode) = $dlg_var(account);
$avp(caller) = $dlg_var(caller);
$avp(callee) = $dlg_var(callee);
$avp(pdd) = $dlg_var(pdd);
$avp(service_plan) = $dlg_var(service_plan);
$avp(hangup_source) = 'CALLEE';
$avp(hangup_code) = '200';
$avp(hangup_reason) = 'Normal Clearing';
$avp(elapsed) = ( $TV(s) - $dlg_var(init_timestamp) );
if ($dlg_var(auth) != $null) {
setbflag(FLB_SRC_CARRIER);
}
if (isbflagset(FLB_SRC_CARRIER) && $dlg_var(originator) ==
"CUSTOMER") {
$avp(hangup_source) = 'CALLER';
}
if (isbflagset(FLB_SRC_PBX) && $dlg_var(originator) ==
"SYSTEM") {
$avp(hangup_source) = 'CALLER';
}
# Calculate billed amount using postgres query
$var(bill_query) = $_s(select
cast(round($dlg_var(retail_rate)/60::numeric * $var(call_duration), 4) as
varchar) as bill;);
if (sql_xquery("dbh", "$var(bill_query)", "row") == 1) {
$avp(billed) = $xavp(row[0]=>bill);
}
if (isbflagset(FLB_SRC_CARRIER)) {
$var(query) = "UPDATE customer_balance set cash =
cash - (" + $dlg_var(retail_rate) + " / 60 * " + $var(call_duration) + ")
WHERE customer_id = " + $dlg_var(account) + ";";
sql_xquery("dbh", "$var(query)", "ra");
}
# xalert("~~~~~ Call ended (duration: $var(call_duration))
total_billed: $avp(billed) ~ $avp(hangup_source) ~ $T(reply_code) ~
$T(reply_reason) ~ $T_reply_code ~ \n");
}
My questions are:
• Is this a sustainable approach for a Kamailio billing/rating setup?
Are there performance or scalability concerns?
• Would it be better to handle rating and billing directly on our
FreeSWITCH B2BUA? What are the advantages and disadvantages of each
approach?
• Are there best practices or alternative solutions I should consider?
Thank you in advance for sharing your experience and insights!
HI
I currently have two proxy servers running in my environment, and I want to
upgrade Kamailio from version 5.4.7 to 5.6.
Can I recompile the Kamailio service before restarting it without downtime
? Will there be any impact on my production environment if I recompile
Kamailio to the newer version? If there is no impact, I expect
approximately 2 minutes of downtime during the service restart.
Here's the scenario:
*No Downtime:*
Clone the Kamailio repository with git clone
https://github.com/kamailio/kamailio.git
Navigate to the Kamailio directory with cd kamailio
Update the modules.lst file with any necessary additions
Compile with make
Install with make install
*Downtime:*Restart the Kamailio service.
Please advise on this.
Thanks.
Hello,
I would like to build some additional modules to the standard by following this guide (old) https://www.kamailio.org/wikidocs/install/4.0.x/debian/ and I don't get these additional .deb packages.
Could someone please help.
Thanks,
Victor
Hey Folks,
What a great conversation, really enjoyed all the insight and feedback, other than what's already been said, which I agree with whole heartedly, I want to add some personal reflection.
FOSS is exceptional for putting tools in your hands to build what your business can use to succeed. You will spend upfront $$ investment with man-hours learning, deploying, managing then cost trails off to realize the return on investment which is usually exponential compared to commercial drop-in voice switches. A key consideration is expected/targeted growth of the solution and operational expediency, how big with the subscriber base get, voice service is a high touch point for customer support. Once you (as in personally) deploy a FOSS solution in production, you are tied to that solution for its foreseeable existence, good luck finding competent and like-minded staff that see your vision and can support the solution as you do. Deployment guys will always have a deeper understanding/knowledge of the solution, architecture, configuration, pitfalls and work around than the operations support folks. If you don't have staff resources, having consultants you can rely on is crucial for success.
I can't say enough about Kamailio for building call routing solutions, mature, stable, reliable, continued improvements, phenomenal developer and community base for support.
Good luck whichever direction you go in!
JR Richardson
On Apr 14, 2024, at 12:25 PM, Alex Balashov <abalashov(a)evaristesys.com> wrote:
> Medium to large organisations, in particular, tend to extract labour from consistent (if unextraordinary) output of everyday do-gooders, and not the more stochastic and volatile heroics of open-source superstars.
Sorry, I meant to say "extract value" here, not "extract labour".
But the larger point is that any successful formula heavily reliant on open-source is going to be a lot more dependent on culture, and on the strengths of individual people and their specific skills, than a formula reliant on a third-party vendor, all other things being equal.
-- Alex
--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800
End of sr-users Digest, Vol 227, Issue 36
*****************************************
Hi
Using Kamailio 5.6 and trying to get Teams integration working. Failing at the first step! I receive no reply from MS to my OPTIONS ping. AFAIK it is correect, here is the OPTIONs sent:
OPTIONS sip:sip.pstnhub.microsoft.com;transport=tls SIP/2.0
Via: SIP/2.0/TLS msteams.domain.com:5061;branch=z9hG4bK0c2b.da69f3c3000000000000000000000000.0
To: <sip:sip.pstnhub.microsoft.com;transport=tls>
From: <sip:msteams.domain.com>;tag=6d9effc2a8ec7e0b16377e93bd9e71e2-470e3c71
CSeq: 10 OPTIONS
Call-ID: 6ea8091201db565b-605531(a)159.65.196.10
Max-Forwards: 70
Content-Length: 0
User-Agent: ABC SBC
Contact: <sip:msteams.domain.com:5061;transport=tls>
From the logs (below) I can see that w are accepting the MS cert OK but get no response and ends with a 408. The domain is configured in Teams, and a user with a license was added. MY Cert is issued by GeoTrust TLS RSA CA G1.
Any idea if the issue might be on my side?
024-04-15T14:53:19.302610+00:00 msteams /usr/sbin/kamailio[605600]: DEBUG: tls [tls_domain.c:798]: sr_ssl_ctx_info_callback(): SSL handshake done
2024-04-15T14:53:19.302692+00:00 msteams /usr/sbin/kamailio[605600]: DEBUG: tls [tls_server.c:542]: tls_connect(): TLS connect successful
2024-04-15T14:53:19.302762+00:00 msteams /usr/sbin/kamailio[605600]: DEBUG: tls [tls_server.c:545]: tls_connect(): tls_connect: new connection to 52.114.14.70:5061 using TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256
2024-04-15T14:53:19.302824+00:00 msteams /usr/sbin/kamailio[605600]: DEBUG: tls [tls_server.c:550]: tls_connect(): tls_connect: sending socket: 159.65.196.10:0
2024-04-15T14:53:19.302868+00:00 msteams /usr/sbin/kamailio[605600]: DEBUG: tls [tls_server.c:418]: tls_dump_cert_info(): tls_connect: server certificate subject:/C=US/ST=WA/L=Redmond/O=Microsoft Corporation/CN=sip.pstnhub.microsoft.com
2024-04-15T14:53:19.302917+00:00 msteams /usr/sbin/kamailio[605600]: DEBUG: tls [tls_server.c:422]: tls_dump_cert_info(): tls_connect: server certificate issuer:/C=US/O=Microsoft Corporation/CN=Microsoft Azure RSA TLS Issuing CA 03
2024-04-15T14:53:19.470476+00:00 msteams /usr/sbin/kamailio[605606]: DEBUG: tls [tls_server.c:729]: tls_h_tcpconn_close_f(): Closing SSL connection 0x7fd3c77639c8
2024-04-15T14:53:28.770710+00:00 msteams /usr/sbin/kamailio[605591]: DEBUG: dispatcher [dispatch.c:3617]: ds_options_callback(): OPTIONS-Request was finished with code 408 (to sip:sip.pstnhub.microsoft.com;transport=tls, group 1)
-Barry
Hi,
I am using kamailio with KEMI Lua. The script has some medium level
complexity as it stores some information from the invite in redis
cache during the call and uses that information during the call transfers
(REFER and Invite triggered by REFER).
Lua script itself creates/sets some variables, and
sends/retrieves information during the flow for example
KSR.ndb_redis.redis_cmd("srvN", "SET coreCI-" .. varCI .. " " ..
KSR.pv.getw("$ci") .. " EX 3600", "r");
KSR.ndb_redis.redis_cmd("srvN", "GET refvar-" .. cid, "r");
reft=KSR.pv.getw("$redis(r=>value)");
I made a test call and disconnected, what I am observing is that even if
the call is finished the used memory is slightly increased.
before:
< real_used: 844240
< real_used: 844088
< real_used: 844088
< real_used: 844088
< real_used: 844088
< real_used: 844088
< real_used: 844088
< real_used: 844088
after:
> real_used: 846080
> real_used: 845864
> real_used: 846584
> real_used: 846304
> real_used: 846200
> real_used: 846120
> real_used: 845248
> real_used: 846168
My assumption is after finishing the call, memory used by variables and
redis ops is released and should be back to original values but its not
happening. In production this issue is causing some problems as I have to
restart the kamailio process after every 3-4 weeks so that it starts
breathing with more available memory.
Initially I thought its Kamailio version issue as in my last posts in this
forum people advised me to upgrade to the latest kamailio version (original
one was 5.4.0) but the same issue is happening on 5.7.0.
Can someone explain how to debug/troubleshoot this situation . I have a
parallel lab environment, I do not see anything interesting in syslogs.
--
Muhammad Danish Moosa
" The core of mans' spirit comes from new experiences. "___ Christopher
McCandless