[OpenSIPS-Users] Dialog does not end

Anton lav at ptcomm.ru
Thu May 14 10:12:30 CEST 2015


Good time!

Sometimes, the subscriber receives a "503", "Simultaneous calls limit 
reached".
I guess it's because of the incorrectness of the dialogue.
It helps to restart Opensips
It is necessary to determine the cause of non-completion of dialogue.
I think they need to use for this database, but how to do it?
And how to identify and remove the cause with the help of the database?
Thanks!


part of the CFG below:

#### Dialog Module
loadmodule "dialog.so"
modparam("dialog", "db_url", 
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("dialog", "table_name", "dialog")
modparam("dialog", "db_mode", 1)
modparam("dialog", "db_update_period", 60)
modparam("dialog", "profiles_with_value", "gwquota;subscriberquota")

modparam("auth_db", "load_credentials", 
"$avp(subscriber_username)=username")

route[subscriberquota] {

     avp_db_query("select quota from subscriber where 
username='$var(subscriber)'","$avp(subscriberquota)");
     if ($avp(subscriberquota) == 0) {
         xlog("Subscriberquota route, NO LIMIT FOR USER 
<$var(subscriber)>");
         return;
     }
     $var(size) = 0;
     get_profile_size("subscriberquota", "$var(subscriber)", "$var(size)");
     if( $var(size) >= $avp(subscriberquota) ){
         sl_send_reply("503", "Simultaneous calls limit reached");
         xlog("Subscriberquota route, Limit of $var(size) active calls 
has been reached for subscriber $var(subscriber)");
         exit;
     }
     set_dlg_profile("subscriberquota","$var(subscriber)");
     get_profile_size("subscriberquota", "$var(subscriber)", "$var(size)");
     xlog("Subscriberquota route, there are now $var(size) active calls 
for subscriber $var(subscriber)");
     return;

}

route[gwquota] {

     #avp_db_query("select quota from quota where 
username='$avp(gw_id)'","$avp(gwquota)");
     if ($avp(gw_attrs) == 0) {
         xlog("GWquota route, NO LIMIT FOR GW $avp(gw_id)");
         return;
     }
     $avp(gwquota) = $avp(gw_attrs);
     $var(size) = 0;
     get_profile_size("gwquota", "$avp(gw_id)", "$var(size)");
     if( $var(size) >= $avp(gwquota) ){
         sl_send_reply("503", "Simultaneous calls limit reached");
         xlog("GWquota route, Limit of $var(size) active calls has been 
reached for GW $avp(gw_id)");
         exit;
     }
     set_dlg_profile("gwquota","$avp(gw_id)");
     get_profile_size("gwquota", "$avp(gw_id)", "$var(size)");
     xlog("GWquota route, there are now $var(size) active calls for GW 
$avp(gw_id)");
     return;

}

route[dialog] {

if (has_totag()) {
# sequential requests within a dialog should
# take the path determined by record-routing
if (loose_route()) {

if (method=="BYE" || method=="CANCEL") {
setflag(ACC_DO); # do accounting ...
setflag(ACC_FAILED); # ... even if the transaction fails
} else if (is_method("INVITE")) {
                 # even if in most of the cases is useless, do RR for
                 # re-INVITEs alos, as some buggy clients do change 
route set
                 # during the dialog.
                 record_route();
             }
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(relay);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}

}

route[invite] {

# account only INVITEs
if (is_method("INVITE")) {
         create_dialog("B");
xlog("L_INFO", "New invite recived\n");
perl_exec("test");
xlog("L_INFO", "Execution perl function result is $retcode\n");
         if (is_from_gw("0","i","$avp(gw_attrs)")) {
             route(gwquota);
             route(terminate);
         } else {
             route(auth);
             $DLG_timeout=60;
             $var(subscriber) = $avp(subscriber_username);
             route(subscriberquota);
             route(originate);
         }

}

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150514/57eafda3/attachment-0001.htm>


More information about the Users mailing list