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