[Freeswitch-users] Stacked conditions are not acting like logical AND

Herman Griffin herman.griffin at gmail.com
Sat Jan 14 21:16:22 MSK 2012


Hello Freeswitchers,

I'm using stacked condition that are supposed to behave line logical
AND operators. The call trace has been separated in to two section.
The first section corresponds to the first set of stacked conditions
in my dialplan and the second section corresponds to my second set
of stacked conditions.

The second condition in the second set of stack condition evaluates to
FAIL (false). However the 'action' that are wrapped are still being
exacuted. I expect the 'anti-action' to execute when any of the AND
operands evaluates to FAIL.

Note: I'm using break=never because I don't want a failed condition to
break me out of the extension. There are multiple condition blocks
in the extension. Regardless of whether break being set to never, it
seems that the wrapped actions should not execute unless all
conditions
evalute to PASS (true)

Can someone help point out my mistake?

Thank you,
Herman Griffin

------------------------------------
This is my call trace:

Dialplan: sofia/external/Unknown at 72.37.252.18 Regex (PASS) [emergency]
${open}(true) =~ /^true$/ break=never
Dialplan: sofia/external/Unknown at 72.37.252.18 Regex (FAIL) [emergency]
${emergency_call}() =~ /^true$/ break=never

Dialplan: sofia/external/Unknown at 72.37.252.18 Regex (PASS) [emergency]
${sip_gateway}(1006_7217) =~ /^1006_7217$/ break=never
Dialplan: sofia/external/Unknown at 72.37.252.18 Regex (FAIL) [emergency]
${emergency_call}() =~ /^true$/ break=never
Dialplan: sofia/external/Unknown at 72.37.252.18 Regex (PASS) [emergency]
${db(select/emergency/autoanswer)}(1) =~ /^1$/ break=never
Dialplan: sofia/external/Unknown at 72.37.252.18 Action set(call_timeout=60)
Dialplan: sofia/external/Unknown at 72.37.252.18 Action
set(effective_caller_id_name=${regex(${caller_id_name}|^Emerg(_.*)$|Auto%1)})
Dialplan: sofia/external/Unknown at 72.37.252.18 Action set(autoanswered=true)
Dialplan: sofia/external/Unknown at 72.37.252.18 Action answer()
Dialplan: sofia/external/Unknown at 72.37.252.18 Action
set(group_confirm_file=/usr/local/freeswitch/sounds/en/us/callie/emergency/press_to_accept.wav)
Dialplan: sofia/external/Unknown at 72.37.252.18 Action set(group_confirm_key=1)
Dialplan: sofia/external/Unknown at 72.37.252.18 Action
bridge(user/1000@${domain_name},sofia/gateway/1006_7217/${mobile_number})

------------------------------------
This is the corresponding dialplan:

    <condition field="${open}" expression="^true$" break="never"/>
    <condition field="${emergency_call}" expression="^true$" break="never">
        <action application="set" data="session_in_hangup_hook=true"/>
        <action application="set" data="api_hangup_hook=python
emergency.hangup"/>
    </condition>

    <condition field="${sip_gateway}"
expression="^${default_provider}$" break="never"/>
    <condition field="${emergency_call}" expression="^true$" break="never"/>
    <condition field="${db(select/emergency/autoanswer)}"
expression="^1$" break="never">
      <action application="set" data="call_timeout=60"/>
      <action application="set"
data="effective_caller_id_name=${regex(${caller_id_name}|^Emerg(_.*)$|Auto%1)}"/>
      <action application="set" data="autoanswered=true"/>
      <action application="answer" data=""/>
      <action application="set"
data="group_confirm_file=/usr/local/freeswitch/sounds/en/us/callie/emergency/press_to_accept.wav"/>
      <action application="set" data="group_confirm_key=1"/>
      <action application="bridge"
data="user/1000@${domain_name},sofia/gateway/1006_7217/${mobile_number}"/>
      <!-- My anti-actions start here -->
      <anti-action application="set"
data="effective_caller_id_name=${regex(${caller_id_name}|^Emerg(_.*)$|NotAuto%1)}"/>
      <anti-action application="set" data="call_timeout=30"/>
      <anti-action application="set" data="autoanswered=false"/>
      <anti-action application="bridge"
data="user/1000@${domain_name},sofia/gateway/1006_7217/${mobile_number}"/>
    </condition>



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