I think this could be filed under &quot;abusing Lua&quot; :)<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&#39;ve personally tinkered around and gotten 50-60 cps with a perl script that does this kind of thing. (Haven&#39;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">&lt;<a href="mailto:delorenzodesign@gmail.com">delorenzodesign@gmail.com</a>&gt;</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&#39;s phone rings), but the call almost immediately disconnects, after about 1s.  Everything seems to work fine if I&#39;m only pushing one or two calls through the Freeswitch instance, but as soon as I turn up the call rate (I&#39;m still only doing about 50 concurrent sessions) the playback begins to fail.<br>

<br>I&#39;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&#39;s the Lua script I&#39;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 = &quot;/usr/local/freeswitch/recordings/messages/&quot;;</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 = &quot;profile_id=&quot; .. profile_id;</span><br>

<span style="font-family:courier new,monospace">    s = s .. &quot;,account_code=&quot; .. account_code;</span><br><span style="font-family:courier new,monospace">    s = s .. &quot;,client_id=&quot; .. client_id;</span><br>

<span style="font-family:courier new,monospace">    s = s .. &quot;,caller_id_name=&quot; .. caller_id_name;</span><br><span style="font-family:courier new,monospace">    s = s .. &quot;,caller_id=&quot; .. caller_id;</span><br>

<span style="font-family:courier new,monospace">    s = s .. &quot;,dial_id=&quot; .. dial_id;</span><br><span style="font-family:courier new,monospace">    s = s .. &quot;,number_to_call=&quot; .. number_to_call;</span><br>

<span style="font-family:courier new,monospace">    s = s .. &quot;,message_to_play=&quot; .. message_to_play;</span><br><span style="font-family:courier new,monospace"></span><br><span style="font-family:courier new,monospace">    freeswitch.consoleLog(&quot;notice&quot;, s .. &quot;\n&quot;);</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(&quot;notice&quot;, &quot;******* PRINTING SESSION VARIABLES **********\n&quot;);</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(&quot;notice&quot;, &quot;**********************************************\n&quot;);</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 == &quot;event&quot; and voicemail_detected == false) then</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        freeswitch.consoleLog(&quot;debug&quot;,&quot;************ VOICE MAIL/ANSWERING MACHINE DETECTED *************\n&quot;);</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 &quot;break&quot;;</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(&quot;notice&quot;, &quot;Playing file: &quot; .. message_file .. &quot;\n&quot;);</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(&quot;notice&quot;, &quot;!!!!! Finished playing the file !!!!!\n&quot;);</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(&quot;{&quot; .. setDialVariables(false) .. &quot;,ignore_early_media=true,origination_caller_id_name=&quot; .. caller_id_name .. &quot;,origination_caller_id_number=+1&quot; .. caller_id .. &quot;}sofia/gateway/gateway_&quot; .. profile_id .. &quot;/&quot; .. 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(&quot;continue_on_fail&quot;,&quot;true&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">   session:setInputCallback(&quot;onInput&quot;,&quot;true&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">   session:execute(&quot;avmd&quot;,&quot;start&quot;);</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 &quot;yes&quot; or &quot;no&quot;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">   freeswitch.consoleLog(&quot;info&quot;, &quot;Was VM detected? &quot; .. vm_status .. &quot;\n&quot;);</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 &quot;break&quot;;</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(&quot;notice&quot;, &quot;Played the message at least once and checked for VM, we should be exiting the loop.\n&quot;)</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(&quot;info&quot;, &quot;Playback for voicemail.\n&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    session:execute(&quot;avmd&quot;,&quot;stop&quot;);</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(&quot;info&quot;, &quot;All finished, hanging up the session.\n&quot;);</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>