Hello,
I’ve managed to get some logs for this:
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=241 a=17 n=if
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=231 a=26 n=is_method
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=233 a=27 n=xlog
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: INFO: <script>: Route:REQUEST;UnixTime:1355721242;RequestURI:318005004;RequestMethod:CANCEL;FromTag:3564710050-583052;ToTag:<null>;CallID:315009-3564710050-583046@AM00SBC06.netops.local;From:31612459865;To:318005004
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=238 a=17 n=if
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=234 a=25 n=t_check_trans
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=235 a=25 n=dlg_manage
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=236 a=25 n=t_relay
2012-12-17T06:14:02+01:00 clubkamailio01 /usr/local/sbin/kamailio[22664]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=238 a=3 n=exit
The dlg_manage is called in this code block:
# CANCEL processing
if (is_method("CANCEL"))
{
xlog("L_INFO","Route:REQUEST;UnixTime:$TS;RequestURI:$rU;RequestMethod:$rm;FromTag:$ft;ToTag:$tt;CallID:$ci;From:$fU;To:$rU");
if (t_check_trans()) {
dlg_manage();
t_relay();
}
exit;
}
As you can see dlg_manage has been called, but the following commands still showed there was an active dialog even though the call was no longer active:
kamctl fifo get_statistics all | grep active_dialogs
kamctl fifo profile_get_size 318005004
Both showed a count of 1.
Regards,
Grant
From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Grant Bagdasarian
Sent: donderdag 22 november 2012 11:29
To: miconda@gmail.com
Cc: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Subject: Re: [SR-Users] Dialog module not decrementing profile size
Hello,
What does the dlg_manage() function actually do? On receiving a BYE request does it remove the current SIP dialog from the profile it belongs to?
Would it help if I changed the dlg_match_mode to 1?
Regards,
Grant
From: Grant Bagdasarian
Sent: dinsdag 20 november 2012 14:42
To: 'miconda@gmail.com'
Cc: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Subject: RE: [SR-Users] Dialog module not decrementing profile size
Hello,
Alright, I’ve added the xlog with the additional information to log.
I’m not sure if the dialog is no longer in the list of active dialogs, but still in profile, but it does look like this is the case. I haven’t checked the active_dialogs when it happened, since I’m still fairly new to kamailio. The way I notice when this happens is to count the dialogs in the database and match them with the active calls count on our Cisco. This check is performed multiple times over a certain period of time, before it marks it as failure. When the check fails I know something is wrong.
I’ll make sure to check the active_dialogs it when it happens again. Thanks for the pointers!
Regards,
Grant
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: dinsdag 20 november 2012 14:16
To: Grant Bagdasarian
Cc: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Subject: Re: [SR-Users] Dialog module not decrementing profile size
Hello,
On 11/20/12 10:02 AM, Grant Bagdasarian wrote:
Hello Daniel,
I’ve enabled the cfgtrace. Now all I have to do is wait till it happens again, as the problem does not occur often.
For now I’m getting the following:
2012-11-20T09:56:15+01:00 kamailio /usr/local/sbin/kamailio[16350]: ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=302 a=25 n=dlg_manage
Debug is currently set to 2: debug=2
Should I set this to 4?
no, 2 is fine, but be sure you also have an xlog message to print at least the method type, call-id, from tag and to tag. That will allow to see for which request the cfg trace is related.
Just to be sure I haven't misunderstood, the dialog is no longer in the list of active dialogs, but it is still in the profile.
Cheers,
Daniel
Grant
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: maandag 19 november 2012 9:59
To: Grant Bagdasarian
Cc: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Subject: Re: [SR-Users] Dialog module not decrementing profile size
Hello,
On 11/16/12 8:54 AM, Grant Bagdasarian wrote:
Hello Daniel,
Yes, dlg_manage() is being called in the BYE, yet it sometimes still occurs that dialogs aren’t being cleared.
It is critical for us the dialogs are being cleared as we have an application which heavily relies on this.
Do you get any error messages in syslog?
Can you add an xlog(...) message (or load the debugger module and enable cfgtrace parameter), then look at the log messages to be sure dlg_manage() is executed for BYE requests?
Cheers,
Daniel
Kind regards,
Grant Bagdasarian
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: donderdag 8 november 2012 8:03
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Cc: Grant Bagdasarian
Subject: Re: [SR-Users] Dialog module not decrementing profile size
Hello,
On 10/30/12 10:51 AM, Grant Bagdasarian wrote:
Hello Community,
I’ve recently started to use the Dialog module to manage the amount of incoming calls from our SIP provider allowed to pass through by using profiles_with_values and setting the size of these profiles to a certain amount.
Most of the time this works as it should, but sometimes the ‘slots’ available for a profile aren’t cleared even though a dialog has finished. This seems to happen when an high amount of regular traffic is hitting kamailio.
Has anyone else experienced this? Are there perhaps any other ways to control the slots available for certain incoming SIP traffic?
Below parts of my configuration file. Perhaps I’m doing something wrong which causes this to happen.
In my route[WITHINDLG] -> loose_route -> is_method(“BYE”) I’m not calling dlg_manage(), could this be the problem?
is the dlg_manage() executed or not for BYE? You say no above, but the example has it. Because you have dlg_match_mode=2, you must call dlg_manage() for BYE explicitly.
Cheers,
Daniel
Other comments are welcome too, as I’m fairly new to Kamailio.
modparam("dialog", "enable_stats", 1)
modparam("dialog", "dlg_flag", 4)
modparam("dialog", "hash_size", 4096)
modparam("dialog", "profiles_with_value", "318005004");
modparam("dialog", "default_timeout", 43200)
modparam("dialog", "dlg_match_mode",2)
modparam("dialog", "detect_spirals", 1)
request_route {
# per request initial checks
route(REQINIT);
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE")) {
xlog("L_INFO", "Incoming request for $rU from $fU");
if ($rU == "318005004") {
route(DIALOG);
}
}
# handle registrations
route(REGISTRAR);
if ($rU==$null)
{
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# dispatch destinations
route(DISPATCH);
route(RELAY);
}
route[DIALOG] {
dlg_manage();
record_route();
$var(SIZE) = 0;
sql_query("vf", "exec dbo.SelectAvailableSlots '00$rU'", "ra");
$avp(s:limit) = $dbr(ra=>[0,7]);
xlog("L_INFO", "Maximum simultaneous calls is configured at $avp(s:limit) ....");
sql_result_free("ra");
if ($rU == "318005004") {
get_profile_size("318005004", "$rU", "$var(SIZE)");
}
xlog("L_INFO", "There are currently $var(SIZE) calls for $rU, excluding the current call");
if($var(SIZE) >= $avp(s:limit)) {
xlog("L_INFO", "Simultaneous calls limit of $avp(s:limit) reached for $rU: $var(SIZE)\n");
sl_send_reply("603", "Simultaneous calls limit reached");
exit;
}
if ($rU == "318005004") {
set_dlg_profile("318005004", "$rU");
}
if ($rU == "318005004") {
if(get_profile_size("318005004", "$var(SIZE)")) {
xlog("L_INFO", "There are currently $var(SIZE) calls for $rU, including the current call");
}
}
}
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
#Used for call transfer
if($fU == "318005004") {
if (is_method("UPDATE")) {
sl_send_reply("405","Method not allowed");
xlog("L_INFO", "Dropping UPDATE message...\n");
exit;
}
if (is_method("INVITE")) {
record_route();
}
if (is_method("BYE")) {
dlg_manage();
}
}
if (is_method("BYE")) {
setflag(1); # do accounting ...
setflag(3); # ... even if the transaction fails
}
route(RELAY);
} else {
if (is_method("SUBSCRIBE") && uri == myself) {
# in-dialog subscribe requests
route(PRESENCE);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK;
# must be ACK after a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ... ignore and discard.
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}
Regards,
Grant
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@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, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - http://asipto.com/u/katu
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda