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(&amp;x);ceil(random(0,10,&amp;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">&lt;<a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a>&gt;</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 &quot;rand&quot; function, so you&#39;ll need to do something different. One option is to use mod_distributor, however it is not &quot;random&quot; 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">&lt;<a href="mailto:krzysztofdrewicz@gmail.com" target="_blank">krzysztofdrewicz@gmail.com</a>&gt;</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&#39;m slowly, but constantly moving from asterisk to fs.<br>
<br>
Stuck on translating this into a freeswitch:<br>
<br>
exten =&gt; s,1,Random(90:s,3)<br>
exten =&gt; s,2,Noop(his is hit 10% times)<br>
exten =&gt; 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&#39;ve found that memcache is very convinent way to put data into<br>
dialplan logic in runtime, so i plan to do:<br>
<br>
&lt;extension name=&quot;bucket_part_01&quot; continue=&quot;true&quot;&gt;<br>
        &lt;condition field=&quot;${do_bucket}&quot; expression=&quot;.+&quot; break=&quot;on-true&quot;/&gt;<br>
        &lt;condition field=&quot;caller_id_number&quot; expression=&quot;^123456789$&quot;&gt;<br>
        &lt;action data=&quot;do_bucket=${memcache(get<br>
b_${caller_id_number})}&quot; application=&quot;set&quot;/&gt;<br>
        &lt;action data=&quot;bucket_part_02&quot; application=&quot;transfer&quot;/&gt;<br>
        &lt;action application=&quot;hangup&quot;/&gt;<br>
        &lt;/condition&gt;<br>
&lt;/extension&gt;<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>
 &lt;extension name=&quot;bucket_part_02&quot;&gt;<br>
        &lt;condition field=&quot;destination_number&quot; expression=&quot;bucket_part_02&quot;/&gt;<br>
        &lt;condition field=&quot;${czy_robic}&quot; expression=&quot;^1$&quot;&gt;<br>
                &lt;action data=&quot;bypass_media=true&quot; application=&quot;set&quot;/&gt;<br>
                &lt;action data=&quot;hits=${memcache(increment<br>
hit_bucket_test)}&quot; application=&quot;set&quot;/&gt;<br>
<br>
AND HERE I do need some logic that does if Random() &gt; 50%<br>
<br>
                &lt;action application=&quot;answer&quot;/&gt;<br>
                &lt;action<br>
data=&quot;/usr/local/freeswitch/sounds/pc/weRbusyRightNow.wav&quot;<br>
application=&quot;playback&quot;/&gt;<br>
                &lt;action application=&quot;hangup&quot;/&gt;<br>
        &lt;/condition&gt;<br>
&lt;/extension&gt;<br>
<br>
<br>
any cleaner approach or someone has done it better?<br>
note: don&#39;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>