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

Sebastian Damm damm at sipgate.de
Sat Sep 9 22:28:28 CEST 2017


Hi,

my guess would be that's only for accounting. If I remember correctly,
the acc module won't record this call if a transaction was never
created. So the transaction gets created before sending out the reply.

I could be wrong, though. :)

Best Regards,
Sebastian

On Sat, Sep 9, 2017 at 5:28 PM, Anthony Alba <ascanio.alba7 at gmail.com> wrote:
> 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
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list