Hi,
I'd like to implement a couple of helper functions for time handling,
e.g. checking day of week, day of month etc. from within the kamailio
config file. What would you prefer, a new module ("timeutils" maybe?) or
adding it to cfgutils (there are already time-based functions there like
sleep and usleep)?
The idea is to implement time based call-forwards, and an approach could
be to provision various time-related values in usr_preferences table,
and then check it in the config. For example, when doing call-forwards
from Monday to Friday only, I could put this into usr_preferences:
attribute: cf_weekday
value: [1, 2, 3, 4, 5] (each entry is a separate row in usr_preferences)
And in kamailio config, I'd call this:
avp_db_load(...);
if(is_weekday("$avp(s:cf_weekday)")) { do CF }
So is_weekday would iterate over the entries in the avp list and return
true if the weekday at the time of routing matches an entry in the list.
A module config param could control whether to use gmtime or localtime
for matching.
Does this make sense? Suggestions for other approaches? I'd rather
prefer to do it directly in config instead of using some external
interpreter like lua, python etc.
Andreas
Hello,
I am trying to implement the following configuration :
- Kamailio as a SIP proxy/registrar behind a one-to-one NAT (port number is
not modified) listening on ports 5060 and 53 (and more ports in the future)
- aliases correctly configured :
alias= udp: public_ip:53
alias= udp: public_ip:5060
alias= udp: hostname:53
alias= udp: hostname:5060
- listen directive correctly on private ip address and both ports :
listen=udp:private_ip:53
listen=udp:private_ip:5060
- advertised_address=public_ip
- record_route_preset("public_ip") is used to announce the public IP
address in the RR header
- user A : registered on port 5060
- user B : registered on port 53
Suppose user A tries to call user B.
The Record-Route header in the INVITE forwarded from Kamailio to user B
should contain the port number on which user B is connected (53), to force
user B to send future requests to that port number. But I have no method to
know which port user B is connected to, and that problem is aggravated when
user B has multiple registrations on different port numbers and parralel
forking is done. Declaring advertised_port doesn't solve the problem. I
cannot force port number 53 in record_route_preset("public_ip:53") since it
wouldn't work when user B calls user A. Using the record_route( ) function,
Kamailio doesn't use the advertised_address to construct the RR header.
Another problem is that the record_route_preset function clears the DID
cookie set by the dialog module, which makes Kamailio fallback to SIP
elements to match the request to an existing dialog, thus dialog matching
becomes slower, and performance is an issue for me.
Any suggestions? I know that one solution would be to run Kamailio with a
public IP address and no NAT, but unfortunately it's not possible.
I suggest that the function record_route( ) takes a public IP address as a
parameter, still doing what it does (correct record routing and cookie
addition did=xxx and loose route lr=on), but only replacing the private IP
address on which Kamailio listens with a public IP address. Or that the
record_route( ) function uses the advertised_address to construct the RR
header.
Thank you
RA
Hello,
We plan to use Kamailio as redirect server. Corresponding contact list is to
be fetched by a Lua script from DB.
The problem is about calling the required 'rewriteuri' function:
1. From lua script. both 'sr.rewriteuri()' and 'sr.modf("rewriteuri",
...)" fails to write the 'contact' field.
2. I tried an alternative way; pushing the value from lua (e.g.
sr.pv.sets("contact", "sip:...")) and got the value in the Kamailio.cfg
($var(contact)). But can't call the rewriteuri function with this variable's
value as argument. This seems to be a general problem of calling a function
from .cfg with a variable's value as parameter.
Any help much appreciated.
--
Sharif
Hello everyone,
I'm doing some TLS performance testing on Kamailio 3.2.1. Here's my setup:
kamailio -V
version: kamailio 3.2.1 (x86_64/linux) 31c991
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, TLS_HOOKS,
USE_RAW_SOCKS, USE_STUN, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK,
SHM_MEM, SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, USE_FUTEX,
FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR,
USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 31c991
compiled on 19:38:03 Dec 20 2011 with gcc 4.4.6
uname -a
Linux null.null.com 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22
GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
CentOS 6.2 on a Dell PowerEdge R610 with 24 Intel X5650 Cores at
2.67GHz and 12GB of RAM (I could use more).
Kamailio is the default config with a few changes:
- WITH_TLS defined
- TLS is using self-generated CAs/certs (essentially openvpn easy-rsa)
with 1024 bit key size
- TLS is *not* configured to verify client OR server certs by default
- I'm using TLS v1 (SSL 3.1)
- TLS cipher suites are set to any (although my simulated UAs only
offer AES 256+SHA)
- Various changes to Kamailio children (up to 256 at times) and memory
sizes (up to 2048mb and even 4096mb at times)
- One DNS based alias added
- Maximum TCP connections increased to 65000
- Kamailio is configured to only listen on tested IP (UDP, TCP, TLS
sockets active)
- Syslog has been configured to log local0 (Kamailio) asynchronously
My test rig/call generator is an Ixia Xcellon-Ultra NP load module
with IXLoad. My call scenario does the following:
- Registers two simulated user agents (100000, 200000) to Kamailio with TLS
- Places call from 100000 to 200000 via Kamailio with TLS
- Increments both user agents by 1 and continues as quickly (cps) as I
like up to a channel limit (also configurable)
- The Ixia generates a valid SDP but no RTP is generated (although
that's certainly possible at these call levels)
Two 1 gig ports on the Ixia are connected to the Broadcom NICs on
the Dell R610 via a Cisco Catalyst 4948 switch. One port on the Ixia
emulates the 100000 agents (A leg) and the other emulates the 200000
agents (B leg). Of course I can provide more information if needed.
Here are some test numbers:
With TLS at 20cps, 120 sec calls, up to a total of 2470 calls (4940
registrations) life is good. Very good - call setup time averages
23ms, the cps rate holds indefinitely, and not a single call or
registration fails over long term tests.
UDP and TCP numbers are excellent (bordering ridiculous) - usually
around 500cps with practically no reasonable upper limit on
simultaneous calls. This doesn't need any further discussion :).
The TLS numbers start falling apart pretty quickly after 20cps,
however. If I change the TLS test to 40cps, 120 sec calls, up to a
total of 4940 calls (9,880 registrations) Kamailio starts to
(seriously) struggle. The rate starts fluctuating all over the place,
call setup time averages jump to 8000ms (or more) and things just
generally get ugly. Interestingly enough all of the user agents are
able to register, the logs look fine (to my eye at this log level) and
the system (CPU, network, etc) doesn't appear to be under stress at
all.
I have a few questions:
1) Is there something obviously wrong or stupid I'm doing here?
2) Why are the TLS tests so much worse than TCP and UDP? Am I
missing something here?
Thanks (in advance) for any advice anyone might be able to offer!
--
Kristian Kielhofner
I have been trying to accomplish a couple tasks with Kamailio over the past
month with no luck. What I need is a bit of one-on-one training with
someone who knows the lay of the land. If you do this kind of consulting
and can use Skype with possibly a shared-screen terminal, please drop me an
email with your rate.
Hello,
I'm trying to upgrade my company's sip server to the latest Kamailio to 3.1.5.
My development environment contained Openssl 0.9.8K version and everything works fine here.
I have tried to install a fresh package for my release, the openssl version from the Ubuntu packages is Openssl 1.0.0e
And I get the following error.
My error looks like this:
sudo /etc/init.d/kamailio start
Not starting kamailio: invalid configuration file!
-e
0(26880) ERROR: <core> [sr_module.c:523]: ERROR: load_module: could not open module </home/p4dev/BLand_password-Evo-N800v_4700/sw/SipServer/main/kamailio/lib/kamailio/modules/tls.so>: /home/p4dev/BLand_password-Evo-N800v_4700/sw/SipServer/main/kamailio/lib/kamailio/modules/tls.so: undefined symbol: SSLv2_client_method
0(26880) : <core> [cfg.y:3416]: parse error in config file /home/p4dev/BLand_password-Evo-N800v_4700/sw/SipServer/main/kamailio/etc/kamailio/kamailio.cfg, line 259, column 12-19: failed to load module
0(26880) WARNING: <core> [sr_module.c:578]: /home/p4dev/BLand_password-Evo-N800v_4700/sw/SipServer/main/kamailio/lib/kamailio/modules_k/perl.so: exports dlflags interface is deprecated and it will not be supported in newer versions; consider using mod_register() instead
0(26880) ERROR: <core> [modparam.c:161]: set_mod_param_regex: No module matching <tls> found
0(26880) : <core> [cfg.y:3419]: parse error in config file /home/p4dev/BLand_password-Evo-N800v_4700/sw/SipServer/main/kamailio/etc/kamailio/kamailio.cfg, line 437, column 118: Can't set module parameter
ERROR: bad config file (2 errors)
I'm not sure if this is a compatibility issue or is there some library missing that I have to install.
I saw this patch online with reference to Crypt-SSLeay at https://rt.cpan.org/Public/Bug/Display.html?id=70565
*The linker complains about missing SSLv2_method. The following patch works for me:*
--- SSLeay.xs~ 2011-08-29 07:25:46.000000000 +0200
+++ SSLeay.xs 2011-08-29 07:29:04.000000000 +0200
@@ -125,13 +125,9 @@
if(ssl_version == 23) {
ctx = SSL_CTX_new(SSLv23_client_method());
}
- else if(ssl_version == 3) {
+ else {
ctx = SSL_CTX_new(SSLv3_client_method());
}
- else {
- /* v2 is the default */
- ctx = SSL_CTX_new(SSLv2_client_method());
- }
SSL_CTX_set_options(ctx,SSL_OP_ALL|0);
SSL_CTX_set_default_verify_paths(ctx);
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
Hi,
we use the dialog-module to keep track of concurrent calls, and then set
a treshold for simultanious calls. After we upgraded from 1.5 to 3.2, we've
been having a lot of dialogs which are stuck in both the database and
memory.
kamailio -V
version: kamailio 3.2.1 (i386/linux) 918035-dirty
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS,
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
DBG_QM_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 918035 -dirty
compiled on 10:00:10 Dec 20 2011 with gcc 4.1.2
Our configuration:
modparam("dialog", "dlg_flag", 3)
modparam("dialog", "default_timeout", 21600)
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "db_url", VOIP_DATA4)
modparam("dialog", "db_mode", 1)
#!ifdef VOIP1
modparam("dialog", "table_name", "dialog1")
modparam("dialog", "vars_table_name", "dialog_vars1")
#!endif
#!ifdef VOIP2
modparam("dialog", "table_name", "dialog2")
modparam("dialog", "vars_table_name", "dialog_vars2")
#!endif
modparam("dialog", "profiles_with_value", "busy")
To Kamailio instances, voip1 and voip2, share the same config, but define VOIP1
and VOIP2, respectively.
Then in the main route:
if !allow_trusted() {
route(AUTH);
}
if (is_method("INVITE")) {
setflag(3);
dlg_manage();
if ($avp(s:f_uid) != $null) {
set_dlg_profile("busy","$avp(s:f_uid)");
get_profile_size("busy", "$avp(s:f_uid)", "$var(dlg_busy)");
xlog("L_INFO", "BUSY: f_uid: $avp(s:f_uid), dlg_busy: $var(dlg_busy)\n");
}
}
$avp(s:f_uid) is set in route(AUTH), so it will catch calls originating from one of
our users.
Then later in the callforward route:
# Testing dialog
$var(dlg_busy) = 0;
$var(dlg_busy1) = 0;
$var(dlg_busy2) = 0;
#!ifdef VOIP1
get_profile_size("busy", "$rU", "$var(dlg_busy1)");
sql_query("data4","select id from dialog2 where caller_contact like 'sip:$rU@%' or callee_contact like 'sip:$rU@%'", "dialog");
$var(dlg_busy2) = $dbr(dialog=>rows);
#!endif
#!ifdef VOIP2
get_profile_size("busy", "$rU", "$var(dlg_busy2)");
sql_query("data4","select id from dialog1 where caller_contact like 'sip:$rU@%' or callee_contact like 'sip:$rU@%'", "dialog");
$var(dlg_busy1) = $dbr(dialog=>rows);
#!endif
sql_result_free("dialog");
$var(dlg_busy) = $var(dlg_busy1) + $var(dlg_busy2);
And then check if $var(dlg_busy) is above a users treshold.
Finally when routing to a local user we mark it as busy:
set_dlg_profile("busy","$rU");
As of writing I have 5 entries in the dialog1-table, all valid, but:
# kamctl fifo dlg_list | grep -c "^dialog"
18
# kamctl fifo dlg_list | grep state | sort | uniq -c
13 state:: 1
5 state:: 4
on the other hand in the busy profile, which is the one we use:
# kamctl fifo profile_list_dlgs busy | grep -c "^dialog"
11
# kamctl fifo profile_list_dlgs busy | grep state | sort | uniq -c
6 state:: 1
5 state:: 4
It seems as this happens when, for some reason, kamailio is trying to parse duplicate INVITEs.
From the logs:
# grep "^Jan 17" /var/log/messages | grep BUSY | grep -v "dlg_busy: 1" | cut -d\ -f8- |sort | uniq -c
1 BUSY: f_uid: 2367449, dlg_busy: 2
3 BUSY: f_uid: 2367453, dlg_busy: 2
1 BUSY: f_uid: 2367453, dlg_busy: 3
1 BUSY: f_uid: 2367453, dlg_busy: 4
1 BUSY: f_uid: 2574912, dlg_busy: 2
1 BUSY: f_uid: 2582270, dlg_busy: 2
1 BUSY: f_uid: ahmedma, dlg_busy: 2
1 BUSY: f_uid: josephim, dlg_busy: 2
1 BUSY: f_uid: perla, dlg_busy: 2
1 BUSY: f_uid: rosalinm, dlg_busy: 2
1 BUSY: f_uid: suresha, dlg_busy: 2
1 BUSY: f_uid: sveinb, dlg_busy: 2
I've full debugging logs available, if needed.
--
Øyvind Kolbu
Hi all
I have started making some tests with the ndb_redis module. So far we have
not stressed the module (no more than 5 HGET commands/second at maximum).
It works well, but with at some point it starts failing. The failures are
easily found because the logs always show this:
INFO: <core> [main.c:811]: INFO: signal 13 received
After that the redis value is always null. If I restart kamailio it starts
working again.
I've run kamailio with debug=4 but I haven't seen more useful information.
On the redis side, I could find nothing in the logs either, the number of
clientes connected is alway much less than the configured maximum, Any idea?
On the other hand, if I restart redis we need to restart kamailio to
restore the connections. Is the reconnection to redis on the roadmap?
Thanks in advance
Regards
Javi
Hello,
Kamailio SIP Server v3.2.2 stable release is out.
This is a maintenance release of the latest stable branch, 3.2, that
includes fixes since release of v3.2.1. There is no change to database
schema or configuration language structure that you have to do on
installations of v3.2.0 or v3.2.1. Deployments running previous v3.2.x
versions are strongly recommended to be upgraded to v3.2.2.
For more details about version 3.2.2 (including links and hints to
download the tarball or from GIT repository), visit:
* http://www.kamailio.org/w/2012/01/kamailio-v3-2-2-released/
RPM packages are currently on the build service, Debian/Ubuntu packages
will be available soon as well.
Cheers,
Daniel
--
Daniel-Constantin Mierla -- http://www.asipto.comhttp://linkedin.com/in/miconda -- http://twitter.com/miconda
Hello list,
I`ve found a negative phenomenon during startup of kamailio 3.1.x
(orgininally found in version 3.1.5) that results in a core dump,
triggered by the snmpstats module.
During startup of the SIP proxy server machine the linux service
"heartbeat" is responsible for starting required ressources like mysql,
kamailio and snmpd. These services are monitored by the tool "monit".
Monit is supervising the state of the named services and if kamailio is
not up and running, monit is trying to restart the service. During
startup the mysql database takes some time until it is ready to use and
therefore kamailio can`t connect to the database. Monit is detecting
this and restarting kamailio. This is done so often until kamailio is up
and running.
Finally all services are up and running and the machine is working fine.
However, I do not like the core dump that was created during this
"restart phase". As soon as the module "snmpstats" is not used, no core
dump is created any more.
Information about the core dump looks as follows:
(1) output of kamailio log files:
<prefix> kamailio: INFO: <core> [tcp_main.c:4726]: init_tcp: using
epoll_lt as the io watch method (auto detected) <prefix>
/usr/sbin/kamailio[3027]: ERROR: db_mysql [km_my_con.c:109]: driver
error: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2) <prefix> /usr/sbin/kamailio[3027]:
ERROR: <core> [db.c:289]: could not add connection to the pool <prefix>
/usr/sbin/kamailio[3027]: ERROR: lcr [lcr_mod.c:359]: unable to connect
to the database <prefix> /usr/sbin/kamailio[3027]: ERROR: lcr
[lcr_mod.c:571]: unable to open database connection <prefix>
/usr/sbin/kamailio[3027]: ERROR: <core> [sr_module.c:875]: init_mod():
Error while initializing module lcr (/usr/lib/kamailio/modules/lcr.so)
<prefix> /usr/sbin/kamailio[3027]: INFO: snmpstats [snmpstats.c:387]:
The SNMPStats module got the kill signal <prefix> kamailio: ERROR:
<core> [daemonize.c:307]: Main process exited before writing to pipe
<prefix> kamailio: INFO: <core> [tcp_main.c:4726]: init_tcp: using
epoll_lt as the io watch method (auto detected) <prefix> kamailio:
WARNING: <core> [daemonize.c:352]: pid file contains old pid, replacing
pid <prefix> /usr/sbin/kamailio[3322]: INFO: usrloc [hslot.c:53]: locks
array size 512 <prefix> /usr/sbin/kamailio[3322]: INFO: auth
[auth_mod.c:312]: auth: qop set, but nonce-count (nc_enabled) support
disabled <prefix> /usr/sbin/kamailio[3322]: INFO: pua [pua.c:360]: the
query returned no result <prefix> /usr/sbin/kamailio[3322]: INFO: pike
[ip_tree.c:88]: probing 256 set size <prefix> /usr/sbin/kamailio[3322]:
INFO: <core> [udp_server.c:178]: INFO: udp_init: SO_RCVBUF is initially
111616 <prefix> /usr/sbin/kamailio[3322]: INFO: <core>
[udp_server.c:229]: INFO: udp_init: SO_RCVBUF is finally 262142 <prefix>
/usr/sbin/kamailio[3329]: INFO: mi_datagram [mi_datagram.c:326]: a new
child 0/3329
(2) output of GDB / core file:
Core was generated by `/usr/sbin/kamailio -P
/var/run/kamailio/kamailio.pid -m 1024 -u kamailio -g kama'. Program
terminated with signal 11, Segmentation fault.
[New process 3027]
#0 0xb775539c in freeInterprocessBuffer () at interprocess_buffer.c:354
354 interprocess_buffer.c: No such file or directory.
in interprocess_buffer.c
(gdb)
I know that it is not a fine method in killing kamailio during
initialisation. But I have not found a better way yet. The other modules
like LCR have no problem with the kill signal during initialisation. My
main question is now: how could these core dumps being avoided? Did
anybody have the same experience as me?
Thanks in advance,
Klaus