<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I *think* you will have had to answer the call first before the
    session is ready .. but it should already be available in the Lua
    script.<br>
    <br>
    -J<br>
    <br>
    <div class="moz-cite-prefix">On 7/06/13 9:11 PM, Vincent Xia wrote:<br>
    </div>
    <blockquote
cite="mid:CAKQo6tk_PizJjtFfCHvHyXRJHMt1+nNs7QTm-Us-LUJqX8Z0dg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>hi all,<br>
        </div>
        <div><br>
        </div>
        <div>i have a lua script(record.lua) to record the call:</div>
        <div><br>
        </div>
        <div>record.lua</div>
        <div>--------------------------------------</div>
        <div>callerid = argv[1]</div>
        <div>dest = argv[2]</div>
        <div>recording_dir = argv[3]</div>
        <div>filename = callerid ..dest</div>
        <div>recording_filename = string.format('%s%s', recording_dir,
          filename)</div>
        <div><br>
        </div>
        <div>if session:ready() then &nbsp;-- NOTE: the session here is nil!</div>
        <div>&nbsp; &nbsp; max_len_secs = 30</div>
        <div>&nbsp; &nbsp; silence_threshold = 30</div>
        <div>&nbsp; &nbsp; silence_secs = 5</div>
        <div>&nbsp; &nbsp; test = session:recordFile(recording_filename,
          max_len_secs, silence_threshold, silence_secs);</div>
        <div>end</div>
        <div><br>
        </div>
        <div>but i don't know how to pass "session" from the default
          dialplan to lua in the following sentence:</div>
        <div><br>
        </div>
        <div>&lt;action application="lua" data="record.lua
          ${caller_id_number} ${destination_number}
          $${recordings_dir}"/&gt;</div>
        <div><br>
        </div>
        <div>any response is apprieciated!</div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a class="moz-txt-link-freetext" href="http://www.cudatel.com">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>