[Freeswitch-users] Conditions

Alex Lake alex at digitalmail.com
Wed Jun 13 14:05:37 MSD 2012


I've been struggling a bit with conditions. In particular the "break" 
attribute, which I couldn't really find any documentation on.

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



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