I think this could be filed under "abusing Lua" :)<div><br></div><div>The amount of control you are doing on these calls tells me that you should absolutely be doing most of this logic outside of FreeSWITCH. I would recommend a socket-based application that can build the dialstrings and send them to FS as originate commands. I've personally tinkered around and gotten 50-60 cps with a perl script that does this kind of thing. (Haven't done much w/ it lately.) </div>
<div><br></div><div>-MC<br><br><div class="gmail_quote">On Mon, Feb 21, 2011 at 11:22 PM, Michael De Lorenzo <span dir="ltr"><<a href="mailto:delorenzodesign@gmail.com">delorenzodesign@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br><br>I have a Freeswitch installation that is intended to make many calls (thousands) and playback a single wav file. The calls are successfully processed (the recipient's phone rings), but the call almost immediately disconnects, after about 1s. Everything seems to work fine if I'm only pushing one or two calls through the Freeswitch instance, but as soon as I turn up the call rate (I'm still only doing about 50 concurrent sessions) the playback begins to fail.<br>
<br>I've watched the calls go out from the console and nothing looks out of the ordinary, except that the calls are disconnected with NORMAL CLEARING prior to completion.<br><br>Here's the Lua script I'm using...<br>
<br><div style="margin-left:40px"><span style="font-family:courier new,monospace">profile_id = argv[1];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">account_code = argv[2];</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">client_id = argv[3];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">caller_id_name = argv[4];</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">caller_id = argv[5];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">dial_id = argv[6];</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">number_to_call = argv[7];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">message_to_play = argv[8];</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">max_retries = argv[9];</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">retry_interval = argv[10];</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"></span><span style="font-family:courier new,monospace">local human_detected = false</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">local voicemail_detected = false;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">local message_played = false;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">recordings_directory = "/usr/local/freeswitch/recordings/messages/";</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">function setDialVariables(set_as_session_variables)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> local s = "profile_id=" .. profile_id;</span><br>
<span style="font-family:courier new,monospace"> s = s .. ",account_code=" .. account_code;</span><br><span style="font-family:courier new,monospace"> s = s .. ",client_id=" .. client_id;</span><br>
<span style="font-family:courier new,monospace"> s = s .. ",caller_id_name=" .. caller_id_name;</span><br><span style="font-family:courier new,monospace"> s = s .. ",caller_id=" .. caller_id;</span><br>
<span style="font-family:courier new,monospace"> s = s .. ",dial_id=" .. dial_id;</span><br><span style="font-family:courier new,monospace"> s = s .. ",number_to_call=" .. number_to_call;</span><br>
<span style="font-family:courier new,monospace"> s = s .. ",message_to_play=" .. message_to_play;</span><br><span style="font-family:courier new,monospace"></span><br><span style="font-family:courier new,monospace"> freeswitch.consoleLog("notice", s .. "\n");</span><br>
<span style="font-family:courier new,monospace"></span><br><span style="font-family:courier new,monospace"> return s</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">function printSessionVariables()</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> freeswitch.consoleLog("notice", "******* PRINTING SESSION VARIABLES **********\n");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> </span>-- ommitted<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> freeswitch.consoleLog("notice", "**********************************************\n");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">function onInput(s, type, obj, arg)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if(type == "event" and voicemail_detected == false) then</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> freeswitch.consoleLog("debug","************ VOICE MAIL/ANSWERING MACHINE DETECTED *************\n");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> voicemail_detected = true;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> return "break";</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> end</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> return true;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">function playbackMessage(sleepTime)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> message_played = false;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> session:sleep(sleepTime);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> -- play a file</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> message_file = recordings_directory .. message_to_play;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> freeswitch.consoleLog("notice", "Playing file: " .. message_file .. "\n");</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> session:streamFile(message_file);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> freeswitch.consoleLog("notice", "!!!!! Finished playing the file !!!!!\n");</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> message_played = true;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">session = freeswitch.Session("{" .. setDialVariables(false) .. ",ignore_early_media=true,origination_caller_id_name=" .. caller_id_name .. ",origination_caller_id_number=+1" .. caller_id .. "}sofia/gateway/gateway_" .. profile_id .. "/" .. number_to_call);</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">while(session:ready()) do</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> setDialVariables(true)</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> session:answer();</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> -- session:execute("continue_on_fail","true");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> session:setInputCallback("onInput","true");</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> session:execute("avmd","start");</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> playbackMessage(200);</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> vm_status = voicemail_detected == true and "yes" or "no"</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> freeswitch.consoleLog("info", "Was VM detected? " .. vm_status .. "\n");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> if(voicemail_detected) then</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> return "break";</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> end</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> freeswitch.consoleLog("notice", "Played the message at least once and checked for VM, we should be exiting the loop.\n")</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">if (voicemail_detected) then</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> freeswitch.consoleLog("info", "Playback for voicemail.\n");</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> session:execute("avmd","stop");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> playbackMessage(5000);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">end</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">freeswitch.consoleLog("info", "All finished, hanging up the session.\n");</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">session:hangup();</span><br style="font-family:courier new,monospace"></div><br>Any help would be greatly appreciated.<br><br>Thank you,<br><font color="#888888"><br>Michael<br>
</font><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>