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