Well, I got this script working with non-Snom phones:<div><br></div><div><div><font face="'courier new', monospace" size="1">-- test_call</font></div><div><font face="'courier new', monospace" size="1">-- create first leg, wait, then connect 2nd leg</font></div>
<div><font face="'courier new', monospace" size="1">--</font></div><div><font face="'courier new', monospace" size="1">local calling_user = argv[1];</font></div><div><font face="'courier new', monospace" size="1">local called_num = argv[2];</font></div>
<div><font face="'courier new', monospace" size="1"><br></font></div><div><font face="'courier new', monospace" size="1">freeswitch.consoleLog("INFO","Attempting to contact user " .. calling_user .. "\n");</font></div>
<div><font face="'courier new', monospace" size="1">local session1 = freeswitch.Session("{origination_caller_id_number=9876}user/"..calling_user);</font></div><div><font face="'courier new', monospace" size="1">leg1_dispo = 'None';</font></div>
<div><font face="'courier new', monospace" size="1"><br></font></div><div><font face="'courier new', monospace" size="1">while (session1:ready() == true and leg1_dispo ~= 'ANSWER') do</font></div><div>
<font face="'courier new', monospace" size="1"> leg1_dispo = session1:getVariable("endpoint_disposition");</font></div><div><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Leg 1 disposition:" .. leg1_dispo .. "\n");</font></div>
<div><font face="'courier new', monospace" size="1"> os.execute("sleep 1");</font></div><div><font face="'courier new', monospace" size="1">end</font></div><div><font face="'courier new', monospace" size="1"><br>
</font></div><div><font face="'courier new', monospace" size="1">if ( not session1:ready() ) then</font></div><div><font face="'courier new', monospace" size="1"> -- Oops, leg 1 hung up. Bummer.</font></div>
<div><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","It appears that " .. calling_user .. " disconnected...\n")</font></div><div><font face="'courier new', monospace" size="1">else</font></div>
<div><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Playing a prompt to " .. calling_user .. "\n");</font></div><div><font face="'courier new', monospace" size="1"> session1:streamFile('ivr/ivr-hold_connect_call.wav');</font></div>
<div><font face="'courier new', monospace" size="1"> session2 = freeswitch.Session("{origination_caller_id_number=" .. calling_user .."}user/" .. called_num);</font></div><div><font face="'courier new', monospace" size="1"> leg2_dispo = 'None';</font></div>
<div><font face="'courier new', monospace" size="1"> while(session1:ready() and session2:ready() and leg2_dispo ~= "ANSWER") do</font></div><div><font face="'courier new', monospace" size="1"> if ( not session1:ready() ) then</font></div>
<div><font face="'courier new', monospace" size="1"> -- oops, leg 1 hung up</font></div><div><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Well, it appears that " .. calling_user .. " has disconnected.\n");</font></div>
<div><font face="'courier new', monospace" size="1"> else</font></div><div><font face="'courier new', monospace" size="1"> os.execute("sleep 1");</font></div><div><font face="'courier new', monospace" size="1"> leg2_dispo = session2:getVariable("endpoint_disposition");</font></div>
<div><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Leg 2 disposition: " .. leg2_dispo .. "\n");</font></div><div><font face="'courier new', monospace" size="1"> end</font></div>
<div><font face="'courier new', monospace" size="1"> end -- While</font></div><div><font face="'courier new', monospace" size="1"> </font></div><div><font face="'courier new', monospace" size="1"> if ( session1:ready() and session2:ready() ) then</font></div>
<div><font face="'courier new', monospace" size="1"> -- Looks good, bridge 'em</font></div><div><font face="'courier new', monospace" size="1"> freeswitch.bridge(session1,session2);</font></div>
<div><font face="'courier new', monospace" size="1"> else </font></div><div><font face="'courier new', monospace" size="1"> -- Uh oh, someone went away</font></div><div><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Somebody hung up :(\n");</font></div>
<div><font face="'courier new', monospace" size="1"> end</font></div><div><font face="'courier new', monospace" size="1">end</font></div><div><br></div><div>FWIW, I drew inspiration from this:</div><div>
<a href="http://wiki.freeswitch.org/wiki/Mod_lua#Example:_Call_Control">http://wiki.freeswitch.org/wiki/Mod_lua#Example:_Call_Control</a></div><div><br></div><div>I'm still not a fan of doing it this way, but at least you know it's possible. (Personally I prefer an ESL-ish approach.)</div>
<div><br></div><div>-MC</div><br><div class="gmail_quote">On Thu, Dec 15, 2011 at 9:45 AM, Alex Crow <span dir="ltr"><<a href="mailto:acrow@integrafin.co.uk">acrow@integrafin.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div bgcolor="#ffffff" text="#000000">
BTW,<br>
<br>
It does work OK when bridging to the Mitel even for both legs. We
have a plan to move away from the Mitel to a pure FS environment by
stages, so we'd like to have something like this working beforehand.<br>
<br>
Cheers<br>
<br>
Alex<br>
<br>
On 15/12/11 07:37, Alex Crow wrote:
<blockquote type="cite">
Michael,<br>
<br>
I'm using Lua as I want to extend this to do things such as pull a
user's phone number from LDAP (with lualdap), wait a couple of
seconds before placing the outbound call in case it hits voicemail
on the Mitel (so we don't connect an internal extension's
voicemail to an external party) etc.<br>
<br>
I also found a simple originate rings both endpoints at once. I
don't want the second endpoint to be called until the first is
answered.<br>
<br>
Regardless, the Lua should work but it doesn't for me, and I'd
like to know if I'm doing something wrong.<br>
<br>
Cheers<br>
<br>
Alex<br>
<br>
On 14/12/11 23:01, Michael Collins wrote:
<blockquote type="cite">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>
<br>
</div>
<pre><fieldset></fieldset>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>
Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
</blockquote>
<br>
<br>
-- <br>
This message has been scanned for viruses and
<br>
dangerous content by
<a href="http://www.mailscanner.info/" target="_blank"><b>MailScanner</b></a>,
and is
<br>
believed to be clean.
<pre><fieldset></fieldset>
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>
Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
<pre cols="72">--
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)</pre>
</font></span></div>
<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>
<br></blockquote></div><br></div>