As usual, Tony rocks. I forgot that expr has all sorts of cool functions. Check out that page Tony linked to, it has all sorts of interesting things. Let me know if you have a valid reason to use atan2 (arc-tangent with quadrant correction) in your dialplan. :P
-MC
moderate news:
there is the expr app that is not exactly intuitive but can generate a random number as a function variable
${expr(randomize(&x);ceil(random(0,10,&x)))}
This will eval to a random number from 1 to 10 (always start one number less than where you want to start)
see: http://wiki.freeswitch.org/files/expr.html--On Thu, Apr 8, 2010 at 6:29 PM, Michael Collins <msc@freeswitch.org> wrote:
Good news, bad news:
The good news is that the XML dialplan is a very efficient way of handling call routing. The bad news is that the XML dialplan is not a programming language. There is no "rand" function, so you'll need to do something different. One option is to use mod_distributor, however it is not "random" so that may not work for you. The other option is to call Lua or system or something and snag a random number.
-MCOn Thu, Apr 8, 2010 at 1:29 PM, Krzysztof Drewicz <krzysztofdrewicz@gmail.com> wrote:
Hi,
i'm slowly, but constantly moving from asterisk to fs.
Stuck on translating this into a freeswitch:
exten => s,1,Random(90:s,3)
exten => s,2,Noop(his is hit 10% times)
exten => s,3,Dial(SIP/8000)
What i need to do is put a bucket on some calling_number + destination numer
with some random percent to a voiceguide and hangup.
i've found that memcache is very convinent way to put data into
dialplan logic in runtime, so i plan to do:
<extension name="bucket_part_01" continue="true">
<condition field="${do_bucket}" expression=".+" break="on-true"/>
<condition field="caller_id_number" expression="^123456789$">
<action data="do_bucket=${memcache(get
b_${caller_id_number})}" application="set"/>
<action data="bucket_part_02" application="transfer"/>
<action application="hangup"/>
</condition>
</extension>
So above i check for caller_id_number in the memchache b_123456789 with option 1
Then i transfer to anoter extension:
<extension name="bucket_part_02">
<condition field="destination_number" expression="bucket_part_02"/>
<condition field="${czy_robic}" expression="^1$">
<action data="bypass_media=true" application="set"/>
<action data="hits=${memcache(increment
hit_bucket_test)}" application="set"/>
AND HERE I do need some logic that does if Random() > 50%
<action application="answer"/>
<action
data="/usr/local/freeswitch/sounds/pc/weRbusyRightNow.wav"
application="playback"/>
<action application="hangup"/>
</condition>
</extension>
any cleaner approach or someone has done it better?
note: don't want to use any lua, api or sth, just plain xml dialplan logic.
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900
_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org