Action in nested condition gets executed even when outer condition is false
Hi, I have the following extension in a context that gets parsed several times during a call due to transfers and execute_extension. I'm finding that one of the inner actions (the correct one, based on time of day) gets executed even when the outer condition is false. Might not have noticed, except my original version of this extension actually played the greeting files, rather than just exporting the correct one in a variable. Callers were getting greeted multiple times, which was not the intention. For now I've sidestepped the audible problem by playing ${greeting} in another extension that does execute_extension on this one. But the greeting is still getting set multiple times per call. Would appreciate any clues as to why an inner action gets executed even though the outer condition is false. Thanks! Frank <extension name="set_greeting_tod"> <condition field="destination_number" expression="^set_greeting_tod$"> <condition minute-of-day="1-359" break="on-true"><!-- 12am - 5:59am --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> <condition minute-of-day="360-690" break="on-true"><!-- 6am - 11:30am --> <action application="export" data="greeting=ivr/ivr-good_morning.wav"/> </condition> <condition minute-of-day="691-780" break="on-true"><!-- 11:31am - 1pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> <condition minute-of-day="781-1020" break="on-true"><!-- 1:01pm - 5pm --> <action application="export" data="greeting=ivr/ivr-good_afternoon.wav"/> </condition> <condition minute-of-day="1021-1380" break="on-true"><!-- 5:01pm - 11pm --> <action application="export" data="greeting=ivr/ivr-good_evening.wav"/> </condition> <condition minute-of-day="1381-1440"><!-- 11:01pm - 11:59pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> </condition> </extension>
I haven't used nested conditions since I was raised in an era when you couldn't nest them. ;) This page mentions the "require-nested" attribute: https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan#XMLDialpla... I didn't see that in your dialplan, so that might be a good place to start. -MC On Tue, Nov 11, 2014 at 1:08 PM, Frank Myhr <fmyhr@fhmtech.com> wrote:
Hi,
I have the following extension in a context that gets parsed several times during a call due to transfers and execute_extension. I'm finding that one of the inner actions (the correct one, based on time of day) gets executed even when the outer condition is false. Might not have noticed, except my original version of this extension actually played the greeting files, rather than just exporting the correct one in a variable. Callers were getting greeted multiple times, which was not the intention.
For now I've sidestepped the audible problem by playing ${greeting} in another extension that does execute_extension on this one. But the greeting is still getting set multiple times per call.
Would appreciate any clues as to why an inner action gets executed even though the outer condition is false.
Thanks! Frank
<extension name="set_greeting_tod"> <condition field="destination_number" expression="^set_greeting_tod$">
<condition minute-of-day="1-359" break="on-true"><!-- 12am - 5:59am --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="360-690" break="on-true"><!-- 6am - 11:30am --> <action application="export" data="greeting=ivr/ivr-good_morning.wav"/> </condition>
<condition minute-of-day="691-780" break="on-true"><!-- 11:31am - 1pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="781-1020" break="on-true"><!-- 1:01pm - 5pm --> <action application="export" data="greeting=ivr/ivr-good_afternoon.wav"/> </condition>
<condition minute-of-day="1021-1380" break="on-true"><!-- 5:01pm - 11pm --> <action application="export" data="greeting=ivr/ivr-good_evening.wav"/> </condition>
<condition minute-of-day="1381-1440"><!-- 11:01pm - 11:59pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> </condition> </extension>
_________________________________________________________________________ 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
require_nested defaults to true so shouldn't be required. Frank, collect a debug-level log of the call. It'll show the parsing of the dialplan, and might shed light on what's happening. On 12 November 2014 01:29, Michael Collins <msc@freeswitch.org> wrote:
I haven't used nested conditions since I was raised in an era when you couldn't nest them. ;)
This page mentions the "require-nested" attribute:
https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan#XMLDialpla...
I didn't see that in your dialplan, so that might be a good place to start.
-MC
On Tue, Nov 11, 2014 at 1:08 PM, Frank Myhr <fmyhr@fhmtech.com> wrote:
Hi,
I have the following extension in a context that gets parsed several times during a call due to transfers and execute_extension. I'm finding that one of the inner actions (the correct one, based on time of day) gets executed even when the outer condition is false. Might not have noticed, except my original version of this extension actually played the greeting files, rather than just exporting the correct one in a variable. Callers were getting greeted multiple times, which was not the intention.
For now I've sidestepped the audible problem by playing ${greeting} in another extension that does execute_extension on this one. But the greeting is still getting set multiple times per call.
Would appreciate any clues as to why an inner action gets executed even though the outer condition is false.
Thanks! Frank
<extension name="set_greeting_tod"> <condition field="destination_number" expression="^set_greeting_tod$">
<condition minute-of-day="1-359" break="on-true"><!-- 12am - 5:59am --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="360-690" break="on-true"><!-- 6am - 11:30am --> <action application="export" data="greeting=ivr/ivr-good_morning.wav"/> </condition>
<condition minute-of-day="691-780" break="on-true"><!-- 11:31am - 1pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="781-1020" break="on-true"><!-- 1:01pm - 5pm --> <action application="export" data="greeting=ivr/ivr-good_afternoon.wav"/> </condition>
<condition minute-of-day="1021-1380" break="on-true"><!-- 5:01pm - 11pm --> <action application="export" data="greeting=ivr/ivr-good_evening.wav"/> </condition>
<condition minute-of-day="1381-1440"><!-- 11:01pm - 11:59pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> </condition> </extension>
_________________________________________________________________________ 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
_________________________________________________________________________ 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
Worth noting you don't need nested conditions to do this - search for Time-of-day-tod on https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan On 12 November 2014 13:54, Steven Ayre <steveayre@gmail.com> wrote:
require_nested defaults to true so shouldn't be required.
Frank, collect a debug-level log of the call. It'll show the parsing of the dialplan, and might shed light on what's happening.
On 12 November 2014 01:29, Michael Collins <msc@freeswitch.org> wrote:
I haven't used nested conditions since I was raised in an era when you couldn't nest them. ;)
This page mentions the "require-nested" attribute:
https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan#XMLDialpla...
I didn't see that in your dialplan, so that might be a good place to start.
-MC
On Tue, Nov 11, 2014 at 1:08 PM, Frank Myhr <fmyhr@fhmtech.com> wrote:
Hi,
I have the following extension in a context that gets parsed several times during a call due to transfers and execute_extension. I'm finding that one of the inner actions (the correct one, based on time of day) gets executed even when the outer condition is false. Might not have noticed, except my original version of this extension actually played the greeting files, rather than just exporting the correct one in a variable. Callers were getting greeted multiple times, which was not the intention.
For now I've sidestepped the audible problem by playing ${greeting} in another extension that does execute_extension on this one. But the greeting is still getting set multiple times per call.
Would appreciate any clues as to why an inner action gets executed even though the outer condition is false.
Thanks! Frank
<extension name="set_greeting_tod"> <condition field="destination_number" expression="^set_greeting_tod$">
<condition minute-of-day="1-359" break="on-true"><!-- 12am - 5:59am --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="360-690" break="on-true"><!-- 6am - 11:30am --> <action application="export" data="greeting=ivr/ivr-good_morning.wav"/> </condition>
<condition minute-of-day="691-780" break="on-true"><!-- 11:31am - 1pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="781-1020" break="on-true"><!-- 1:01pm - 5pm --> <action application="export" data="greeting=ivr/ivr-good_afternoon.wav"/> </condition>
<condition minute-of-day="1021-1380" break="on-true"><!-- 5:01pm - 11pm --> <action application="export" data="greeting=ivr/ivr-good_evening.wav"/> </condition>
<condition minute-of-day="1381-1440"><!-- 11:01pm - 11:59pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> </condition> </extension>
_________________________________________________________________________ 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
_________________________________________________________________________ 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
Steven and Michael, Thank you very much for your help! I looked at a debug-level call log yesterday before posting here and it only confused me because the outer condition regex FAILed but the inner action still got executed. Steven, thank you VERY much for pointing out that my extension doesn't even need the nested condition. I'd seen the wiki example, but clearly need to slow down and read more carefully! I've re-written the extension using the default break="on-false" for the first condition and no nesting, and it now works as expected. General lessons I take from this: 1) This list rocks! 2) Avoid nested conditions if at all possible. Thanks again! Frank On 11/12/2014 08:57 AM, Steven Ayre wrote:
Worth noting you don't need nested conditions to do this - search for Time-of-day-tod on https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan
On 12 November 2014 13:54, Steven Ayre <steveayre@gmail.com> wrote:
require_nested defaults to true so shouldn't be required.
Frank, collect a debug-level log of the call. It'll show the parsing of the dialplan, and might shed light on what's happening.
On 12 November 2014 01:29, Michael Collins <msc@freeswitch.org> wrote:
I haven't used nested conditions since I was raised in an era when you couldn't nest them. ;)
This page mentions the "require-nested" attribute:
https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan#XMLDialpla...
I didn't see that in your dialplan, so that might be a good place to start.
-MC
On Tue, Nov 11, 2014 at 1:08 PM, Frank Myhr <fmyhr@fhmtech.com> wrote:
Hi,
I have the following extension in a context that gets parsed several times during a call due to transfers and execute_extension. I'm finding that one of the inner actions (the correct one, based on time of day) gets executed even when the outer condition is false. Might not have noticed, except my original version of this extension actually played the greeting files, rather than just exporting the correct one in a variable. Callers were getting greeted multiple times, which was not the intention.
For now I've sidestepped the audible problem by playing ${greeting} in another extension that does execute_extension on this one. But the greeting is still getting set multiple times per call.
Would appreciate any clues as to why an inner action gets executed even though the outer condition is false.
Thanks! Frank
<extension name="set_greeting_tod"> <condition field="destination_number" expression="^set_greeting_tod$">
<condition minute-of-day="1-359" break="on-true"><!-- 12am - 5:59am --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="360-690" break="on-true"><!-- 6am - 11:30am --> <action application="export" data="greeting=ivr/ivr-good_morning.wav"/> </condition>
<condition minute-of-day="691-780" break="on-true"><!-- 11:31am - 1pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition>
<condition minute-of-day="781-1020" break="on-true"><!-- 1:01pm - 5pm --> <action application="export" data="greeting=ivr/ivr-good_afternoon.wav"/> </condition>
<condition minute-of-day="1021-1380" break="on-true"><!-- 5:01pm - 11pm --> <action application="export" data="greeting=ivr/ivr-good_evening.wav"/> </condition>
<condition minute-of-day="1381-1440"><!-- 11:01pm - 11:59pm --> <action application="export" data="greeting=ivr/ivr-hello.wav"/> </condition> </condition> </extension>
_________________________________________________________________________ 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
_________________________________________________________________________ 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
_________________________________________________________________________ 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
participants (3)
-
Frank Myhr
-
Michael Collins
-
Steven Ayre