[Serusers] More detailed explanation of t_newtran needed.

Andrei Pelinescu-Onciul pelinescu-onciul at fokus.fraunhofer.de
Thu Jun 26 16:56:44 CEST 2003

On Jun 18, 2003 at 15:55, Younger Wang <wygmail at yeah.net> wrote:
> I am trying to understand how tm module works.
> I found in http://www.iptel.org/ser/doc/prerelease/x545.html--->Stateful
> User Agent Server:
> ______________________________________________
> t_newtran shields subsequent code from retransmissions. It returns success
> and continues when a new request arrived. It exits current route block
> immediately on receipt of a retransmissions.
> -----------------------------------------------
> I found in the README included in tm module:
> _______________________________________________
> Name: t_newtran
> Params: 0
> Desc: creates a new transaction, returns a negative value on
>      error; this is the only way a script can add a new transaction
>      in an atomic way; typically, it is used to deploy a UAS
> -----------------------------------------------
> I think the two explanations above are inconsistent. I am quite confused.
> Take the scripts below for example:
> _______________________________
> if ( !t_newtran()) {
>   sl_reply_error();
>   break;
>  };

There are 3 possible outcomes of t_newtran:
- this is a new transaction => returns true
- this is a retransmission => in script it forces a break 
  (it does not return, it just stops script processing)
- some error occured (e.g. bad via ) => returns false

The actual module function (the C one, not the script one) will return 1
in the first case, 0 in the second (a module function returning 0 forces
a break/drop) and a value <0 in the third case (which is equivalent to
false in the script).


More information about the sr-users mailing list