Why are you using Lua at all? It looks like a simple originate that you should be able to do as an API call.<div><br></div><div>-MC<br><br><div class="gmail_quote">On Wed, Dec 14, 2011 at 12:24 PM, Alex Crow <span dir="ltr">&lt;<a href="mailto:acrow@integrafin.co.uk">acrow@integrafin.co.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have a Lua script that I am calling from XML RPC from a browser (also<br>
same behaviour from the console). The script originates a session to one<br>
extension, when that is picked up it originates another session to<br>
another endpoint and then bridges the two sessions.<br>
<br>
The issue is that if the first freeswitch.Session(&lt;endpoint&gt;) has the<br>
endpoint local to the FS box, there is no audio at all after the bridge<br>
is executed. If the first session is a remote endpoint, it works OK<br>
apart from the fact that that endpoint does not hear ringing, but when<br>
the second session is answered all is well. If both endpoints are<br>
remote, everything is perfect.<br>
<br>
Here is my Lua script - the no-audio version:<br>
<br>
local calling_user = argv[1];<br>
local called_num = argv[2];<br>
<br>
local session1 = freeswitch.Session(&quot;user/&quot;..calling_user);<br>
<br>
session1:sleep(500);<br>
<br>
session1:answer();<br>
<br>
if (session1:ready() == true) then<br>
         local session2 =<br>
freeswitch.Session(&quot;[origination_caller_id_number=02023493482]sofia/gateway/<a href="http://10.10.0.2/" target="_blank">10.10.0.2/</a>&quot;<br>
.. called_num);<br>
         session2:answer();<br>
<br>
         if (session2:ready() == true) then<br>
                 freeswitch.consoleLog(&quot;INFO&quot;,&quot;Bridging\n&quot;);<br>
                 freeswitch.bridge(session1, session2);<br>
         end<br>
<br>
end<br>
<br>
This one works fine:<br>
<br>
local calling_user = argv[1];<br>
local called_num = argv[2];<br>
<br>
<br>
local session1 =<br>
freeswitch.Session(&quot;[origination_caller_id_name=&quot;..called_num..&quot;]sofia/gateway/<a href="http://10.10.0.2/" target="_blank">10.10.0.2/</a>&quot;<br>
.. calling_user);<br>
<br>
session1:answer();<br>
<br>
if (session1:ready() == true) then<br>
         local session2 =<br>
freeswitch.Session(&quot;[origination_caller_id_number=02076084900]sofia/gateway/<a href="http://10.10.0.2/" target="_blank">10.10.0.2/</a>&quot;<br>
.. called_num);<br>
         --either the above or the below both work in this script,<br>
except the below does not present ringing to session1<br>
         --local session2 =<br>
freeswitch.Session(&quot;[ringback=%(400,200,400,450);%(400,2200,400,450)]user/&quot;<br>
.. called_num);<br>
         session2:answer();<br>
<br>
         if (session2:ready() == true) then<br>
                 freeswitch.consoleLog(&quot;INFO&quot;,&quot;Bridging\n&quot;);<br>
                 freeswitch.bridge(session1, session2);<br>
         end<br>
<br>
end<br>
<br>
Where gateway 10.10.0.2 is a Mitel 3300 connected to the PSTN via ISDN30.<br>
<br>
I can provide logs if required - please advise as this is driving me<br>
bonkers!<br>
<br>
Alex<br>
<br>
--<br>
This message is intended only for the addressee and may contain<br>
confidential information.  Unless you are that person, you may not<br>
disclose its contents or use it in any way and are requested to delete<br>
the message along with any attachments and notify us immediately.<br>
<br>
&quot;Transact&quot; is operated by Integrated Financial Arrangements plc<br>
Domain House, 5-7 Singer Street, London  EC2A 4BQ<br>
Tel: (020) 7608 4900 Fax: (020) 7608 5300<br>
(Registered office: as above; Registered in England and Wales under number: 3727592)<br>
Authorised and regulated by the Financial Services Authority (entered on the FSA Register; number: 190856)<br>
<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br></div>