[Freeswitch-users] Conditions

Alex alex at thewinelake.com
Wed Jun 13 14:38:40 MSD 2012


Mmm. Strangely enough, I stumbled on that just after posting, but it 
still doesn't work

<action inline="true" application="set" data="testvarA=hello"/>
<action inline="true" application="set" data="testvarB=hello"/>
<condition field="${testvarA}" expression="^$" />
<condition field="${testvarB}" expression="^$" >
<action application="log" data="WARNING TestVarsA and B are both empty"/>
<anti-action application="log" data="WARNING TestVarsA and B are NOT 
both empty"/>
</condition>

Result: "TestVarsA and B are both empty"

> hello alex,
>
> you must set testvarA and testvarB as inline
>
> check this http://wiki.freeswitch.org/wiki/Dialplan_XML#Inline_Actions
>
> huseyin
>
>
>
> On Wed, Jun 13, 2012 at 1:14 PM, Alex Lake <alex at thewinelake.com 
> <mailto:alex at thewinelake.com>> wrote:
>
>     I've been struggling a bit with conditions. In particular the "break"
>     attribute, which I couldn't really find any documentation on.
>
>     <action application="set" data="testvarA=hello/>
>     <action application="set" data="testvarB=hello/>
>     <condition field="${testvarA}" expression="^$" />
>     <condition field="${testvarB}" expression="^$" >
>     <action application="log" data="WARNING TestVarsA and B are both
>     empty"/>
>     <anti-action application="log" data="WARNING TestVarsA and B are NOT
>     both empty"/>
>     </condition>
>
>     The above gives "TestVarsA and B are both empty" which I don't
>     understand!
>
>     I think it would be nice to put some examples in the wiki that
>     translate
>     from the usual way of doing things (perhaps using PHP or JavaScript
>     notation) to the dialplan format.
>
>     For example, I have a requirement that might be expressed like this:
>
>     <context name="dp0095">
>     <extension name="Outbound_call">
>         if (${default_ani_prefix} == "" and sip_auth_username == "") {
>     <action application="log" data="WARNING default_ani_prefix and
>     sip_auth_username are not set (A)"/>
>     <action application="set"
>     data="default_ani_prefix=${tenant_id}${b_ext}1"/>
>         }
>         if (${default_ani_prefix} == "") {
>     <action application="log" data="WARNING default_ani_prefix is not
>     set (B)"/>
>     <action application="set" data="ani_prefix=${sip_auth_username}0"/>
>         } else {
>     <action application="set" data="ani_prefix=${default_ani_prefix}"/>
>         }
>         if ($destination_number == "^(\d{8}.*)") {
>     <action application="bridge"
>     data="[tenant_id=${tenant_id},a_ext=${a_ext},b_ext=${b_ext},origination_callee_id_number=$1,origination_caller_id_number=${ani_prefix}${ani}]sofia/internal/8980000000002$1 at 193.105.54.10
>     <mailto:1 at 193.105.54.10>"/>
>         }
>     </extension>
>     </context>
>
>     What is the nefarious combination of conditions, breaks, actions and
>     anti-actions required to implement this?
>
>     I'm happy to try and put a newbie-perspective updates into some
>     part of
>     the wiki. Talking of which, maybe it would be good to have more
>     example-based content in the wiki, but put it in a separate section so
>     that it doesn't clutter up the more reference-orientated bits.
>
>     Alex
>
>     _________________________________________________________________________
>     Professional FreeSWITCH Consulting Services:
>     consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>     http://www.freeswitchsolutions.com
>
>     
>     
>
>     Official FreeSWITCH Sites
>     http://www.freeswitch.org
>     http://wiki.freeswitch.org
>     http://www.cluecon.com
>
>     Join Us At ClueCon - Aug 7-9, 2012
>
>     FreeSWITCH-users mailing list
>     FreeSWITCH-users at lists.freeswitch.org
>     <mailto: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
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> 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
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.2177 / Virus Database: 2433/5065 - Release Date: 06/12/12
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120613/e6b0e650/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list