<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>as announced earlier this morning, most of the routing blocks can
      be written directly in an embedded language (right now supported
      being Lua and Python). The missing blocks are (most of) the event
      routes.</p>
    <p>The event route from tm for branch failure route is already
      supported, as the name has to be set via t_on_branch_failure(...).</p>
    <p>In the native configuration, event routes are executed if they
      are defined. Their names (as in event_route[name]) are not valid
      function names for the other programming languages to be used
      directly corresponding callback function name.</p>
    <p>I was thinking of the alternative, next are the ones I came up
      with, more suggestions are welcome.</p>
    <p>1) add parameters for event route callback names, like:</p>
    <p>modparam("htable", "evrtcb_mod_init", "ksr_htable_mod_init")</p>
    <p>would define the name of the function for the alternative to
      event_route[htable:mod-init].</p>
    <p>This has a benefit in speed, if the parameter is not defined,
      then there is no overhead in trying to execute a callback function
      in an embedded language.</p>
    <p>The drawback is that there is need to code a bit of C to add
      those parameters to the components executing event routes.<br>
    </p>
    <p>2) do a direct mapping using some translation rules, like:</p>
    <p>- prefix with ksr_<br>
      - replace ':' and '-' with underscore '_'</p>
    <p>So event_route[htable:mod-init] will have automatically the
      correspondent function ksr_htable_mod_init().</p>
    <p>The drawback is that each time the even route should be called, a
      lookup on embedded language symbols table needs to be done to see
      if it exists, then execute it.</p>
    <p>There is still some C code to do, but less than adding parameters
      like for 1).</p>
    <p>3) like 2), but instead of an automatic translation, keep a
      mapping table:</p>
    <p>struct mapping {<br>
        str kname;<br>
        str ename;<br>
      } table[] = {<br>
        str_init("htable:mod-init"),<br>
        str_init("ksr_htable_mod_init"),</p>
    <p>}</p>
    <p>Adding a new event route will require adding a new record in the
      mapping table. The benefit is that the function name in embedded
      language can be selected to be whatever, with or without ties to
      the event_route name.</p>
    <p>Opinions?</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>