[SR-Users] t_lookup_request()

Alex Balashov abalashov at evaristesys.com
Tue May 12 23:53:46 CEST 2015


Hello,

 From the documentation for t_lookup_request()[1], it is not clear 
whether it creates a new transaction if one does not exist:

    "Checks if a transaction exists. Returns a positive value
     if so, negative otherwise. Most likely you will not want to
     use it, as a typical application of a look-up is to introduce
     a new transaction if none was found. However this is safely
    (atomically) done using t_newtran."

This language is quite unclear in the following respects:

1) Why would I not want to use it?

2) Does the "typical application" mean that t_lookup_request() _will_ 
create a new transaction if one does not exist?

3) Do I have some means of choosing whether to invoke t_lookup_request() 
in a "typical" or "atypical" application?

4) This statement "this is safely (atomically) done using t_newtran" 
implies that creating a new transaction using t_lookup_request() (which 
also implies that yes, it does create a new transaction) is "unsafe" and 
"non-atomic". Why is this?

5) Does this mean that the effect here would be to create two transactions?

    if(!t_lookup_request())
       t_newtran();

-- Alex

[1] 
http://kamailio.org/docs/modules/4.2.x/modules/tm.html#tm.f.t_lookup_request

-- 
Alex Balashov | Principal | Evariste Systems LLC
303 Perimeter Center North, Suite 300
Atlanta, GA 30346
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list