From Violet Bat, 7 Years ago, written in XML.
  1. <extension name="do_this_for_all_9" continue="true">
  2.         <condition field="destination_number" expression="^(9.*)$">
  3.                 <action application="set" data="rand_val=${expr(randomize(&x);ceil(random(0,10,&x)))}"/>
  4.                 <action application="log" data="ERR Random Value: <${rand_val}>"/>
  5.         </condition>
  6. </extension>
  7.  
  8. <extension name="local_call2">
  9.   <condition field="destination_number" expression="^(9.*)$"/>
  10.             <condition field="${cond(${rand_val} > 4 ? YES : NO)}" expression="^YES$">
  11.                 <action application="set" data="continue_on_fail=true"/>
  12.                 <action application="ring_ready"/>
  13.                 <action application="sleep" data="3000"/>
  14.                 <action application="hangup" data="USER_BUSY"/>
  15.  
  16.                 <anti-action application="set" data="continue_on_fail=true"/>
  17.                 <anti-action application="ring_ready"/>
  18.                 <anti-action application="sleep" data="3000"/>
  19.                 <anti-action application="sched_hangup" data="+10 allotted_timeout"/>
  20.                 <anti-action application="answer"/>
  21.                 <acti-action application="callcenter" data="support@default"/>
  22.                 <anti-action application="hangup"/>
  23.             </condition>
  24. </extension>