Thank you very much... that did it!
George
-----Original Message-----
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: Friday, July 13, 2012 3:51 AM
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
Users Mailing List
Cc: George Breahna
Subject: Re: [SR-Users] Kamailio + dialog + dispatcher (limiting calls)
Hello,
you have to use t_relay() instead of forward() -- some of the
operations are done on transaction callbacks for replies. Try this way
and if still troubles, let us know.
Cheers,
Daniel
On 7/13/12 5:46 AM, George Breahna wrote:
I am trying to limit the total number of
concurrent calls processed
by
Kamailio and I'm having a world of trouble.
We are running Kamailio 3.2.3 on Debian Squeeze with the dispatcher
module and recently enabled the dialog module. The call flow is
extremely simple.
We have two Asterisk servers to which we load
balance the incoming
calls to, nothing more.
Our dialog configuration is the default kamailio config, with the
following
additions:
modparam("dialog", "enable_stats", 1)
modparam("dialog", "dlg_flag", FLD_DLG) modparam("dialog",
"hash_size", 4096) modparam("dialog",
"profiles_with_value",
"callquota") modparam("dialog", "default_timeout", 300)
modparam("dialog", "dlg_match_mode",2) modparam("dialog",
"detect_spirals", 1) modparam("dialog", "db_mode", 0)
in request_route we have:
if ( method=="INVITE" ) {
t_on_failure("FAIL_ONE");
ds_select_dst("1","4");
# sl_send_reply("100","Trying");
t_reply("100", "Trying");
dlg_manage();
setflag(FLT_ACC); # do accounting
$var(SIZE) = 0;
get_profile_size("callquota", "$rU",
"$var(SIZE)");
if( $var(SIZE) >= MAX_NUMBER_OF_CALLS ){
xlog("DEBUG: Simultaneous calls limit
reached
for
$rU: $var(SIZE)\n");
sl_send_reply("503", "Simultaneous calls
limit reached");
exit;
}
set_dlg_profile("callquota","$rU");
if (get_profile_size("callquota","$var(SIZE)")) {
xlog("DEBUG: there are $var(SIZE) total
calls
for $rU\n");
}
forward();#uri:host, uri:port);
exit();
}
We also added a dlg_manage() in WITHINDLG
if (is_method("BYE")) {
dlg_manage();
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails }
The problem is that some dialogs never get erased. Their total number
always increases and their state is always 1
kamctl fifo profile_list_dlgs callquota
dialog:: hash=2161:28334339
state:: 1
ref_count:: 1
timestart:: 0
timeout:: 0
In the debug logs I see these entries for the dialog module:
### Starting Call
Jul 12 22:38:34 debian1 /usr/sbin/kamailio[25452]: ERROR: ***
cfgtrace:
c=[/etc/kamailio/kamailio.cfg] l=515 a=25
n=dlg_manage Jul 12
22:38:34
debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:523]: no dialog callid='1560428909_26358995(a)4.55.13.227'
found Jul 12 22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG:
dialog
[dlg_hash.c:523]: no dialog
callid='1560428909_26358995(a)4.55.13.227'
found Jul 12 22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG:
dialog
[dlg_hash.c:553]: no dialog
callid='1560428909_26358995(a)4.55.13.227'
found Jul 12 22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG:
dialog
[dlg_hash.c:309]: new dialog on hash 2161 Jul 12
22:38:34 debian1
/usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_handlers.c:271]: route_set <sip:1.2.3.4;lr=on>, contact
sip:+118884936245@4.55.13.227:5060, cseq 402 and bind_addr
udp:10.10.10.1:5060
Jul 12 22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:583]: ref dlg 0x7feb80ef0ae8 with 1 -> 1 Jul 12 22:38:34
debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:603]: ref dlg 0x7feb80ef0ae8 with 1 -> 2 Jul 12 22:38:34
debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:621]: unref dlg 0x7feb80ef0ae8 with 1 -> 1 Jul 12
22:38:34
debian1 /usr/sbin/kamailio[25452]: ERROR: ***
cfgtrace:
c=[/etc/kamailio/kamailio.cfg] l=525 a=27 n=set_dlg_profile Jul 12
22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:459]: ref dlg 0x7feb80ef0ae8 with 1 -> 2 Jul 12 22:38:34
debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:461]: dialog id=28334339 found on entry 2161 Jul 12
22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:621]: unref dlg 0x7feb80ef0ae8 with 1 -> 1 Jul 12
22:38:34
debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:514]: ref dlg 0x7feb80ef0ae8 with 1 -> 2 Jul 12 22:38:34
debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:517]: dialog callid='1560428909_26358995(a)4.55.13.227'
found#012 on entry 2161, dir=1 Jul 12 22:38:34 debian1
/usr/sbin/kamailio[25452]: CRITICAL: dialog
[dlg_hash.c:650]: bogus event 6 in state 1 for dlg 0x7feb80ef0ae8
[2161:28334339] with clid '1560428909_26358995(a)4.55.13.227' and tags
'gK0251b91f' ''
Jul 12 22:38:34 debian1 /usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:808]: dialog 0x7feb80ef0ae8 changed from state 1 to state
1, due event 6 (ref 2) Jul 12 22:38:34 debian1
/usr/sbin/kamailio[25452]: DEBUG: dialog
[dlg_hash.c:621]: unref dlg 0x7feb80ef0ae8 with 1 -> 1
### Hanging up now
Jul 12 22:38:46 debian1 /usr/sbin/kamailio[25456]: DEBUG: tm
[uac.c:182]:
DEBUG: dlg2hash: 29877
Jul 12 22:38:46 debian1 /usr/sbin/kamailio[25456]: DEBUG: tm
[uac.c:182]:
DEBUG: dlg2hash: 29874
Jul 12 22:38:46 debian1 /usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:514]: ref dlg 0x7feb80ef0ae8 with 1 -> 2 Jul 12 22:38:46
debian1 /usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:517]: dialog callid='1560428909_26358995(a)4.55.13.227'
found#012 on entry 2161, dir=1 Jul 12 22:38:46 debian1
/usr/sbin/kamailio[25455]: CRITICAL: dialog
[dlg_hash.c:650]: bogus event 7 in state 1 for dlg 0x7feb80ef0ae8
[2161:28334339] with clid '1560428909_26358995(a)4.55.13.227' and tags
'gK0251b91f' ''
Jul 12 22:38:46 debian1 /usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:808]: dialog 0x7feb80ef0ae8 changed from state 1 to state
1, due event 7 (ref 2) Jul 12 22:38:46 debian1
/usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:621]: unref dlg 0x7feb80ef0ae8 with 1 -> 1 Jul 12
22:38:46
debian1 /usr/sbin/kamailio[25455]: ERROR: ***
cfgtrace:
c=[/etc/kamailio/kamailio.cfg] l=625 a=25 n=dlg_manage Jul 12
22:38:46
debian1 /usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:459]: ref dlg 0x7feb80ef0ae8 with 1 -> 2 Jul 12 22:38:46
debian1 /usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:461]: dialog id=28334339 found on entry 2161 Jul 12
22:38:46 debian1 /usr/sbin/kamailio[25455]: DEBUG: dialog
[dlg_hash.c:621]: unref dlg 0x7feb80ef0ae8 with 1 -> 1
Is my config wrong ? Am I missing anything here ? Any advice would be
much appreciated
Thank you,
George
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -
http://www.asipto.com
http://twitter.com/#!/miconda -
http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 -
http://asipto.com/u/katu Kamailio Practical Workshop, Netherlands, Sep
10-12, 2012 -
http://asipto.com/u/kpw