Hi,<div><br></div><div>Please see the below script by MC posted a few days earlier. Change the data accordingly. Also see this <a href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_sched_hangup">http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_sched_hangup</a> </div>
<div><br></div><div>Try setting the schedule hangup parameter before calling Bridge, I don't think this has any effect while in originate string.</div><div><br></div><div><br></div><div><div style><font face="'courier new', monospace" size="1">-- test_call</font></div>
<div style><font face="'courier new', monospace" size="1">-- create first leg, wait, then connect 2nd leg</font></div><div style><font face="'courier new', monospace" size="1">--</font></div><div style><font face="'courier new', monospace" size="1">local calling_user = argv[1];</font></div>
<div style><font face="'courier new', monospace" size="1">local called_num = argv[2];</font></div><div style><font face="'courier new', monospace" size="1"><br></font></div><div style><font face="'courier new', monospace" size="1">freeswitch.consoleLog("INFO","Attempting to contact user " .. calling_user .. "\n");</font></div>
<div style><font face="'courier new', monospace" size="1">local session1 = freeswitch.Session("{origination_caller_id_number=9876}user/"..calling_user);</font></div><div style><font face="'courier new', monospace" size="1">leg1_dispo = 'None';</font></div>
<div style><font face="'courier new', monospace" size="1"><br></font></div><div style><font face="'courier new', monospace" size="1">while (session1:ready() == true and leg1_dispo ~= 'ANSWER') do</font></div>
<div style><font face="'courier new', monospace" size="1"> leg1_dispo = session1:getVariable("endpoint_disposition");</font></div><div style><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Leg 1 disposition:" .. leg1_dispo .. "\n");</font></div>
<div style><font face="'courier new', monospace" size="1"> os.execute("sleep 1");</font></div><div style><font face="'courier new', monospace" size="1">end</font></div><div style><font face="'courier new', monospace" size="1"><br>
</font></div><div style><font face="'courier new', monospace" size="1">if ( not session1:ready() ) then</font></div><div style><font face="'courier new', monospace" size="1"> -- Oops, leg 1 hung up. Bummer.</font></div>
<div style><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","It appears that " .. calling_user .. " disconnected...\n")</font></div><div style><font face="'courier new', monospace" size="1">else</font></div>
<div style><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Playing a prompt to " .. calling_user .. "\n");</font></div><div style><font face="'courier new', monospace" size="1"> session1:streamFile('ivr/ivr-hold_connect_call.wav');</font></div>
<div style><font face="'courier new', monospace" size="1"> session2 = freeswitch.Session("{origination_caller_id_number=" .. calling_user .."}user/" .. called_num);</font></div><div style><font face="'courier new', monospace" size="1"> leg2_dispo = 'None';</font></div>
<div style><font face="'courier new', monospace" size="1"> while(session1:ready() and session2:ready() and leg2_dispo ~= "ANSWER") do</font></div><div style><font face="'courier new', monospace" size="1"> if ( not session1:ready() ) then</font></div>
<div style><font face="'courier new', monospace" size="1"> -- oops, leg 1 hung up</font></div><div style><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Well, it appears that " .. calling_user .. " has disconnected.\n");</font></div>
<div style><font face="'courier new', monospace" size="1"> else</font></div><div style><font face="'courier new', monospace" size="1"> os.execute("sleep 1");</font></div><div style>
<font face="'courier new', monospace" size="1"> leg2_dispo = session2:getVariable("endpoint_disposition");</font></div><div style><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Leg 2 disposition: " .. leg2_dispo .. "\n");</font></div>
<div style><font face="'courier new', monospace" size="1"> end</font></div><div style><font face="'courier new', monospace" size="1"> end -- While</font></div><div style><font face="'courier new', monospace" size="1"> </font></div>
<div style><font face="'courier new', monospace" size="1"> if ( session1:ready() and session2:ready() ) then</font></div><div style><font face="'courier new', monospace" size="1"> -- Looks good, bridge 'em</font></div>
<div style><font face="'courier new', monospace" size="1"> freeswitch.bridge(session1,session2);</font></div><div style><font face="'courier new', monospace" size="1"> else </font></div><div style>
<font face="'courier new', monospace" size="1"> -- Uh oh, someone went away</font></div><div style><font face="'courier new', monospace" size="1"> freeswitch.consoleLog("INFO","Somebody hung up :(\n");</font></div>
<div style><font face="'courier new', monospace" size="1"> end</font></div><div style><font face="'courier new', monospace" size="1">end</font></div><br class="Apple-interchange-newline"><div>Regards,</div>
<div>Sammy.<br><br><div class="gmail_quote">On Sun, Dec 25, 2011 at 10:19 PM, Faheem <span dir="ltr"><<a href="mailto:faheem_imt@yahoo.com">faheem_imt@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="color:#000;background-color:#fff;font-family:arial,helvetica,sans-serif;font-size:12pt"><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">Hi all, I am new in this list and this is my first email to this group. </div>
<div style="font-family:arial,helvetica,sans-serif;font-size:12pt">I need help regarding Bridge application using Lua script.</div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">I want to set the auto hangup for a bridge call in lua script. my script originate leg-A to local extension and then originate leg-b to a carrier and then bridge two legs. I want to hangup the leg-b after some seconds say 20 seconds.</div>
<div><font size="3">I did the </font>available<font size="3"> option, but nothing worked for me. Please help me. </font></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">
Here is my lua code.</div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">----------------------------------------------------------------------------------------------------------------</div>
<div><div>originate_str1 = "{origination_caller_id_number=".. caller.. ",effective_caller_id_number=".. caller ..",originate_timeout=45,ignore_early_media=true}sofia/internal/".. caller .."%" ..domain .."";</div>
<div><br></div><div>originate_str2 = "{origination_caller_id_number=".. callee.. ",effective_caller_id_number=".. callee ..",originate_timeout=60,<span style="background-color:rgb(255,191,128)">sched_hangup=20</span>,ignore_early_media=true}sofia/internal/".. carrier_dial_prefix1 .. callee .."%" ..carrier_gateway1 .."";<br>
</div><div><br></div><div>session1 =
freeswitch.Session(originate_str1);<br></div><div>session2 = freeswitch.Session(originate_str2);</div><div><div>freeswitch.bridge(session1, session2);</div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">
<br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><span style="font-size:12pt">Thanks! </span><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">Faheem Muhammad</div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">
<br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">
<br></div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><br></div></div></div> </div></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></div>