<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You can do all this with a single originate command, why would you use lua for this in the first place?<div><br></div><div>Mike</div><div><br><div><div>On Aug 21, 2012, at 6:31 AM, Chris B. Ware &lt;<a href="mailto:chrisbware@yahoo.it">chrisbware@yahoo.it</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: static; z-index: auto; "><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hi,</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16.363636016845703px; background-color: transparent; font-style: normal; ">I need a small lua script to originate two extension calls &nbsp;and bridge them.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16.363636016845703px; background-color: transparent; font-style: normal; ">This is my script (based on lua wiki example):</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16.363636016845703px; background-color: transparent; font-style: normal; "><br></div><div style="background-color: transparent; "><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">local callee = argv[1]</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">local called = argv[2]</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">local domain = argv[3]</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">Adisp = "None";</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">param="{ignore_early_media=true,ringback=\'%(1000,4000,425,425)\',origination_caller_id_number="</font></div><div style="background-color:
 transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">legA=freeswitch.Session(param..callee.."}user/"..called);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">while (Adisp~="ANSWER" and legA:ready()) do</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Adisp &nbsp;= legA:getVariable("endpoint_disposition");</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; os.execute("sleep 1")</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">end -- waiting for A to answer</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">if (Adisp=="ANSWER") then</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; legB=freeswitch.Session(param..called.."}user/"..callee);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">&nbsp; &nbsp; &nbsp; &nbsp; freeswitch.bridge(legA,legB);</font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">end</font></div><div style="background-color: transparent; font-size: 16.363636016845703px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; font-size: 16.363636016845703px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; "><font face="times new roman, new york, times, serif">The script works but there's no ringback, when A answers and B is ringing.</font></div><div style="background-color: transparent; font-size: 16.363636016845703px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; "><font face="times new roman, new york, times, serif">When B answers, we can talk.</font></div><div style="background-color: transparent; font-size: 16.363636016845703px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; font-size: 16.363636016845703px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; "><font face="times new roman, new york, times, serif">This is my log:</font></div><div style="background-color:
 transparent; "><font face="times new roman, new york, times, serif"><a href="http://pastebin.freeswitch.org/19745">http://pastebin.freeswitch.org/19745</a><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif"><br></font></div><div style="background-color: transparent; "><font face="times new roman, new york, times, serif">I know that something stupid is missing but I can't work out where's the error!</font></div><div style="background-color: transparent; font-size: 16.363636016845703px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; "><font face="times new roman, new york, times, serif">Any help?</font></div></div></div></div></blockquote></div><br></div></body></html>