2010/6/18 Henning Westerholt henning.westerholt@1und1.de:
Does t_relay() manage both the client and server transactions for the packet being forwarded ? Meaning it would absorb retransmissions it receives and would retransmit the relayed message when needed ?
this is my understanding of the function.
This is true because t_relay() creates a server transaction in case it doesn't exist yet.
Where would I use t_checktrans(), t_release() and t_newtran() ? My understanding is that if I want to receive a packet and process it locally without forwarding it, I should use t_newtran(). This would be good for things such as PUBLISH, PRESENCE and REGISTER ( even though it's not a good idea ).
The t_newtran() just creates a new transaction. If you then process the msg locally without forwarding you should release it. I think one reason for providing this as dedicated function (after all t_relay does it as well) is that you could use it before some time consuming operations, in order to be able to absorb retransmissions. Another reason is that you can then take care of the error condition that the server can't create new transactions any more, and send a stateless error reply. (Even this probably happens today rarely, with the increases in available memory.)
But take into account that after calling t_newtran() new data being created in the script is not stored within the transaction information (flags, AVP's...). It produces really unexpected behavior if you don't take it into account.
Does t_checktrans() absorb retransmissions that were started with t_relay and t_newtran?
Read carefully the documentation for t_checktrans() function as it behaves different depending on the message type (CANCEL, ACK, other request, response...).
Best regards.