[Freeswitch-users] Best way to mimic nested conditions?

Mario mario_fs at mgtech.com
Wed Sep 29 15:27:01 PDT 2010


I am struggling with the extension below which is a snippet of a larger
one that simply says "Hi" followed by a name based on the caller id. I
have looked at the book/wiki but the samples didn't work for me. I tried
various options but this is as close as I can get. What is happening is
that the first action (hi) does not play, and then only extension 100
will work. As if the break=true is not honored. BTW I looked at macros
but wanted to keep the numbers and file names close together. I thought
this was easier. Thanks!

   <extension name="mvhi">
      <condition field="destination_number" expression="^2921$"/>
        <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/hi.wav"/>
        <condition field="${caller_id_number}" expression="^100"
break="on_true">
          <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/danny.wav"/>
        </condition>
        <condition field="${caller_id_number}" expression="^200">
          <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/pam.wav break="on_true""/>
        </condition>
        <condition field="${caller_id_number}" expression="^300">
          <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/jerry.wav break="on_true""/>
        </condition>
   </extension>

I also tried this which plays the "hi" but will not go beyond ext 100.
   <extension name="mvhi">
      <condition field="destination_number" expression="^2921$">
        <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/hi.wav"/>
     </condition>
        <condition field="${caller_id_number}" expression="^100"
break="on_true">
          <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/danny.wav"/>
        </condition>
        <condition field="${caller_id_number}" expression="^200"
break="on_true">
          <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/pam.wav"/>
        </condition>
        <condition field="${caller_id_number}" expression="^300">
          <action application="playback"
data="/usr/local/freeswitch/conf/mvsounds/jerry.wav"/>
        </condition>
   </extension>




More information about the FreeSWITCH-users mailing list