<div>Hi</div><div>In the following lua function, I want to invoke VMX(another function) after execution of callcenter is completed. but it seems when  agent answers the call from callcenter, execution continues from the line after &quot;session:execute(&quot;callcenter&quot;,&quot;tehccq&quot;);&quot;, I mean it is not waiting till the dialog between agent and member ends. Is it normal (or I&#39;m doing something wrong)? if it is normal is there anyway I can get this working the way I need?</div>
<div>thanx</div><div><br></div><div>function DialCallCenter()</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>setLastState(&#39;CALLCENTER&#39;);<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>session:execute(&#39;answer&#39;);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>current_call_add(customerId,callerNumber,firstname,lastname);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>session:execute(&quot;callcenter&quot;,&quot;tehccq&quot;);<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>local agent_found = session:getVariable(&#39;cc_agent_found&#39;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;,&quot;hellophone:cc agent&quot;..(agent_found or &quot;&quot;));</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if agent_found == nil or agent_found ~= &#39;true&#39; then</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>VMX(&#39;no-answer-leave-a-message&#39;);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>end<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>return true;</div><div>end</div><div><br></div><div><br></div>