Why are you using Lua at all? It looks like a simple originate that you should be able to do as an API call.

-MC

On Wed, Dec 14, 2011 at 12:24 PM, Alex Crow <acrow@integrafin.co.uk> wrote:
Hi all,

I have a Lua script that I am calling from XML RPC from a browser (also
same behaviour from the console). The script originates a session to one
extension, when that is picked up it originates another session to
another endpoint and then bridges the two sessions.

The issue is that if the first freeswitch.Session(<endpoint>) has the
endpoint local to the FS box, there is no audio at all after the bridge
is executed. If the first session is a remote endpoint, it works OK
apart from the fact that that endpoint does not hear ringing, but when
the second session is answered all is well. If both endpoints are
remote, everything is perfect.

Here is my Lua script - the no-audio version:

local calling_user = argv[1];
local called_num = argv[2];

local session1 = freeswitch.Session("user/"..calling_user);

session1:sleep(500);

session1:answer();

if (session1:ready() == true) then
        local session2 =
freeswitch.Session("[origination_caller_id_number=02023493482]sofia/gateway/10.10.0.2/"
.. called_num);
        session2:answer();

        if (session2:ready() == true) then
                freeswitch.consoleLog("INFO","Bridging\n");
                freeswitch.bridge(session1, session2);
        end

end

This one works fine:

local calling_user = argv[1];
local called_num = argv[2];


local session1 =
freeswitch.Session("[origination_caller_id_name="..called_num.."]sofia/gateway/10.10.0.2/"
.. calling_user);

session1:answer();

if (session1:ready() == true) then
        local session2 =
freeswitch.Session("[origination_caller_id_number=02076084900]sofia/gateway/10.10.0.2/"
.. called_num);
        --either the above or the below both work in this script,
except the below does not present ringing to session1
        --local session2 =
freeswitch.Session("[ringback=%(400,200,400,450);%(400,2200,400,450)]user/"
.. called_num);
        session2:answer();

        if (session2:ready() == true) then
                freeswitch.consoleLog("INFO","Bridging\n");
                freeswitch.bridge(session1, session2);
        end

end

Where gateway 10.10.0.2 is a Mitel 3300 connected to the PSTN via ISDN30.

I can provide logs if required - please advise as this is driving me
bonkers!

Alex

--
This message is intended only for the addressee and may contain
confidential information.  Unless you are that person, you may not
disclose its contents or use it in any way and are requested to delete
the message along with any attachments and notify us immediately.

"Transact" is operated by Integrated Financial Arrangements plc
Domain House, 5-7 Singer Street, London  EC2A 4BQ
Tel: (020) 7608 4900 Fax: (020) 7608 5300
(Registered office: as above; Registered in England and Wales under number: 3727592)
Authorised and regulated by the Financial Services Authority (entered on the FSA Register; number: 190856)


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org