[OpenSIPS-Users] Problems with drouting configuration

Alejandro Recarey alexrecarey at gmail.com
Wed Dec 14 06:20:05 CET 2011


Hi all,

I've been trying to configure the drouting module, but I must not
understand how to use it. When I use my drouting opensips.cfg file,
the opensips server stops replying to INVITE requests. The file has no
syntactical errors, and there is nothing in the log.

My dr_rules table contains something like this:

ruleid, groupid, prefix, timerec, priority, routeid, gwlist, description
'1', '1', '1147', '20000101T000000', '0', '0', '1,2,3,4', 'Carrier 1'
'2', '1', '131#', '20000101T000000', '0', '0', '5', 'Carrier 2'

my dr_gateways table contains something like this:

gwid, type, address, strip, pri_prefix, attrs, probe_mode, description
'1', '2', '111.222.222.111', '4', NULL, NULL, '0', 'Carrier 1 GW 1'
'2', '2', '123.123.123.123, '4', NULL, NULL, '0', 'Carrier 1 GW 2'
'3', '2', '231.231.231.231', '4', NULL, NULL, '0', 'Carrier 1 GW 3'
'4', '1', '122.122.122.122', '4', NULL, NULL, '0', 'Carrier 1 GW 4'
'5', '1', '133.133.133.133', '4', NULL, NULL, '0', 'Carrier 2'

dr_groups and dr_gw_lists are empty.

The relevant part of my routing block is like this:




# ----- Dynamic Routing module ----- #
avp_aliases="dr_ruri=i:20"
avp_aliases="dr_attrs=i:21"
modparam("drouting", "db_url", "mysql://user:pass@ipaddress/database")
modparam("drouting", "ruri_avp", '$avp(dr_ruri)') # stores alternative
destinations for current route.
modparam("drouting", "attrs_avp", '$avp(dr_attrs)') # Stores attribute
of current selected destination.
modparam("drouting", "use_domain", 0)
modparam("drouting", "probing_from", "sip:pinger at mydomain.com")
modparam("drouting", "probing_reply_codes", "501, 403, 404")

<<<...>>>

   # ---- Outbound route generation ---- #
    if(do_routing("0","1")){
       route(10);
    }
    else{
        send_reply("503", "No Rules matching the URI");
        exit;
    }
    exit;

<<<...>>>

# Routing for Dynamic routing rules
route[10] {
    # for INVITEs enable some additional helper routes
    if (is_method("INVITE")) {
        t_on_branch("2");
        t_on_reply("2");
        t_on_failure("10");
    }

    if (!t_relay()) {
        sl_reply_error();
    };
    exit;
}

# Dynamic Routing Failures
failure_route[10] {
    if (t_was_cancelled()) {
        exit;
    }

    if (t_check_status("(408)") && t_local_replied("all")) {
        xlog("Carrier timed out - disabling route");
        dr_disable();

        # Try to route thru the next destination in list
        if (use_next_gw()) {
            t_on_failure("1");
            t_relay();
        } else {
            t_reply("503","Carrier Down / Unavailable");
        }
    }



So that's it. The rest of the config is the same as in my other
(working) script. What am I doing wrong?

Thanks for the help!



More information about the Users mailing list