<div dir="ltr">here is an example.<div><br><div>extension agent_state is called with execute_extension like that:</div><div>&lt;action application=&quot;execute_extension&quot; data=&quot;agent_state XML features&quot;/&gt;<br></div><div><br></div><div><br></div><div><br></div><div><div>    &lt;extension name=&quot;agent_state&quot;&gt;</div><div>      &lt;condition field=&quot;destination_number&quot; expression=&quot;^agent_state$&quot;/&gt;</div><div>      &lt;condition field=&quot;${agent_state}&quot; expression=&quot;^(IDLE|EMPTY)$&quot;&gt;</div><div><br></div><div>        &lt;action application=&quot;set&quot; data=&quot;origination_cancel_key=#&quot;/&gt;</div><div>        &lt;action application=&quot;export&quot; data=&quot;execute_on_answer_1=spandsp_start_dtmf&quot;/&gt;</div><div>        &lt;action application=&quot;export&quot; data=&quot;execute_on_answer_2=bind_meta_app 4 a s execute_extension::att_xfer XML features&quot;/&gt;</div><div>        &lt;action application=&quot;set&quot; data=&quot;transfer_ringback=%(2000,4000,425,0)&quot;/&gt;</div><div>        &lt;action application=&quot;execute_extension&quot; data=&quot;populate_xfer_dial_string XML features&quot;/&gt;<br></div><div>        &lt;action application=&quot;att_xfer&quot; data=&quot;${xfer_dial_string}&quot;/&gt;</div><div><br></div><div>        &lt;anti-action application=&quot;set&quot; data=&quot;transfer-digits=NULL&quot;/&gt;</div><div>        &lt;anti-action application=&quot;eval&quot; data=&quot;cancel transfer&quot;/&gt;</div><div>        &lt;anti-action application=&quot;playback&quot; data=&quot;tone_stream://%(500,500,425,0);loops=3&quot;/&gt;<br></div><div>        &lt;anti-action application=&quot;set&quot; data=&quot;api_result=${uuid_hold off ${uuid}}&quot;/&gt;</div><div><br></div><div>      &lt;/condition&gt;</div><div>    &lt;/extension&gt;</div></div><div><br></div><div><br></div><div>so, if destination_number is &quot;agent_state&quot; and if ${agent_state} variable is &quot;IDLE&quot; or &quot;EMPTY&quot; , perform actions else perform anti-actions</div><div><br></div><div><br></div><div><br></div><div><br></div><div>hope it helps.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 January 2017 at 07:36, Mimiko <span dir="ltr">&lt;<a href="mailto:vbvbrj@gmail.com" target="_blank">vbvbrj@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">Yes, I know this, Ken. The problem is with nested condition. Anti-actions in nested conditions are executed if parent condition fail? Also, I&#39;ve<br>
observed that even if parent condition fail, actions or anti-actions in nested condition is executed. Ie, nested condition is checked and if fails -<br>
anti-action is executed, if it pass - actions is executed, regardless if parent condition fail or pass.<br>
<br>
I expected that any actions/anti-actions in nested condition will be executed only if parent condition pass. Yes, wiki states that parent condition is<br>
not checked until nested-conditions are not checked. But, if at the end parent condition fails, whole extension should not be executed.<br>
<br>
For now I changed the conditions in a simple AND without nested conditions.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 19.01.2017 19:13, Ken Rice wrote:<br>
&gt; This is buy design...<br>
&gt;<br>
&gt; &lt;condition&gt;&lt;action/&gt;&lt;/anti-<wbr>action&gt;&lt;/condition&gt;<br>
&gt;<br>
&gt; Is the if CONDITION then ACTION else ANTI-ACTION<br>
&gt;<br>
&gt; And keep in mind the dialplan is not a programming language... once you<br>
&gt; reach a certain point that&#39;s what things like lua xml_curl and just<br>
&gt; replacing the dialplan with a custom C module are for<br>
&gt;<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@<wbr>lists.freeswitch.org</a><br>
&gt; [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-<wbr>bounces@lists.freeswitch.org</a>] On Behalf Of Mimiko<br>
&gt; Sent: Thursday, January 19, 2017 8:36 AM<br>
&gt; To: FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.<wbr>freeswitch.org</a>&gt;<br>
&gt; Subject: [Freeswitch-users] Nested conditions and anti-actions<br>
&gt;<br>
&gt; Hello.<br>
&gt;<br>
&gt; This is a snipped:<br>
&gt;<br>
&gt; &lt;condition field=&quot;destination_number&quot; expression=&quot;^(1001|1002)$&quot;<br>
&gt; require-nested=&quot;false&quot;&gt;<br>
&gt;   &lt;condition field=&quot;${effective_caller_id_<wbr>name}&quot; expression=&quot;^.+$&quot;<br>
&gt; break=&quot;never&quot;&gt;<br>
&gt;    &lt;action application=&quot;export&quot;<br>
&gt; data=&quot;caller_id_name=${<wbr>effective_caller_id_name} &gt; ${destination_number}&quot;/&gt;<br>
&gt;    &lt;action application=&quot;export&quot;<br>
&gt; data=&quot;effective_caller_id_<wbr>name=${effective_caller_id_<wbr>name} &gt;<br>
&gt; ${destination_number}&quot;/&gt;<br>
&gt;    &lt;anti-action application=&quot;export&quot; data=&quot;caller_id_name=${caller_<wbr>id_name}<br>
&gt;&gt; ${destination_number}&quot;/&gt;<br>
&gt;    &lt;anti-action application=&quot;export&quot;<br>
&gt; data=&quot;effective_caller_id_<wbr>name=${caller_id_name} &gt; ${destination_number}&quot;/&gt;<br>
&gt;   &lt;/condition&gt;<br>
&gt; &lt;action .... /&gt;<br>
&gt; &lt;/condition&gt;<br>
&gt;<br>
&gt; The problem I&#39;m facing is that anti-actions are evaluated even if<br>
&gt; destination_number is not equal to 1001 or 1002. But I need that ant-actions<br>
&gt; will evaluate only when parent condition is true.<br>
&gt;<br>
&gt; Is this a bug or it is by design?<br>
&gt;<br>
&gt; --<br>
&gt; Mimiko desu.<br>
&gt;<br>
<br>
<br>
--<br>
Mimiko desu.<br>
<br>
______________________________<wbr>______________________________<wbr>_____________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.<wbr>freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.<wbr>org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.<wbr>freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/<wbr>mailman/listinfo/freeswitch-<wbr>users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.<wbr>freeswitch.org/mailman/<wbr>options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div>