[Freeswitch-users] Playback within condition

Caio Assis caioebassis at hotmail.com
Tue Sep 27 17:29:55 MSD 2016


Thank you for your help. The example you gave helped me a lot. I was able to do what I intended. Thanks a lot.


________________________________
From: freeswitch-users-bounces at lists.freeswitch.org <freeswitch-users-bounces at lists.freeswitch.org> on behalf of Branden Jordan <BJordan at E-Teleco.com>
Sent: Friday, September 23, 2016 6:28 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Playback within condition


Yeah without the console logs we are not going to be able to really help you.



If you are trying to do your conditionals right after your play and get digits or read that is not going to work without transferring. Remember the dialplan has two steps, the evaluation period to figure out what to run, and then the execute phase where it executes the steps. If you create the variable during the execute phase you cannot use the variable further down in a conditional in the same execution because during the evaluation period it was null.



This works when I test it. Maybe this will help you get on the right path to solving your issue.



   <extension name=”playthisfile”>

        <condition field="destination_number" expression="^playfilefortestcondition$">

          <action application="play_and_get_digits" data="1 1 1 4000 # abc.wav invalid.wav testvar [1|2|0] 100 testcond XML public" />

          <action application="transfer" data="testcond XML public" />

        </condition>

   </extension>



    <extension name="testconditions">

      <condition field="destination_number" expression="^testcond$"/>

        <condition field="${testvar}" expression="[0]" break="on-true">

           <action application="log" data="CRIT Value was 0"/>

           <action application="playback" data="test.wav"/>

           <action application="hangup" data="NORMAL_CLEARING"/>

        </condition>

        <condition field="${testvar}" expression="[1]" break="on-true">

           <action application="log" data="CRIT Value was NOT 0"/>

           <action application="playback" data="test.wav"/>

           <action application="hangup" data="NORMAL_CLEARING"/>

        </condition>

    </extension>



Thanks,

Branden Jordan



From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Aqs Younas
Sent: Friday, September 23, 2016 1:52 PM
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Subject: Re: [Freeswitch-users] Playback within condition



Like said before you need to look into logs to figure it out or paste the console logs here.



On 23 September 2016 at 22:18, Caio Assis <caioebassis at hotmail.com<mailto:caioebassis at hotmail.com>> wrote:

Actually, i might have figured it out. What I intend to do is an IVR-like application. Which means I want this to happen

Call 1212

Application="read" gets my input

if digit == 1 do this

if digit == 2 do that



Each option has it's own set of structions, so I think it should be within a condition. But I can't seem to validate the condition. Look at the following construction.



<condition field="${dg}" expression="^0$">

                                <action application="playback" data="/home/beep.gsm"/>

                                <anti-action application="playback" data="/home/audio.gsm"/>

                                <action application="hangup"/>

</condition>



${dg} is the variable that stores the input digit. So, if ${dg} == 0, play beep.gsm, else play audio.gsm. The expression is never true, but i put 0 always. Instead of playing beep.gsm, it plays audio.gsm. I got the same example from Freeswitch 1.2 book, Nested Conditions section.



________________________________

From: freeswitch-users-bounces at lists.freeswitch.org<mailto:freeswitch-users-bounces at lists.freeswitch.org> <freeswitch-users-bounces at lists.freeswitch.org<mailto:freeswitch-users-bounces at lists.freeswitch.org>> on behalf of Michael Jerris <mike at jerris.com<mailto:mike at jerris.com>>
Sent: Thursday, September 22, 2016 6:57 PM
To: FreeSWITCH Users Help
Cc: comercial at ypytecnologia.com.br<mailto:comercial at ypytecnologia.com.br>
Subject: Re: [Freeswitch-users] Playback within condition



look at the log generated by calling this.  What order do the dial plan apps show up?  Does the playback show up?  what do the logs show it doing when it executes that playback?



On Sep 22, 2016, at 1:06 PM, Caio Assis <caioebassis at hotmail.com<mailto:caioebassis at hotmail.com>> wrote:



Hi.



Here's what I'm trying to do. I want to play a sound if a certain condition is true.



<extension name="test">

    <condition field="destination_number" expression="^1212$">

        <condition field="${cond(${destination_number} == 1212 ? 1212 : 0000)}" expression="^1212$">

        <!-- this second condition is just to ilustrate the nested condition-->

                <action application="log" data="INFO LOG"/>

                  <action application="playback" data="sound1.gsm"/>

        </condition>

        <action application="playback" data="sound2.gsm"/>

        <action application="hangup"/>

    </condition>

</extension>



The sound 1 doesn't play, but I knew the condition was true because I can see the INFO LOG on the console. The sound 2, outside the condition, was played normally. Both PLAYBACK and READ applications don't work on nested conditions. Can anyone help me?

_________________________________________________________________________
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://confluence.freeswitch.org
http://www.cluecon.com

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


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


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list