Hello,

On 05.09.24 13:10, nizam--- via sr-users wrote:
Dear experts,

Would appreciate if anyone can explain why in the given sample Lua script the 'Handle Retransmission' block checks the return code of t_check_trans (if KSR.tm.t_check_trans == 0 then), but in the Kamailio native config standard file if just calls the t_check_trans() function without checking the return code. What is the intention here and how does it work? Thank you in advance.

Handle retransmission script from native config file:
        if (!is_method("ACK")) {
                if(t_precheck_trans()) {
                        t_check_trans();
                        exit;
                }
                t_check_trans();
        }

Handle retransmission from sample Lua script:
        if not KSR.is_ACK() then
                if KSR.tmx.t_precheck_trans() > 0 then
                        KSR.tm.t_check_trans();
                        return 1;
                end
 
                if KSR.tm.t_check_trans() == 0 then
                        return 1;
                end
        end

See for more details:

  - https://www.kamailio.org/wikidocs/tutorials/faq/main/#how-is-the-function-return-code-evaluated

Cheers, Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio Advanced Training, October 8-10, 2024 -- asipto.com