Hello,

On 18.10.21 06:08, Emilio Panighetti wrote:
Hello,

Based on kamailio-basic-kemi.cfg and kamailio-basic-kemi-lua.lua,
I’m trying to get a simple test to go through using SIPp built-in UAC and UAS scenarios, using LUA config:

Commented out all the registration blocks and trying to run a simple proxy for now, but I can’t seem able to change the URI.

SIPp UAC: 192.168.1.12:5060
SIPp UAS: 192.168.1.12:5062
Kamailio 5.5.2: 192.168.15.:5060

Part of the Kamailio.lua config:

-- wrapper around tm relay function
function ksr_route_relay()
-- enable additional event routes for forwarded requests
-- - serial forking, RTP relaying handling, a.s.o.
if KSR.is_method_in("IBSU") then
if KSR.tm.t_is_set("branch_route")<0 then
KSR.dbg("EP: ksr_route_relay Set for branch_route\n");
KSR.tm.t_on_branch("ksr_branch_manage");
end
end
if KSR.is_method_in("ISU") then
if KSR.tm.t_is_set("onreply_route")<0 then
KSR.dbg("EP: ksr_route_relay Set for onreply_route\n");
KSR.tm.t_on_reply("ksr_onreply_manage");
end
end
if KSR.is_INVITE() then
if KSR.tm.t_is_set("failure_route")<0 then
KSR.dbg("EP: ksr_route_relay Set for failure\n");
KSR.tm.t_on_failure("ksr_failure_manage");
end
end
if KSR.tm.t_relay()<0 then
KSR.dbg("EP: ksr_route_relay Set for reply_error\n");
KSR.sl.sl_reply_error();
end
-- EP: Base route
KSR.dbg("EP: ksr_route_relay Check for Base Route\n");
if KSR.is_INVITE() then
KSR.dbg("EP: ksr_route_relay Base Route (DU)\n");
--KSR.sl.send_reply("503", "Debug");
KSR.setdsturi("sip:192.168.1.12:5062");
KSR.pv.sets("$du", "sip:192.168.1.12:5062");
end
KSR.dbg("EP: ksr_route_relay exit\n");
KSR.x.exit();
end

What’s happening here is that instead of forwarding the INVITE to the SIPp UAC, it creates a loop. Tried KSR.setdsturi() only (KSR.pv.sets commented out) and it’s still the same.
If I comment out the 503 reply, then that’s what the UAC gets back.

You have to set dst uri before KSR.tm.relay(), because that's the function that sends to the next hop. If you set it after it, then it is not used.

Cheers,
Daniel


[...]
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
Nov 08-11, 2021 (Europe Timezone) - Nov 22-25, 2021 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/