[Freeswitch-users] move on from asterisk, the Random or rand function
Krzysztof Drewicz
krzysztofdrewicz at gmail.com
Thu Apr 8 13:29:28 PDT 2010
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.
More information about the FreeSWITCH-users
mailing list