Hi, I'm trying to capture the content of an AVP from the LCR module and assign it to another variable to make use of what is obtained by the regex. For this, I have used the avp_subst.
The content of $avp(i:709):
1|sip:|0|||2416027840||5061||;transport=udp|11|1
I need to extract the index that indicates the port "5061" at position 8.
I haven't been able to achieve this by trying several regex patterns.
Has anyone experienced something similar?
Thanks!
Hi,
The kamailio version we are using is "5.5.5", We are facing a kamailio
crash issue recently and it has generated the core-dump. Based on the
core-dump analysis we could see that "*si_desc = "udp receiver
child=3" *getting
crashed. We could see the below error in the core-dump trace,
#22 0x0000562c33524750 in udp_rcv_loop () at core/udp_server.c:543
tmp = 0x1150955ff0 <error: Cannot access memory at address 0x1150955ff0>
Please suggest how to fix this and your inputs will be appreciated.
Note: Due to confidentiality, I'm not able to share the core-dump trace.
Thanks.
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