I did a simple test with javascript. The same setup working with the following javascript.


session = new Session('sofia/gateway/voipms/14161231234');

session.waitForAnswer(10000);

if (session.ready()) {
        session.sleep(1000);
        session.streamFile('/usr/local/freeswitch/sounds/en/us/callie/custom/callback/enter-dest.wav');
}

---

Thanks
Lloyd




On Thu, Jun 10, 2010 at 1:26 AM, Aloysius Lloyd <lloyd.aloysius@gmail.com> wrote:
Hi All,

I am trying to build a callback application using LUA. I have the following setup.

- Dial the DID number
- Hangup
- Callback lua initiate the call after 10 secods

The above working great.

But when I answer the call ...the wav file never play on the channel.What I am doing wrong?


<extension name="CallBack">
    <condition field="destination_number" expression="^6471231234$">
        <action application="set" data="api_hangup_hook=luarun callback.lua ${caller_id_number}"/>
         <action application="hangup" />
    </condition>
  </extension>

callback.lua

os.execute("sleep " .. tonumber(10));

pin_number_test="0511";
out_gateway1="sofia/gateway/voipms/1";
message_dir="/usr/local/freeswitch/sounds/en/us/callie/custom/callback/";

number_to_call= argv[1];

session = freeswitch.Session("{bypass_media_after_bridge=true,ignore_early_media=true,originate_timeout=40}"..out_gateway1..number_to_call);
session:setAutoHangup(false);

if ( session:ready() ) then
        session:sleep(3000);
        session:streamFile(message_dir.."enter-dest.wav");
end

Thanks
Lloyd