[Freeswitch-users] Lua - origination to local endpoint then bridge to either local or remote destination: no audio

Alex Crow acrow at integrafin.co.uk
Wed Dec 14 23:24:24 MSK 2011


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)




Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list