I have put together a dialer (of sorts) that is failing a fraction of the time. First, I instantiate a call leg from FreeSwitch to an agent (an employee in my facility with a softclient registered to FreeSwitch). Upon answering this call I have FreeSwitch bridge this leg to an outbound leg destined to a customer (via our carrier). The agent listens as this external number is dialed then is prepared to speak with that person. So all is well except a fraction of these calls fail at the step where FreeSwitch calls the agent. There seems to be a &#39;hangup&#39; event received from the client at the moment this leg is answered. This happens maybe 1/3 of the time.<div>

<br></div><div>here&#39;s my steps</div><div><br></div><div>1. call a Lua script via ESL</div><div><br></div><div>2. Lua script generates a call leg to agent:</div><div><div>                local session = freeswitch.Session(&quot;user/&quot; .. agentExt .. &quot;@<a href="http://stuff.com">stuff.com</a>&quot;)</div>

<div>                session:sleep(1000)</div><div>                if session:ready() then</div><div>                        session:execute(&quot;pre_answer&quot;)</div><div>                        session:execute(&quot;ring_ready&quot;)</div>

<div>                        session:execute(&quot;sleep&quot;, &quot;1000&quot;)</div><div><div>                        session:setVariable(&quot;outbound_callee_number&quot;, outboundCalleeNumber)</div></div><div>                        session:setVariable(&quot;outbound_caller_number&quot;, outboundCallerNumber)</div>

<div>                        session:setVariable(&quot;outbound_caller_name&quot;, outboundCallerName)</div><div>                        session:transfer(&quot;sales_outbound&quot;, &quot;XML&quot;, &quot;telifi&quot;)</div>

</div><div><br></div><div>******** fails here ~30% of the time - phone rings on the agent&#39;s desk, she answers and the call immediately ends ********</div><div><br></div><div>3. this leg is transferred to an XML dialplan that handles bridging to a customer&#39;s phone number:</div>

<div><div>    &lt;extension name=&quot;sales_outbound&quot;&gt;</div><div>      &lt;condition field=&quot;destination_number&quot; expression=&quot;^sales_outbound$&quot;&gt;</div><div>        &lt;action application=&quot;log&quot; data=&quot;INFO connected to agent, now dialing out...&quot;/&gt;</div>

<div>        &lt;action application=&quot;sleep&quot; data=&quot;1000&quot;/&gt;</div><div>        &lt;action application=&quot;playback&quot; data=&quot;ivr/8000/ivr-call_being_transferred.wav&quot;/&gt;--&gt;</div><div>

        &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;</div><div>        &lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot;/&gt;</div><div>        &lt;action application=&quot;set&quot; data=&quot;ringback=${us-ring}&quot;/&gt;</div>

<div>        &lt;action application=&quot;set&quot; data=&quot;call_timeout=30&quot;/&gt;</div><div>        &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_number=${outbound_caller_number}&quot;/&gt;</div>

<div>        &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_name=${outbound_caller_name}&quot;/&gt;</div><div>        &lt;action application=&quot;sleep&quot; data=&quot;1000&quot;/&gt;</div><div>        &lt;action application=&quot;bridge&quot; data=&quot;sofia/gateway/mycarrier/${outbound_callee_number}&quot;/&gt;</div>

<div>      &lt;/condition&gt;</div><div>    &lt;/extension&gt;</div></div><div><br></div><div>I appreciate any insight or suggestions you could provide.</div>