<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>version 5.0 doesn't have a lot of the functions from kamailio
      modules exported to kemi (KSR module). Not even v5.1 will have all
      of them, but I expect to be over 80% in v5.1.</p>
    <p>There is a generic kemi function that can be used to execute any
      (most of) functions from modules KSR.x.modf(...):</p>
    <p>  -
<a class="moz-txt-link-freetext" href="http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/kemimods/#ksrxmodf">http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/kemimods/#ksrxmodf</a><br>
    </p>
    If the kamctl rpc app_lua.api_list doesn't how a function you are
    looking for, then it is not yet available via kemi (in KSR module).<br>
    <br>
    Doing the old way with "register" modparam can be a solution only
    for app_lua, if the respective module was added in the past to
    app_lua Lua exports.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 22.11.17 11:24, Karsten Horsmann
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFArqsYGZHjL3k4PjZfSjhmriJiiDTicj-SE=RpLyKoKOr0=Lw@mail.gmail.com">
      <div dir="ltr">
        <div>Hello Daniel,</div>
        <div>hello List,</div>
        <div><br>
        </div>
        <div>after reading the fresh released kemi documentation (Thanks
          for that!) on github i start to configure an kemi lua
          configuration. It seems to be that there is not an dispatcher
          export to kemi in my installation. Or i missconfigured
          something? How to use dispatcher with kemi?</div>
        <div><br>
        </div>
        <div>1.) First try to solve this - use param "register"
          "modulename" to app_lua - doesnt work</div>
        <div>2.) grep around in the auto kemi in/export messages in
          debug startup - nothing to see.</div>
        <div>3.) grep around in the kamcmd api.list command for lua - no
          dispatcher</div>
        <div><br>
        </div>
        <div>here the intressting parts of the configs and lua-script:</div>
        <div><br>
        </div>
        <div>kamailio.cfg</div>
        <div>...</div>
        <div>loadmodule "dispatcher.so"</div>
        <div>loadmodule "permissions.so"</div>
        <div>loadmodule "avpops.so"</div>
        <div>#!ifdef WITH_CFGLUA</div>
        <div>loadmodule "app_lua.so"</div>
        <div>modparam("app_lua", "reload", 1)</div>
        <div>modparam("app_lua", "register", "dispatcher")</div>
        <div>#!endif</div>
        <div><br>
        </div>
        <div>#!ifdef WITH_CFGLUA</div>
        <div>modparam("app_lua", "load",
          "/etc/kamailio/lua/kamailio-kemi-lua.lua")</div>
        <div>cfgengine "lua"</div>
        <div>#!else</div>
        <div>import_file "request-route.cfg"</div>
        <div>#!endif</div>
        <div>...</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>kamailio-kemi-lua.lua</div>
        <div>function ksr_request_route()</div>
        <div>...</div>
        <div>    -- dispatch destinations</div>
        <div>    if KSR.permissions.allow_source_address(FLT_EDGE) then</div>
        <div>        KSR.info("new $fU -> $rU in permissions");</div>
        <div>        direction = "inbound";</div>
        <div>        routing_target = FLT_FSNODE;</div>
        <div>        ksr_route_dispatch(direction, routing_target);</div>
        <div>        KSR.x.exit();</div>
        <div>    end</div>
        <div><br>
        </div>
        <div>    KSR.info("NOT-OKAY - $rU dropped");</div>
        <div>    -- End of Route()</div>
        <div>    KSR.sl.sl_send_reply(407, "Proxy Authentication
          Required. See IP GUI");</div>
        <div>    return 1;</div>
        <div>...</div>
        <div>end</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>--- dispatcher route</div>
        <div>function ksr_route_dispatch(direction, routing_target)</div>
        <div><br>
        </div>
        <div>    KSR.xlog.xinfo("new $fU -> $rU in routing_target
          ksr_route_dispatch");</div>
        <div>    KSR.info(routing_target);</div>
        <div>    if (routing_target == nil) then</div>
        <div>        KSR.xlog.xinfo("routing_target nil");</div>
        <div>        KSR.sl.sl_send_reply(604, "Does Not Exist
          Anywhere");</div>
        <div>        KSR.x.exit();</div>
        <div>    end</div>
        <div><br>
        </div>
        <div>    if KSR.dispatcher.ds_select_dst(routing_target, 4) then</div>
        <div>        send_reply(404, "No destination");</div>
        <div>        KSR.x.exit();</div>
        <div>    end</div>
        <div>    ksr_route_myheader();</div>
        <div>    ksr_route_relay();</div>
        <div>    KSR.x.exit();</div>
        <div>end</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>/usr/sbin/kamailio[26763]: ERROR: app_lua
          [app_lua_api.c:713]: app_lua_run_ex(): error from Lua:
          /etc/kamailio/lua/kamailio-kemi-lua.lua:131: attempt to index
          field 'dispatcher' (a nil value)</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>kamailio -v</div>
        <div>version: kamailio 5.0.4 (x86_64/linux)</div>
        <div>flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS,
          DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP,
          PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY,
          USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
          USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST,
          HAVE_RESOLV_RES</div>
        <div>ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
          MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT
          PKG_SIZE 8MB</div>
        <div>poll method support: poll, epoll_lt, epoll_et, sigio_rt,
          select.</div>
        <div>id: unknown</div>
        <div>compiled on 20:20:24 Nov 16 2017 with gcc 4.8.5</div>
        <div><br>
        </div>
        <div>rpm -aq | grep kam</div>
        <div>kamailio-mysql-5.0.4-26.el7.centos.x86_64</div>
        <div>kamailio-5.0.4-26.el7.centos.x86_64</div>
        <div>kamailio-lua-5.0.4-26.el7.centos.x86_64</div>
        <div>kamailio-ims-5.0.4-26.el7.centos.x86_64</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>rpm -ql kamailio-5.0.4 | grep disp</div>
        <div>/usr/lib64/kamailio/modules/dispatcher.so</div>
        <div>/usr/share/doc/kamailio/modules/README.dispatcher</div>
        <div>/usr/share/kamailio/dbtext/kamailio/dispatcher</div>
        <div><br>
        </div>
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">Kind Regards<br>
          *Karsten Horsmann*<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>