[Freeswitch-users] Random not working?

Nathan Neulinger nneul at mst.edu
Fri Aug 30 16:55:48 MSD 2013


FYI, even the book isn't completely consistent - I know there was at least one place in it where it said something 
explicitly about not being able to use a set variable to make further dialplan decisions with no mention of inline.

I can try and find it again if it's something you want to update for a future rev.

-- Nathan

On 08/29/2013 06:30 PM, Michael Collins wrote:
> tsk tsk! you should be reading about that in chapters 5 and 8 of the FreeSWITCH book! ;) Also this page has some extra
> info you might appreciate:
>
> https://wiki.freeswitch.org/wiki/Dialplan_XML#Availability_of_Variables
>
> -MC
>
>
> On Thu, Aug 29, 2013 at 12:06 PM, David Villasmil <david.villasmil.work at gmail.com
> <mailto:david.villasmil.work at gmail.com>> wrote:
>
>     You the man! thanks!! I had never heard (read) or that "inline"...
>
>     David
>
>
>     On Thu, Aug 29, 2013 at 6:28 PM, Kevin Wormington <kworm at sofnet.com <mailto:kworm at sofnet.com>> wrote:
>
>         I believe you would need to add inline="true" to your action setting the
>         variable...see http://wiki.freeswitch.org/wiki/Dialplan_XML#Inline_Actions
>
>         Kevin
>
>         On 08/29/2013 10:10 AM, David Villasmil wrote:
>          > Hello guys,
>          >
>          > I've got this in my dialplan:
>          >
>          > <action application="set" data="rand_val=${expr
>          > randomize(&x);ceil(random(0,100,&x))}"/>
>          > <action application="log" data="INFO Random dialplan ${expr
>          > randomize(&x);ceil(random(0,100,&x))}"/>
>          > <action application="log" data="INFO Random value is ${rand_val}"/>
>          >
>          > and this is what i see in my cli:
>          >
>          > Dialplan: sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>> Regex
>          > (PASS) [respond] destination_number(1234) =~ /^.*/ break=on-false
>          > Dialplan: sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>
>         Action
>          > set(rand_val=${expr randomize(&x);ceil(random(0,100,&x))})
>          > Dialplan: sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>
>         Action
>          > log(INFO Random dialplan ${expr randomize(&x);ceil(random(0,100,&x))})
>          > Dialplan: sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>
>         Action
>          > log(INFO Random value is ${rand_val})
>          > 2013-08-29 16:40:48.834592 [DEBUG] switch_core_state_machine.c:167
>          > (sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>) State Change
>          > CS_ROUTING -> CS_EXECUTE
>          > 2013-08-29 16:40:48.834592 [DEBUG] switch_core_session.c:1341 Send
>          > signal sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>> [BREAK]
>          > 2013-08-29 16:40:48.834592 [DEBUG] switch_core_state_machine.c:471
>          > (sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>) State ROUTING
>          > going to sleep
>          > 2013-08-29 16:40:48.834592 [DEBUG] switch_core_state_machine.c:416
>          > (sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>) Running State
>          > Change CS_EXECUTE
>          > 2013-08-29 16:40:48.834592 [DEBUG] switch_core_state_machine.c:478
>          > (sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>) State EXECUTE
>          > 2013-08-29 16:40:48.834592 [DEBUG] mod_sofia.c:230
>          > sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>> SOFIA EXECUTE
>          > 2013-08-29 16:40:48.834592 [DEBUG] switch_core_state_machine.c:209
>          > sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>> Standard
>         EXECUTE
>          > EXECUTE sofia/external/12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4> <mailto:12345 at 1.2.3.4 <mailto:12345 at 1.2.3.4>>
>         log(INFO ASR
>          > 40 we got )
>          > 2013-08-29 16:40:48.854572 [INFO] mod_dptools.c:1567 ASR 40 we got
>          >
>          >
>          > Why is the "${rand_val}" not being parsed?
>          >
>          > Thanks,
>          >
>          > David
>          >
>          >
>          >
>          > _________________________________________________________________________
>          > 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://wiki.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
>          >
>
>         _________________________________________________________________________
>         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://wiki.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
>
>
>
>     _________________________________________________________________________
>     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://wiki.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
>
>
>
>
> --
> Michael S Collins
> Twitter: @mercutioviz
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.org
>

-- 
------------------------------------------------------------
Nathan Neulinger                       nneul at mst.edu
Missouri S&T Information Technology    (573) 612-1412
System Administrator - Architect



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