[SR-Users] kemi with lua and dispatcher - attempt to index field 'dispatcher' (a nil value)

Karsten Horsmann khorsmann at gmail.com
Wed Nov 22 12:42:57 CET 2017


Hello List,

i dunno why this happen :) after i write an email to the list - but now i
found it.

the app_lua/kemi function name is sr.dispatcher.select for ds_select_dst
The source-code documentation guides me to this point after greping around
in app_lua.


    # dst_select( "GROUP", "HASH METHOD")
    if(!ds_select_dst($avp(routing_target), "4")) {
        send_reply("404", "No destination");
        exit;
    }

In lua part it looks like this (the nil part maybe broken per default, lua
dont like vars with nil)

--- dispatcher route
function ksr_route_dispatch(direction, routing_target)

    KSR.xlog.xinfo("new $fU -> $rU in routing_target ksr_route_dispatch");
    KSR.info(routing_target);
    if (routing_target == nil) then
        KSR.xlog.xinfo("routing_target nil");
        KSR.sl.sl_send_reply(604, "Does Not Exist Anywhere");
        KSR.x.exit();
    end

    -- return code dispatcher.select NOT true - then 404
    if (sr.dispatcher.select(routing_target, 4) ~= 1) then
        KSR.sl.sl_send_reply(404, "No destination");
        KSR.x.exit();
    end
    ksr_route_myheader(pathinfo);
    ksr_route_relay();
    KSR.x.exit();
end



-- 
Kind Regards
*Karsten Horsmann*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20171122/3f9bf46b/attachment.html>


More information about the sr-users mailing list