[Freeswitch-users] Same peace of code works with Javascript and not LUA

Boris Kovalenko boris at tagnet.ru
Thu Jul 14 21:10:34 MSD 2011


Hello!

     I'm trying to migrate DISA from Javascript to LUA. This peace of 
code works fine in Javascript:

ostr = "{ignore_early_media=true" +
            ",origination_caller_id_number=" + 
session.getVariable("caller_id_number") +
                     "}sofia/ipbx/50004#" + digits + "@192.168.1.1:5060";
osession = new Session( ostr );
bridge(session, osession);
osession.hangup();

With LUA not:
         originate_string =
             "{ignore_early_media=true" ..
             ",origination_caller_id_number=" .. 
session:getVariable("caller_id_number") ..
             "}" ..
             "sofia/ipbx/50004#" ..
             digits .. "@192.168.1.1:5060";
         originate_session = freeswitch.Session( originate_string );
             freeswitch.bridge(session, originate_session);
             originate_session:hangup();

The call is droped when remote answers. There is an error in log: 
bridge: session not ready. I tried to use
     if( originate_session:ready() ) then
             freeswitch.bridge(session, originate_session);
             originate_session:hangup();
    end

with no luck :(. Please, help me. What am I doing wrong?

-- 
Regards,
Boris





More information about the FreeSWITCH-users mailing list