I was inspired by Daniels ClueCon 2013 talk and have decide to try to add
simple rate limiting using a HTable.
$var(srcgroup) is an id that identifies the invites source/ I wish to limit
invites from a given source.
$var(rateHashMin) was added just to allow simple monitoring.
I query the table via XML-RPC to get an idea of current load.
I think it would be better to add it to a seperate table and then I could
increase the exprires time to capture more of the course grain points.
I am interested in any comments.
----------------------
modparam("htable", "htable",
"htable_source_group_rates=>size=8;dbtable=htable_source_group_rates;initval=0;autoexpire=300;")
modparam("htable", "htable",
"htable_source_group_limits=>size=8;dbtable=htable_source_group_limits;initval=500;")
----------------------
----------------------
route[SOURCE_GROUP_LIMIT] {
if (is_method("INVITE")){
$var(rateHashSec) = (str)$var(srcgroup)+":sec:"+$timef(%Y/%m/%d_%H_%M_%S);
$var(rateHashMin) = (str)$var(srcgroup)+":min:"+$timef(%Y/%m/%d_%H_%M_00);
$sht(htable_source_group_rates=>$var(rateHashSec)) =
$sht(htable_source_group_rates=>$var(rateHashSec)) + 1;
$sht(htable_source_group_rates=>$var(rateHashMin)) =
$sht(htable_source_group_rates=>$var(rateHashMin)) + 1;
if($sht(htable_source_group_rates=>$var(rateHashSec)) >
$sht(htable_source_group_limits=>$var(srcgroup)))
{
sl_send_reply("503", "$si over source Limit of
$sht(htable_source_group_rates=>$var(rateHashSec)) /
$sht(htable_source_group_limits=>$var(srcgroup)");
exit;
}
}
}
----------------------
Thanks Gareth
Hello Carsten,
Yha I have not included 'xmlrpc' for compilation.
Can you please list all the required modules to be compiled with the ims
modules so that I can know more about kamailio-ims.
Thank you,
Kota Sai Krishna
Hi,
I've been exploring the possibility to port Kamailio 3.3 (SER) to some MIPS boards. I didn't have any problem with the first one, with a GCC 4.3.4 toolchain. But on my second board (gcc 3.4.2) I am having problems when compiling. Are there any requirements for gcc/binutils/kernel versions?
This is the log I am getting:
CC (mipsel-linux-uclibc-gcc) [ser]sip_msg_clone.o
In file included from atomic_ops.h:181,
from sip_msg_clone.c:43:
atomic/atomic_unknown.h:59:2: warning: #warning no native memory barrier implementations, falling back to slow lock based workarround
CC (mipsel-linux-uclibc-gcc) [ser]socket_info.o
In file included from socket_info.c:836:
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/netlink.h:22: error: parse error before "__u32"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/netlink.h:28: error: parse error before "__u32"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/netlink.h:30: error: parse error before "nlmsg_flags"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/netlink.h:31: error: parse error before "nlmsg_seq"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/netlink.h:32: error: parse error before "nlmsg_pid"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/netlink.h:83: error: field `msg' has incomplete type
In file included from socket_info.c:837:
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:253: error: parse error before "__u32"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:255: error: parse error before "rta_expires"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:256: error: parse error before "rta_error"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:257: error: parse error before "rta_used"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:260: error: parse error before "rta_id"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:261: error: parse error before "rta_ts"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:262: error: parse error before "rta_tsage"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:333: error: parse error before "__s32"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:359: error: parse error before "__u16"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:361: error: parse error before "ndm_type"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:404: error: parse error before "__u32"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:406: error: parse error before "ndm_updated"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:407: error: parse error before "ndm_refcnt"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:519: error: parse error before "__u32"
/opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/sys-include/linux/rtnetlink.h:521: error: parse error before "tcm_info"
socket_info.c: In function `addattr_l':
socket_info.c:874: error: dereferencing pointer to incomplete type
socket_info.c:878: error: dereferencing pointer to incomplete type
socket_info.c:882: error: dereferencing pointer to incomplete type
socket_info.c:882: error: dereferencing pointer to incomplete type
socket_info.c: In function `nl_bound_sock':
socket_info.c:891: error: storage size of 'la' isn't known
socket_info.c:891: warning: unused variable `la'
socket_info.c: In function `get_flags':
socket_info.c:929: error: field `nlh' has incomplete type
socket_info.c:953: error: dereferencing pointer to incomplete type
socket_info.c:957: error: dereferencing pointer to incomplete type
socket_info.c:967: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:967: error: dereferencing pointer to incomplete type
socket_info.c:967: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:967: error: dereferencing pointer to incomplete type
socket_info.c:967: error: dereferencing pointer to incomplete type
socket_info.c:967: error: dereferencing pointer to incomplete type
socket_info.c:967: warning: left-hand operand of comma expression has no effect
socket_info.c:968: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:970: error: dereferencing pointer to incomplete type
socket_info.c:970: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c: In function `build_iface_list':
socket_info.c:996: error: field `nlh' has incomplete type
socket_info.c:1043: error: dereferencing pointer to incomplete type
socket_info.c:1047: error: dereferencing pointer to incomplete type
socket_info.c:1057: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:1057: error: dereferencing pointer to incomplete type
socket_info.c:1057: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:1057: error: dereferencing pointer to incomplete type
socket_info.c:1057: error: dereferencing pointer to incomplete type
socket_info.c:1057: error: dereferencing pointer to incomplete type
socket_info.c:1057: warning: left-hand operand of comma expression has no effect
socket_info.c:1058: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:1060: error: dereferencing pointer to incomplete type
socket_info.c:1060: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
socket_info.c:1067: error: dereferencing pointer to incomplete type
socket_info.c:1067: error: invalid application of `sizeof' to incomplete type `nlmsghdr'
make[1]: *** [socket_info.o] Error 1
make: *** [bin] Error 2
Do you have an idea on what could be producing the error?
Thanks and kind regards
After many failures because of broken libraries I managed to decrypt
my problematic TLS sessions providing the private key of kamailio to
wireshark.
With TLS+SRTP enabled my nokia phones send session progress and pracks
with rtp port. This breaks NAT/rtpproxy in kamailio, which replaces
the rtpproxy port in session progress, but then forgets about it for
the 200 OK.
Attached is a tree overview and the conversations of each phone with kamailio.
hiro
Hi,
I am trying to use the carrierroute module, however the carrierroute.so
file is not in the module directory. I installed Kamailio version 4 from
yum.
Thanks,
Keith
Hi Daniel,
Thanks for the response.
I am following the xcap syntax from the RFC 4825 section 6.4.
Refer http://tools.ietf.org/html/rfc4825#section-6.4
Also suggest me the way i can change the node, if i am wrong.
Regards,
Anzi.
Hello,
I am having trouble getting a large list of dialogs (800+) out of
Kamailio using the dlg.list binrpc command.
I posted a while back that the list of dialog data was coming back
truncated, and was told to increase:
modparam("ctl", "binrpc_max_body_size", ...)
modparam("ctl", "binrpc_struct_max_body_size", ...)
I did that, increasing the buffers to 20 MB. Then, when I ran
sercmd -s unixs:/tmp/kamailio_ctl dlg.list
I got:
ERROR: reply too big
which clearly seemed to be on the client side now.
So, I looked in the sources for sercmd (now sercmd), in
sip-router/utils/sercmd/sercmd.c, and found this:
if ((ret=get_reply(s, reply_buf, MAX_REPLY_SIZE, cookie, &in_pkt,
&msg_body))<0){
switch(ret){
case -1:
goto error_read;
case -2:
goto error_parse;
case -3:
goto error_cookie;
case -4:
goto error_toobig;
So, I adjusted:
#define MAX_REPLY_SIZE
to several megabytes as well, and tried the same with MAX_BODY_SIZE too.
Now, when I run the dlg.list command, it just hangs and never returns
anything. It was stuck there for well over 20 minutes. An 'strace' on
sercmd reveals that it receives what appears to be the full listing, but
keeps wanting to read() more. I don't have the exact output handy at
the moment, but it looked like this:
socket(PF_FILE, SOCK_STREAM, 0) = 3
connect(3, {sa_family=AF_FILE, path="/tmp/kamailio_ctl"}, 110) = 0
writev(3, [{"\241\3\v%s\230\4", 7}, {"\221\tdlg.list\0", 11}], 2) = 18
read(3, "\241\27\16\257%s\230\4\221Hhash:551:9521 state:4 "...,
786432) = 340000
read(3,
[just hangs here]
Now, I would have assumed that perhaps there is more to read and the
output is not returning due to some endless locking of the dialog
profile table, which is constantly changing. However, that cannot be
the case because
kamctl fifo dlg_list
works fine for any amount of dialogs, and always returns all the data
near-instantly!
Any assistance is much appreciated!
-- Alex
[1] I don't have the output handy at the moment, but it was a read() value:
--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
Hello,
Here is a query about kamailio deployment. If some one can please help in this regard.We
have deployed a Kamailio server.. But due to some un-aviodable issues,
our internet connection is unreliable. So to counter this we have got
two internet connection with static IP's. Can some one advice some
mechanism so that our Kamailio server automatically switches itself from
one IP to other one in case of internet connection failure.
How can this be achieved ?
Any help will be appreciated.
Thanks.