<div dir="ltr">here is an example.<div><br><div>extension agent_state is called with execute_extension like that:</div><div><action application="execute_extension" data="agent_state XML features"/><br></div><div><br></div><div><br></div><div><br></div><div><div> <extension name="agent_state"></div><div> <condition field="destination_number" expression="^agent_state$"/></div><div> <condition field="${agent_state}" expression="^(IDLE|EMPTY)$"></div><div><br></div><div> <action application="set" data="origination_cancel_key=#"/></div><div> <action application="export" data="execute_on_answer_1=spandsp_start_dtmf"/></div><div> <action application="export" data="execute_on_answer_2=bind_meta_app 4 a s execute_extension::att_xfer XML features"/></div><div> <action application="set" data="transfer_ringback=%(2000,4000,425,0)"/></div><div> <action application="execute_extension" data="populate_xfer_dial_string XML features"/><br></div><div> <action application="att_xfer" data="${xfer_dial_string}"/></div><div><br></div><div> <anti-action application="set" data="transfer-digits=NULL"/></div><div> <anti-action application="eval" data="cancel transfer"/></div><div> <anti-action application="playback" data="tone_stream://%(500,500,425,0);loops=3"/><br></div><div> <anti-action application="set" data="api_result=${uuid_hold off ${uuid}}"/></div><div><br></div><div> </condition></div><div> </extension></div></div><div><br></div><div><br></div><div>so, if destination_number is "agent_state" and if ${agent_state} variable is "IDLE" or "EMPTY" , 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"><<a href="mailto:vbvbrj@gmail.com" target="_blank">vbvbrj@gmail.com</a>></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'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>
> This is buy design...<br>
><br>
> <condition><action/></anti-<wbr>action></condition><br>
><br>
> Is the if CONDITION then ACTION else ANTI-ACTION<br>
><br>
> And keep in mind the dialplan is not a programming language... once you<br>
> reach a certain point that's what things like lua xml_curl and just<br>
> replacing the dialplan with a custom C module are for<br>
><br>
><br>
> -----Original Message-----<br>
> From: <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@<wbr>lists.freeswitch.org</a><br>
> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-<wbr>bounces@lists.freeswitch.org</a>] On Behalf Of Mimiko<br>
> Sent: Thursday, January 19, 2017 8:36 AM<br>
> To: FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.<wbr>freeswitch.org</a>><br>
> Subject: [Freeswitch-users] Nested conditions and anti-actions<br>
><br>
> Hello.<br>
><br>
> This is a snipped:<br>
><br>
> <condition field="destination_number" expression="^(1001|1002)$"<br>
> require-nested="false"><br>
> <condition field="${effective_caller_id_<wbr>name}" expression="^.+$"<br>
> break="never"><br>
> <action application="export"<br>
> data="caller_id_name=${<wbr>effective_caller_id_name} > ${destination_number}"/><br>
> <action application="export"<br>
> data="effective_caller_id_<wbr>name=${effective_caller_id_<wbr>name} ><br>
> ${destination_number}"/><br>
> <anti-action application="export" data="caller_id_name=${caller_<wbr>id_name}<br>
>> ${destination_number}"/><br>
> <anti-action application="export"<br>
> data="effective_caller_id_<wbr>name=${caller_id_name} > ${destination_number}"/><br>
> </condition><br>
> <action .... /><br>
> </condition><br>
><br>
> The problem I'm facing is that anti-actions are evaluated even if<br>
> destination_number is not equal to 1001 or 1002. But I need that ant-actions<br>
> will evaluate only when parent condition is true.<br>
><br>
> Is this a bug or it is by design?<br>
><br>
> --<br>
> Mimiko desu.<br>
><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>