<div>Hello,</div><div><br></div><div>I have a dialplan where I get the incoming call to lua script</div><div><br></div><div><extension name="ext_call"></div><div> <action application="set" data="hangup_after_bridge=true"/></div>
<div> <action application="set" data="ignore_early_media=false"/></div><div> <condition field="destination_number" expression="\d{7,}"/>.</div><div> <condition field="${sip_from_host}" expression="^(10\.9\.0\.25)$">.</div>
<div> <action application ="lua" data="answer.lua"/>.</div><div> </condition></div><div></extension></div><div><br></div><div>and then I have answering in answer.lua:</div><div>===========================</div>
<div>session:preAnswer();</div><div><br></div><div>[...accessing to DB...]</div><div><br></div><div><div>if (session:ready()) then</div><div> repeat</div><div> index = index + 1;</div><div> session_call = string.format("[leg_timeout=30,ignore_early_media=true,hangup_after_bridge=true,origination_caller_id_number=".. cid .."]sofia/gateway/%s/%s",gwlist[index],dn);</div>
<div> legB = freeswitch.Session(session_call);</div></div>until ((hcause == 'USER_BUSY') or (hcause == 'SUCCESS') or (hcause == 'NO_ANSWER') or (index == #gwlist) or(session:ready() == false))<br>
<br><div><div>if (legB:ready()) then.</div><div> freeswitch.bridge(session, legB)</div><div>end</div></div><div>===========================</div><div><br></div><div>But I have a one problem, when the initial legA was disconnected before legB was answered. It it still continued to call legB (during the
leg_timeout). </div><div>Could you please explain, how I can cancel legB right after I got disconnect on legA in this case? Thank you.</div><div>--<br>Nikolay<br>
<br><br></div>