Well, I got this script working with non-Snom phones:<div><br></div><div><div><font face="&#39;courier new&#39;, monospace" size="1">-- test_call</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">-- create first leg, wait, then connect 2nd leg</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">--</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">local calling_user = argv[1];</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">local called_num = argv[2];</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1"><br></font></div><div><font face="&#39;courier new&#39;, monospace" size="1">freeswitch.consoleLog(&quot;INFO&quot;,&quot;Attempting to contact user &quot; .. calling_user .. &quot;\n&quot;);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">local session1 = freeswitch.Session(&quot;{origination_caller_id_number=9876}user/&quot;..calling_user);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">leg1_dispo = &#39;None&#39;;</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1"><br></font></div><div><font face="&#39;courier new&#39;, monospace" size="1">while (session1:ready() == true and leg1_dispo ~= &#39;ANSWER&#39;) do</font></div><div>
<font face="&#39;courier new&#39;, monospace" size="1">    leg1_dispo = session1:getVariable(&quot;endpoint_disposition&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    freeswitch.consoleLog(&quot;INFO&quot;,&quot;Leg 1 disposition:&quot; .. leg1_dispo .. &quot;\n&quot;);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    os.execute(&quot;sleep 1&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">end</font></div><div><font face="&#39;courier new&#39;, monospace" size="1"><br>
</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">if ( not session1:ready() ) then</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    -- Oops, leg 1 hung up. Bummer.</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    freeswitch.consoleLog(&quot;INFO&quot;,&quot;It appears that &quot; .. calling_user .. &quot; disconnected...\n&quot;)</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">else</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    freeswitch.consoleLog(&quot;INFO&quot;,&quot;Playing a prompt to &quot; .. calling_user .. &quot;\n&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    session1:streamFile(&#39;ivr/ivr-hold_connect_call.wav&#39;);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    session2 = freeswitch.Session(&quot;{origination_caller_id_number=&quot; .. calling_user ..&quot;}user/&quot; .. called_num);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    leg2_dispo = &#39;None&#39;;</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    while(session1:ready() and session2:ready() and leg2_dispo ~= &quot;ANSWER&quot;) do</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">        if ( not session1:ready() ) then</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">            -- oops, leg 1 hung up</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">            freeswitch.consoleLog(&quot;INFO&quot;,&quot;Well, it appears that &quot; .. calling_user .. &quot; has disconnected.\n&quot;);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">        else</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">            os.execute(&quot;sleep 1&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">            leg2_dispo = session2:getVariable(&quot;endpoint_disposition&quot;);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">            freeswitch.consoleLog(&quot;INFO&quot;,&quot;Leg 2 disposition: &quot; .. leg2_dispo .. &quot;\n&quot;);</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">        end</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    end -- While</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    </font></div><div><font face="&#39;courier new&#39;, monospace" size="1">    if ( session1:ready() and session2:ready() ) then</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">        -- Looks good, bridge &#39;em</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">        freeswitch.bridge(session1,session2);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    else </font></div><div><font face="&#39;courier new&#39;, monospace" size="1">        -- Uh oh, someone went away</font></div><div><font face="&#39;courier new&#39;, monospace" size="1">        freeswitch.consoleLog(&quot;INFO&quot;,&quot;Somebody hung up :(\n&quot;);</font></div>
<div><font face="&#39;courier new&#39;, monospace" size="1">    end</font></div><div><font face="&#39;courier new&#39;, 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&#39;m still not a fan of doing it this way, but at least you know it&#39;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">&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">
<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&#39;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&#39;m using Lua as I want to extend this to do things such as pull a
      user&#39;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&#39;t connect an internal extension&#39;s
      voicemail to an external party) etc.<br>
      <br>
      I also found a simple originate rings both endpoints at once. I
      don&#39;t want the second endpoint to be called until the first is
      answered.<br>
      <br>
      Regardless, the Lua should work but it doesn&#39;t for me, and I&#39;d
      like to know if I&#39;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. 

&quot;Transact&quot; 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>