<p></p>
<p>Thanks <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/miconda/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/miconda">@miconda</a>, here you go.</p>
<pre><code>####### Global Parameters #########
debug = 2
log_stderror = no
log_facility = LOG_LOCAL6
listen = eth0

####### Modules Section ########
# mpath="/usr/lib64/kamailio/modules/"

loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "debugger.so"
loadmodule "htable.so"

# ----- tm params -----
modparam("tm", "failure_reply_mode", 3)
modparam("tm", "remap_503_500", 0)
modparam("tm", "contacts_avp", "tm_contacts")
modparam("tm", "contact_flows_avp", "tm_contact_flows")

# ----- rr params -----
modparam("rr", "enable_full_lr", 0)
modparam("rr", "append_fromtag", 1)

# ----- htable params -----
modparam("htable", "htable", "gateways=>size=4")

request_route
{
    if (!is_method("ACK")) {
        if(t_precheck_trans()) {
            t_check_trans();
            exit;
        }
        t_check_trans();
    }

    if (!sanity_check("1535", "7")) {
        exit;
    }

    if ( msg:len >= 8192 ) {
        send_reply("513", "Message too big");
        exit;
    }

    if (!mf_process_maxfwd_header("10")) {
        send_reply("483", "Too Many Hops");
        exit;
    }

    if (is_method("OPTIONS")) {
        send_reply("200","OK");
        exit;
    }

    if (has_totag()) {
        if (is_method("INVITE")) {
            record_route();
        }
        if (loose_route()) {
            route(RELAY);
        }
        if (is_method("ACK")) {
            if (t_check_trans()) {
                route(RELAY);
            }
            exit;
        }
        send_reply("481", "Call Leg/Transaction Does Not Exist");
        exit;
    }

    if (is_method("CANCEL")) {
        if (t_check_trans()) {
            route(RELAY);
        } else {
            send_reply("481", "Call leg/transaction does not exist");
        }
        exit;
    } else if (is_method("ACK")) {
        if (t_check_trans()) {
            route(RELAY);
        }
        exit;
    }

    remove_hf("Route");
    record_route();

    $var(i) = 1;
    while ($var(i) < 10) {
        $sht(gateways=>$var(i)) = "host=" + $_s($var(i).$var(i).$var(i).$var(i)) + ";priority=" + $var(i);
        xlog ("==== Storing: $sht(gateways=>$var(i))\n");
        $var(i) = $var(i) + 1;
    }

    sht_iterator_start("i", "gateways");
    while(sht_iterator_next("i")) {
        append_branch("sip:$rU@$(shtitval(i){param.value,host})", "$_s(0.$(shtitval(i){param.value,priority}))");
    }
    sht_iterator_end("i");
    t_load_contacts();
    xlog ("Route order:\n");
    while (t_next_contacts()) {
        xlog ("==== $rd\n");
    }
    route(RELAY);
}

route[RELAY] {
    xlog ("L_INFO", "Routing to $rd/$du\n");
    t_on_failure("OB_FAILURE");
    if (!t_relay()) {
        sl_reply_error();
    }
    exit;
}

failure_route[OB_FAILURE] {
    if (t_is_canceled()) {
        xlog("L_INFO", "Transaction cancelled\n");
        exit;
    }
    if (!t_next_contacts() && $ru==$ou) {
        send_reply("503", "Service Unavailable");
        exit;
    }
    t_on_failure("OB_FAILURE");
    route(RELAY);
    exit;
}
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2449#issuecomment-693656481">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN4Q34PCGSIQ7Z45FTSGEP7HANCNFSM4QFF6F4Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZLOTBHUR77GEZUZD63SGEP7HA5CNFSM4QFF6F42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFFMFXII.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2449#issuecomment-693656481",
"url": "https://github.com/kamailio/kamailio/issues/2449#issuecomment-693656481",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>