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
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/