Good time! Sorry - can not in this topic, but it can help?

Sometimes, the subscriber receives a "503", "Simultaneous calls limit reached".
I guess it's because of the incorrectness of the dialog.
It helps to restart Opensips...
It is necessary to determine the cause of non-completion of dialog.
I think they need to use for this DB, but how to do it?
And how to identify and remove the cause with the help of the database?
Pplease, help. 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);
        }
}
}


26.12.2014 12:06, John Nash пишет:
Hello Bogdan,

Probably I did not explain well. I am using OpenSIPS (1.12.0dev-notls (x86_64/linux))

When dialog is created I see the MI command output as ...
 opensipsctl fifo dlg_list_ctx
dialog:: *hash=3028:502141575*
        state:: 4
        user_flags:: 0
        timestart:: 1419578844
        datestart:: 2014-12-26 07:27:24
        timeout:: 1419582444
        dateout:: 2014-12-26 08:27:24
        callid:: a8d3a13820394340b2c6b54867126726
---------------- and so on -------------------------------------------------

But in database values are like ..
*dlg_id (This column is big int) = 13005663113863*
call_id = a8d3a13820394340b2c6b54867126726

Even all dialog update queries (when i see debug=4) I can see dialog is updated using the key dlg_id = 13005663113863 (Big int value) ...I think it is very very good to use a big int value for unique dialog ID as DB updates will be much faster. But I am unable to find some way to access this dlg_id = 13005663113863 in script (I basically want to update dialogs with some custom values).

Am i using the correct code? May be I am using some "under construction" works?

John





On Fri, Dec 26, 2014 at 1:45 PM, Bogdan-Andrei Iancu <[email protected] <mailto:[email protected]>> wrote:

    It is the same value, but in var is kept ad string representation.

    Regards,
    Bogdan


    Sent from Samsung Mobile


    -------- Original message --------
    From: John Nash
    Date:26/12/2014 09:59 (GMT+02:00)
    To: Bogdan-Andrei Iancu
    Cc: OpenSIPS users mailling list
    Subject: Re: [OpenSIPS-Users] New Big int dlg_id of dialog table

    this variable holds a string value for dilog DID but in my table
    there is a field big int which stores some kind of id

    On Fri, Dec 26, 2014 at 1:16 PM, Bogdan-Andrei Iancu
    <[email protected] <mailto:[email protected]>> wrote:

        Hi John,

        See the $DLG_did variable from the dialog module:
        http://www.opensips.org/html/docs/modules/1.11.x/dialog.html#id297237

        Regards,

        Bogdan-Andrei Iancu
        OpenSIPS Founder and Developer
        http://www.opensips-solutions.com

        On 26.12.2014 07:10, John Nash wrote:
        I was just wondering if there is any way to get dlg_id value
        in a script using some psudo variable. like in earlier
        versions we had $DLG_did


        _______________________________________________
        Users mailing list
        [email protected]  <mailto:[email protected]>
        http://lists.opensips.org/cgi-bin/mailman/listinfo/users





_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to