<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I think that append_branch() is not exported directly to lua and
    calling it via sr.modf() can expose you to memory leaks<br>
    <br>
    Adding a new branch is possible via pseudo-variable, your sequence
    of functions is same as:<br>
    <br>
    $ru = <a class="moz-txt-link-rfc2396E" href="sip:a@example.com">"sip:a@example.com"</a>;<br>
    $branch(uri) = <a class="moz-txt-link-rfc2396E" href="sip:b@example.com">"sip:b@example.com"</a>;<br>
    $branch(uri) = <a class="moz-txt-link-rfc2396E" href="sip:c@example.com">"sip:c@example.com"</a>;<br>
    $branch(uri) = <a class="moz-txt-link-rfc2396E" href="sip:d@example.com">"sip:d@example.com"</a>;<br>
    <br>
    In lua, you can use:<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://www.kamailio.org/wiki/embeddedapi/devel/lua#srpvsets">http://www.kamailio.org/wiki/embeddedapi/devel/lua#srpvsets</a><br>
    <br>
    That should be safer.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <meta charset="utf-8">
    <br>
    <div class="moz-cite-prefix">On 31/12/14 19:24, J Lee wrote:<br>
    </div>
    <blockquote
cite="mid:CALrZDSiN9QbPKP9m9JAqkc99k08hWHUy6VNwoHziVGBJc7FGew@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>I would like to know if there's a way to do parallel
          forking via lua code. <br>
          <br>
        </div>
        So specifically, I'd like to be able to do something like this:
        <br>
        <pre class="">  seturi("<a moz-do-not-send="true" href="mailto:sip%3Aa@example.com">sip:a@example.com</a>");
  append_branch("<a moz-do-not-send="true" href="mailto:sip%3Ab@example.com">sip:b@example.com</a>");
  append_branch("<a moz-do-not-send="true" href="mailto:sip%3Ac@example.com">sip:c@example.com</a>");
  append_branch("<a moz-do-not-send="true" href="mailto:sip%3Ad@example.com">sip:d@example.com</a>");

  t_relay();

</pre>
        <pre class="">except via lua, because the list of branches is dynamic. I've tried the following: 

</pre>
        <pre class="">   sr.modf("append_branch",<a class="moz-txt-link-rfc2396E" href="sip:10.x.x.x">"sip:10.x.x.x"</a>)

</pre>
        <pre class="">but the error message I'm getting is: 
/usr/sbin/kamailio[7437]: ERROR: app_lua [app_lua_sr.c:177]: lua_sr_modf(): function 'append_branch' is not available 

</pre>
        <pre class="">Just wondering if I "should" be able to do this. 
I've been reading <a moz-do-not-send="true" href="http://www.kamailio.org/wiki/embeddedapi/devel/lua#srtm_package">http://www.kamailio.org/wiki/embeddedapi/devel/lua#srtm_package</a> but haven't seen any references to append_branch. 

The other alternative I'm looking at is to just use lua to generate the list of destinations and pass back a hashtable of sorts to
the cfg file. Then from there I will try to loop through the hashtable and do the append_branch command for each entry
in the table. 

</pre>
        <pre class="">If you have other suggestions, I'd appreciate it. 
</pre>
        <pre class="">Thanks. </pre>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.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-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></pre>
  </body>
</html>