Also used in lua with no problems. Using the app_lua module, the provided configs and sending a test message multiple times produces the output you have described with no crash on kamalio 5.6.3 and 5.8.1.

kamailio.cfg
...
dns_cache_init=off
use_dns_cache=off # I tried all the config you stated with no crashes
loadmodule "enum"
loadmodule "kemix"
loadmodule "app_lua"

modparam("app_lua", "load", "/etc/kamailio/kamailio.lua")

cfgengine "lua"
kamailio.lua
function ksr_route_sipout()
    KSR.info("===== sipout - from kamailio lua script\n");
    local y = KSR.enum.enum_query()
    KSR.err('ENUM RESULT ' .. tostring(y) .. ' :RURI ' .. KSR.kx.get_ruri() .. '\n')

    if KSR.is_myself_ruri() then return 1; end

    KSR.hdr.append("P-Hint: outbound\r\n");
end

    -- Kamailio - equivalent of routing blocks in Lua
-- KSR - the new dynamic object exporting Kamailio functions
-- sr - the old static object exporting Kamailio functions
--
-- SIP request routing
-- equivalent of request_route{}
function ksr_request_route()
    KSR.info("===== request - from kamailio lua script\n");

    ksr_route_sipout();

    if KSR.maxfwd.process_maxfwd(10) < 0 then
        KSR.sl.send_reply(483, "Too Many Hops");
        return;
    end

    -- KSR.sl.sreply(200, "OK Lua");

    KSR.pv.sets("$du", "sip:127.0.0.1:5080")
    KSR.tm.t_on_branch("ksr_branch_route_one");
    KSR.tm.t_on_reply("ksr_onreply_route_one");
    KSR.tm.t_on_failure("ksr_failure_route_one");

    if KSR.tm.t_relay() < 0 then
        KSR.sl.send_reply(500, "Server error")
    end
end

-- SIP response routing
-- equivalent of reply_route{}
function ksr_reply_route()
    KSR.info("===== response - from kamailio lua script\n");
end

-- branch route callback
-- equivalent of a branch_route{}
function ksr_branch_route_one()
    KSR.info("===== branch route - from kamailio lua script\n");
end

-- onreply route callback
-- equivalent of an onreply_route{}
function ksr_onreply_route_one()
    KSR.info("===== onreply route - from kamailio lua script\n");
end

-- failure route callback
-- equivalent of a failure_route{}
function ksr_failure_route_one()
    KSR.info("===== failure route - from kamailio lua script\n");
end
test_message.sh
CSeq=$((RANDOM%10000+1))
REGISTER_MSG="INVITE sip:+437200101011@sip.example.org SIP/2.0
Via: SIP/2.0/UDP 192.168.0.199:40867;rport;branch=z9hG4bKU2Fc14H2NX4Kc
Max-Forwards: 70
From: <sip:myself@sip.example.org>;tag=vmjX7H12KrH1B
To: <sip:+437200101011@sip.example.org>
Call-ID: 8956e785-1905-123c-24bb-e4aaeae9dd8b
CSeq: $CSeq INVITE
Contact: <sip:myself@sip.example.org>
User-Agent: calls sofia-sip/1.13.12
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE
Supported: timer, 100rel, replaces, gruu, outbound
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 240

v=0
o=- 9163509233734166984 5909793187606445082 IN IP4 192.168.0.199
s=-
c=IN IP4 22.222.222.222
t=0 0
m=audio 43264 RTP/AVP 9 8 0 3
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtcp:33730\r\n
"

printf "$REGISTER_MSG" | timeout 0.3 nc -u -4 $SIP_SERVER $SIP_PORT

These are the logs produced when I call the test_message.sh multiple times, with no crash provided the setting you suggested.

May 20 11:00:34 app01 kamailio[708931]: INFO: {1 3165 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== request - from kamailio lua script
May 20 11:00:34 app01 kamailio[708931]: INFO: {1 3165 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== sipout - from kamailio lua script
May 20 11:00:34 app01 kamailio[708931]: ERROR: {1 3165 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:96]: sr_kemi_core_err(): ENUM RESULT 1 :RURI sip:enum-test@sip.nemox.net
May 20 11:00:34 app01 kamailio[708931]: INFO: {1 3165 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== branch route - from kamailio lua script
May 20 11:00:35 app01 kamailio[708928]: INFO: {1 1378 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== request - from kamailio lua script
May 20 11:00:35 app01 kamailio[708928]: INFO: {1 1378 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== sipout - from kamailio lua script
May 20 11:00:35 app01 kamailio[708928]: ERROR: {1 1378 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:96]: sr_kemi_core_err(): ENUM RESULT 1 :RURI sip:enum-test@sip.nemox.net
May 20 11:00:35 app01 kamailio[708928]: INFO: {1 1378 INVITE 8956e785-1905-123c-24bb-e4aaeae9dd8b} <core> [core/kemi.c:106]: sr_kemi_core_info(): ===== branch route - from kamailio lua script


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3350/2120225954@github.com>