Hello Alex,

thanks for the clarification.

How can I create a transaction in a non-atomic way?

Is t_newtrans() idempotent?

The documentation of tmx.t_flush_flags() says

“Flush the flags from current SIP message into the already created transaction. 
It makes sense only in routing block if the transaction was created
via t_newtran() and the flags have been altered since.

It is not needed to execute this function when using t_relay() (or similar tm 
relay functions, flags are synchronized automatically in that case).”

This wording is ambiguous:

If a transaction is created with t_newtran(), then a flag is modified, and 
finally t_relay() is called, is t_flush_flags() necessary?

Moreover, t_flush_flags() works only in an already created transaction.  If it 
is called before a transaction is created (with t_newtrans() or
t_relay()) it does nothing, according to the documentation.

Why is t_flush_flags() necessary if a transaction is created with t_newtran(), 
but not necessary if the transaction is created with t_relay()?

Greetings
  Dilyan

-----Original Message-----
From: Alex Balashov <[email protected]>
Reply-To: Kamailio (SER) - Users Mailing List <[email protected]>
To: Kamailio (SER) - Users Mailing List <[email protected]>
Subject: [SR-Users] Re: Does tm.t_relay() create a transaction?
Date: 01/20/2023 04:13:32 PM

Hi Дилян,

This is a rather confusing topic in Kamailio.

Yes, t_relay() creates a transaction, provided that the t_relay() call is not 
unsuccessful "a priori" (e.g. due to invalid transport, DNS failure,
lack of suitable sending listener, etc).

To create a transaction atomically generally means that the transaction is both 
created and utilised as a single operation.

-- Alex

> On Jan 20, 2023, at 8:41 AM, Дилян Палаузов <[email protected]> wrote:
> 
> Hello,
> 
> the documentation for tm.t_newtran() says „This is the only way a script can 
> add a new transaction in an atomic way.“  Moreover tm.t_send_reply()
> “creates the transaction if it does not exist (executing internally 
> t_newtran()) and sends a stateful reply (executing internally t_reply())”.  
> This
> means that only t_newtrans() and t_send_reply() can create transactions in an 
> atomic way.
> 
> The documentation of tm.t_relay() does not say whether the function creates a 
> transaction.  It also does not say what happens if t_reply() is not
> called after t_newtrans().
> 
> But for tm.t_set_retr() and tm.t_set_retr() is written “If the transaction is 
> already created (e.g called after t_relay() or in an onreply_route) …”
> This suggests that tm.t_relay() does create atomically or not-atomically a 
> transaction.
> 
> - What does it mean to create a transaction in a non-atomic way?
> - Does tm.t_relay() create a transaction?
> 
> Greetings
>  Dilyan
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:

-- 
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to