<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 13/01/2017 15:30, Mititelu Stefan
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAL82Oa0b2_i63GPe_arEqHMqrhftSKeoJJ_b8qK71PrXU_TiWQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>I've been reading about new kemi interface that will be
          available in 5.0. Writing configs in lua/python is awesome!!!</div>
      </div>
    </blockquote>
    <br>
    and javascript via app_jsdt to make it more awesome for the internet
    world :-) <br>
    <br>
    <blockquote
cite="mid:CAL82Oa0b2_i63GPe_arEqHMqrhftSKeoJJ_b8qK71PrXU_TiWQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div>I am currently looking into and trying to add kemi support
          for a module and have some questions:</div>
        <div><br>
        </div>
        <div>1. What would be the best practice for porting module
          functions that read/write data from/to a pseudo-variable?
          ...At the moment I'm thinking of using str for input and
          return; probably this will lead to partially duplicating the
          code of the existing module functions.</div>
      </div>
    </blockquote>
    <br>
    The idea is to no longer pass names of variables to the functions in
    the embedded language, but the string value for it. For example:<br>
    <br>
    - in kamailio.cfg you have:<br>
    <br>
    xdbg( "r-uri is: $ru\" );<br>
    <br>
    - in kamailio.lua you have:<br>
    <br>
    KSR.dbg( "r-uri is: " .. KSR.pv.get("$rU") );<br>
    <br>
    For shorting, one can just keep values locally if using same 'pv'
    many times, like:<br>
    <br>
    rU = KSR.pv.get("$rU");<br>
    <br>
    KSR.dbg( "r-uri is: " .. rU );<br>
    <br>
    if rU == "alice" then ...<br>
    <br>
    The functions that get a variable name to set can have to receive it
    as string, then use pv_cache_get(name) to resolve to the PV
    strctures. These functions will need a wrapper that will call the
    function in C expecting already the PV structure.<br>
    <br>
    Now there is a wrapping system that together with the fixups convert
    from the parameters given as string values in kamailio.cfg to the PV
    structure.<br>
    <br>
    <blockquote
cite="mid:CAL82Oa0b2_i63GPe_arEqHMqrhftSKeoJJ_b8qK71PrXU_TiWQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div>2. Will kemi support some other types besides int/str/none?
          <span
            style="color:rgb(51,51,51);font-size:14px;line-height:19.6px">(</span><span
style="color:rgb(51,51,51);font-size:14px;line-height:19.6px">i.e. </span><span
style="color:rgb(51,51,51);font-size:14px;line-height:19.6px">SR_KEMIP_<b>PV</b>)</span></div>
        <div><span
            style="color:rgb(51,51,51);font-size:14px;line-height:19.6px"><br>
          </span></div>
      </div>
    </blockquote>
    Of course the goal is to extend kemi and make it easier to use for
    common cases. If you have some proposal to make, just open a
    discussion about it.<br>
    <br>
    The goal is to be able to have very small wrappers for native config
    language and kemi (and in many cases no wrappers) that will call a
    common C functions.<br>
    <br>
    The common C function should accept only int, str* and pv_spec_t*
    (for functions that need to write in a pv) parameters.<br>
    <br>
    The current fixup system for native config converts at some point
    to  int/str using fixup_get_ivalue() and fixup_get_svalue().<br>
    <br>
    If something is not clear regarding kemi, just ask more, I am happy
    to try to clarify better.<br>
    <br>
    Cheers,<br>
    Daniel<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 World Conference - May 8-10, 2017 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>