moderate news:<br>there is the expr app that is not exactly intuitive but can generate a random number as a function variable<br><br>${expr(randomize(&x);ceil(random(0,10,&x)))}<br><br>This will eval to a random number from 1 to 10 (always start one number less than where you want to start)<br>
<br>see: <a href="http://wiki.freeswitch.org/files/expr.html">http://wiki.freeswitch.org/files/expr.html</a><br><br><br><div class="gmail_quote">On Thu, Apr 8, 2010 at 6:29 PM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Good news, bad news:<br><br>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.<br>
<font color="#888888">
<br>-MC</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Thu, Apr 8, 2010 at 1:29 PM, Krzysztof Drewicz <span dir="ltr"><<a href="mailto:krzysztofdrewicz@gmail.com" target="_blank">krzysztofdrewicz@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
i'm slowly, but constantly moving from asterisk to fs.<br>
<br>
Stuck on translating this into a freeswitch:<br>
<br>
exten => s,1,Random(90:s,3)<br>
exten => s,2,Noop(his is hit 10% times)<br>
exten => s,3,Dial(SIP/8000)<br>
<br>
What i need to do is put a bucket on some calling_number + destination numer<br>
with some random percent to a voiceguide and hangup.<br>
<br>
i've found that memcache is very convinent way to put data into<br>
dialplan logic in runtime, so i plan to do:<br>
<br>
<extension name="bucket_part_01" continue="true"><br>
<condition field="${do_bucket}" expression=".+" break="on-true"/><br>
<condition field="caller_id_number" expression="^123456789$"><br>
<action data="do_bucket=${memcache(get<br>
b_${caller_id_number})}" application="set"/><br>
<action data="bucket_part_02" application="transfer"/><br>
<action application="hangup"/><br>
</condition><br>
</extension><br>
<br>
So above i check for caller_id_number in the memchache b_123456789 with option 1<br>
Then i transfer to anoter extension:<br>
<br>
<extension name="bucket_part_02"><br>
<condition field="destination_number" expression="bucket_part_02"/><br>
<condition field="${czy_robic}" expression="^1$"><br>
<action data="bypass_media=true" application="set"/><br>
<action data="hits=${memcache(increment<br>
hit_bucket_test)}" application="set"/><br>
<br>
AND HERE I do need some logic that does if Random() > 50%<br>
<br>
<action application="answer"/><br>
<action<br>
data="/usr/local/freeswitch/sounds/pc/weRbusyRightNow.wav"<br>
application="playback"/><br>
<action application="hangup"/><br>
</condition><br>
</extension><br>
<br>
<br>
any cleaner approach or someone has done it better?<br>
note: don't want to use any lua, api or sth, just plain xml dialplan logic.<br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>