[SR-Users] Q: purpose of t_newtran() in kamailio-basic.cfg route[LOCATION]?

Anthony Alba ascanio.alba7 at gmail.com
Sat Sep 9 17:28:41 CEST 2017


In kamailio-basic.cfg route[LOCATION] we have the following:

--snip--
        $var(rc) = $rc;
        t_newtran();
        switch ($var(rc)) {
            case -1:
            case -3:
--snip--

What is the purpose of t_newtran() here? Since we have not hit
t_relay() yet (and
don't have a transaction) is this to ensure the caller sees/acks the 404/405?

Earlier in the mailing list
https://lists.kamailio.org/pipermail/sr-users/2015-April/088062.html
I read, although this is in reply to a different situation:

"Why do you need to create new transactions yourself with t_newtran()?
Nonexotic applications of Kamailio usually don't require this. ..."


# User location service
route[LOCATION] {
    if (!lookup("location")) {
        $var(rc) = $rc;
        t_newtran();
        switch ($var(rc)) {
            case -1:
            case -3:
                send_reply("404", "Not Found");
                exit;
            case -2:
                send_reply("405", "Method Not Allowed");
                exit;
        }
    }

    # when routing via usrloc, log the missed calls also
    if (is_method("INVITE")) {
        setflag(FLT_ACCMISSED);
    }

    route(RELAY);
    exit;
}

Thanks
AAlba



More information about the sr-users mailing list