[Freeswitch-users] Conditions

huseyin kalyoncu hkalyoncu at gmail.com
Wed Jun 13 15:31:51 MSD 2012


yes action statements must be inside condition tags. i thought you wrote
them in condition in your first mail..

for the expression=true ; i not sure you can do that but there is an
example usage together with regex in the wiki.
again check the link i sent before..

huseyin



On Wed, Jun 13, 2012 at 2:00 PM, Alex <alex at thewinelake.com> wrote:

>  OK... I think there's a fundamental misunderstanding about what code
> actually gets executed.
>
> The setting never happened in my example. If I change it to:
>
>         <condition field="${ani}" expression="^(\d+)$" break="never" >
>
>         <action inline="true" application="set" data="testvarA=hello"/>
>         <action inline="true" application="set" data="testvarB=hello"/>
>         </condition>
>        <condition field="${testvarA}" expression="^$" break="never" />
>         <condition field="${testvarB}" expression="^$" break="never">
>
>                 <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>
>
>
> Then it works. (Comparing ani to any number of digits).
> What I really want is something like <condition expression="true">
>
>
>  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> 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"/>
>>     }
>> </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
>> 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
>>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://wiki.freeswitch.orghttp://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org
>
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2177 / Virus Database: 2433/5065 - Release Date: 06/12/12
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://wiki.freeswitch.orghttp://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org
>
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2177 / Virus Database: 2433/5065 - Release Date: 06/12/12
>
>
>
> _________________________________________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120613/8d17b382/attachment-0001.html 


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