<div><br></div><div>i want to originate 5 calls after one second sleep using lua and get the response using playandgetdigits(), but scipt originate call one by one.</div><div><br></div><div>please guide me how i can call 5 numbers at the same time,</div>
<div><br></div><div>here is my code</div><div><br></div><div>===============================================================================================================================</div><div><b><font size="4">-- TestCall.lua</font></b></div>
<div><br></div><div><div>function PlayMessageAndGetResponse(message)</div><div> count = 1</div><div> invalid = 'say:flite:slt:nvalid input , please enter again'</div><div> audio_for_prompt = 'say:flite:slt:press 1 for YES, Press 2 for No, Press 3 for Record Message and Press 4 for Replay'</div>
<div> while session:ready() == true and count <= 3 do</div><div> session:sleep(250)</div><div><br></div><div> session:streamFile(message)</div><div><br></div><div> session:sleep(250)</div>
<div><br></div><div> digits = session:playAndGetDigits(1, 1, 3, 5, "#", audio_for_prompt, invalid, "^(1|2|3|4)$")</div><div><br></div><div> if digits == "" then</div>
<div> return 0</div><div> elseif digits == "4" then</div><div> count = count + 1</div><div> else</div><div> return digits</div>
<div> end</div><div> end</div><div> return 0</div><div>end</div><div><br></div><div>number = argv[1]</div><div>message= argv[2]</div><div><br></div><div>greeting = "Welcome! You have a Mesage"</div>
<div>bye_message = "Bye bye."</div><div>response = 0</div><div> freeswitch.consoleLog("info", "The Number "..number..", message "..message.."\n")</div><div> session = freeswitch.Session("{ignore_early_media=true,origination_caller_id_number=321}user/"..number.."")</div>
<div><br></div><div> session:setAutoHangup(false)</div><div> session:set_tts_parms("flite", "slt")</div><div><br></div><div> dispoA = "None"</div><div> while(session:ready() and dispoA ~= "ANSWER") do</div>
<div> dispoA = session:getVariable("endpoint_disposition")</div><div> freeswitch.consoleLog("INFO","Leg A disposition is '" .. dispoA .. "'\n")</div>
<div> os.execute("sleep 1")</div><div> end -- legA while</div><div><br></div><div> if session:ready() == true and dispoA == "ANSWER" then</div><div> uuid = session:getVariable("uuid")</div>
<div><br></div><div> session:speak(greeting)</div><div><br></div><div> response = PlayMessageAndGetResponse(message)</div><div><br></div><div> session:speak(bye_message)</div><div>
session:hangup()</div><div> end</div><div> cause = session:hangupCause()</div><div> session:destroy()</div><div><br></div><div> freeswitch.consoleLog('info',"Number "..number..", respond "..response.." hangup cause is "..cause.."\n")</div>
<div><br></div></div><div><div>===============================================================================================================================</div><div><b><font size="4">-- campaign.lua</font></b></div><br class="Apple-interchange-newline">
</div><div><div>count = 1000</div><div>number = {}</div><div>for i = 1, 5 do</div><div> number[i] = count</div><div> count = count + 1</div><div>end</div><div><br></div><div>for i = 1, 5 do</div><div> freeswitch.consoleLog("warning", "Calling " ..number[i].. "\n")</div>
<div> api = freeswitch.API();</div><div> reply = api:executeString("luarun TestCall.lua "..number[i].." ".."test_msg.wav")</div><div> os.execute("sleep 1")</div>
<div>end</div><div><br></div></div><div><br></div><div><div>===============================================================================================================================</div><br class="Apple-interchange-newline">
</div><div>Regards</div><div><br></div><div>Shahzad Bhatti</div>