[Freeswitch-users] Understanding break="never" in condition-tag

[Redhosting] Egbert Groot egbert at redhosting.nl
Wed Mar 23 15:03:27 MSK 2011


Michael Collins schreef:
>  
>
>     I can't/didn't contribute much to this discussion, but I do follow
>     it. My idea and (little) testing experience supports the
>     explanation of Dimitry.
>     Either way, it 'proofs' there is confusion about the working of
>     the 'break' in condition tags.
>     If I can find the time, I will try to do some tests / build an
>     example myself. Thank you both for the answers and insights so far.
>
>
> Okay, for those of you who have the bridge book, please go to page 
> 167-168. Darren did a really good job of explaining this. For those of 
> you who don't have the book, SHAME! :)
>

Thanks for the explanation, and I just ordered the book :)

regards,
Egbert.

> The break flag determines what happens on processing conditions within 
> a single extension. Let's say that chan var ${freeswitch} has the 
> value "rocks" and ${foo} has the value "bar". 
>
> <extension name="break_flag_is_not_confusing">
>   <condition "${freeswitch}" expression="^lame$">
>     <!-- this does not get executed -->
>   </condition>
>   <!-- the following condition is not even evaluated -->
>   <condition "${foo}" expression="bar">
>   ...
>   </condition>
> </extension> 
>
> Look at the above snipped. The first condition evaluates to false, 
> which means all processing for this particular extension stops. The 
> parse "breaks" out of this extension and moves on to the next one. Now 
> look at this extension with the the break-flag set to "never"...
>
> <extension name="break_flag_is_not_confusing">
>   <condition "${freeswitch}" expression="^lame$" break="never">
>     <!-- this does not get executed -->
>   </condition>
>   <!-- the following condition *is* evaluated -->
>   <condition "${foo}" expression="bar">
>   ...
>   </condition>
> </extension> 
>
> See the difference? With the break flag set to "never" then it does 
> not matter whether the condition is evaluated as true or false - the 
> extension's next condition gets evaluated. Why do you need the 
> break="never"? Simple: when no "break" is specified there is an 
> implied break="on-false" for the condition. In other words, by 
> default, if one condition inside of an extension evaluates to false 
> then all processing for that extension stops. This has the effect of 
> allowing you to "stack" conditions to create a logical AND. 
>
> So, in summary, the break flag will control how the parser behaves 
> when evaluating conditions. Normally when a single condition fails, 
> the whole extension is skipped, however when you do break="never" on a 
> condition then it does not matter if that particular condition is true 
> or false - extension processing will continue.
>
> Hope this helps. If it doesn't then read chapters 5 and 8 of the book. 
> Chapter 5 (me) is a gentle intro into the dialplan. Chapter 8 (Darren) 
> talks more extensively about the advanced concepts of dialplan 
> processing. 
>
> -MC
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5154 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110323/846cae43/attachment.bin 


More information about the FreeSWITCH-users mailing list