Probably an elementary question, but we're relatively new at digging into the details. We are trying to understand the following block of config code and have a question or two. Our assumption is the t_precheck_trans() function tells us whether another packet has arrived already as a retransmission. However, we're not clear on what the t_check_trans() is doing assuming the condition is true. Any direction on this?
Thanks.
route[CHECK_RETRANS] { # handle retransmissions if(t_precheck_trans()) { t_check_trans(); exit; } }
Joe Baran
Hello Joe,
On Fri, Aug 04, 2017 at 03:45:12PM -0400, Joe Baran wrote:
Probably an elementary question, but we're relatively new at digging into the details. We are trying to understand the following block of config code and have a question or two. Our assumption is the t_precheck_trans() function tells us whether another packet has arrived already as a retransmission. However, we're not clear on what the t_check_trans() is doing assuming the condition is true. Any direction on this?
Thanks.
route[CHECK_RETRANS] { # handle retransmissions if(t_precheck_trans()) { t_check_trans(); exit; } }
t_check_trans() is the traditional method of retransmission dampening, and does different things depending on what type of message is being processed. For most requests, however, it resends the last reply (if the transaction is known) and ends route script execution for that message. If the transaction is not matched, it just returns false and execution carries on. You can read more about the details here:
https://kamailio.org/docs/modules/5.0.x/modules/tm.html#tm.f.t_check_trans
But in order to use t_check_trans(), an actual transaction has to be created, and that is fairly expensive from a performance point of view (in strictly relative terms). The purpose of t_precheck_trans() is to provide a lightweight retransmission detection mechanism which does not require a transaction to actually be created and destroyed in order to detect retransmissions.
You can read more about the rationale here:
http://blog.miconda.eu/2014/10/kamailio-42-tips-10-lightweight.html
Long story short: t_check_trans() only detects retransmissions if an actual transaction was created (via t_newtran() or, most commonly, via t_relay()). t_precheck_trans() is a lighter-weight wrapper around it which does not require that in order to detect and suppress retransmissions.
-- Alex
Hello,
t_precheck_trans() is returning true if a SIP worker process has received the SIP request and it is handling it at that moment. However, in case of a retransmission, that can be at the moment when the transaction was already created for the previous same requests (e.g., via t_newtran() or the execution is in a branch_route block). The specs require that a stateful proxy re-sends the last response in case of a re-transmission. t_check_trans() is used for that purpose, to see if the transaction was already created and to what specs require.
If still not clear, I will try to add more details.
Cheers, Daniel
On 04.08.17 21:45, Joe Baran wrote:
Probably an elementary question, but we're relatively new at digging into the details. We are trying to understand the following block of config code and have a question or two. Our assumption is the t_precheck_trans() function tells us whether another packet has arrived already as a retransmission. However, we're not clear on what the t_check_trans() is doing assuming the condition is true. Any direction on this?
Thanks.
route[CHECK_RETRANS] { # handle retransmissions if(t_precheck_trans()) { t_check_trans(); exit; } }
Joe Baran
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users