[Kamailio-Users] Problems in ACC with missing BYE

David kamailio.org at spam.lublink.net
Thu Jun 11 15:08:28 CEST 2009


Hi,

I am using Kamailio as my ACC, Dispatcher, far end nat and presence 
server in front of a farm of asterisk boxes.

Most calls are being properly added into my acc table and using a join 
between the INVITEs, CANCELs, and BYEs I am able to get what seems like 
accurate call detail records.

The trouble is that every so often a BYE does not make it back to my 
server. In my simulation this morning, I simply unplugged ( electric ) 
the two phones that were having a pleasant conversation.  Now I have 
asterisk that thinks the call is still running and I have Kamailio which 
has no ending 'BYE' message. For the most part this is not a big deal, 
but when I can a cellular phone in European countries, my provider 
thinks I am still talking. At 30 cents a minute, that's a lot.

Here are some snippets from my code :

loadmodule("dialog.so")
loadmodule("acc.so")
loadmodule("sst.so")

modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)
# There is also a parameter for the DB, but I can't give you my password
modparam("acc", "db_url", "some://valid:url@to/db")

# Note $avp(i:10) always ends up being 14400 ( less than the value on 
the help page )
modparam("dialog", "timeout_avp", "$avp(i:10)")
modparam("sst", "timeout_avp", "$avp(i:10)")
modparam("sst", "sst_flag", 5)



Relevant snippets from my routing :

if ( has_totag()) {
 if ( loose_route() ) {
  if ( is_method("CANCEL|BYE") {
    setflag(1);
    setflag(3);

}
}

# Routing of INVITEs
setflag(2)
if ( !is_method("ACK"))
{
  setflag(1);
}



setflag(4);

setflag(5);


For invites, I have a onreply_route and failure_route which I use  only 
for RTP Stuff.

On reply route checks if rtpproxy is needed, if it is it is activated. 
failure_route checks if rtpproxy was activated and if it was deactives 
it. The only other code in the failure route is this :

if ( t_was_cancelled() ){
exit ;
}

So, the problem is, when phones do not send BYE, what do I do? I need 
resources freed up from Asterisk, RTP Proxy, and Kamailio Dialog, and I 
need the call to be canceled with my provider and I need for my ACC to 
recieve some indication as to when the call ended. Obviously it won't be 
exact to the second, but I kind of thought that the SIP Session Timers 
would notice the phone was gone and would generate a BYE or something?

What do I do?

Thanks,

David







More information about the sr-users mailing list