From davidcsi, 7 Years ago, written in XML.
  1. <extension name="local_call2">
  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.  
  6.           <condition field="${cond(${rand_val} > 4 ? YES : NO)}" expression="^YES$">
  7.                 <action application="set" data="continue_on_fail=true"/>
  8.                 <action application="ring_ready"/>
  9.                 <action application="sleep" data="3000"/>
  10.                 <action application="hangup" data="USER_BUSY"/>
  11.  
  12.                 <anti-action application="set" data="continue_on_fail=true"/>
  13.                 <anti-action application="ring_ready"/>
  14.                 <anti-action application="sleep" data="3000"/>
  15.                 <anti-action application="sched_hangup" data="+10 allotted_timeout"/>
  16.                 <anti-action application="answer"/>
  17.                 <acti-action application="callcenter" data="support@default"/>
  18.                 <anti-action application="hangup"/>
  19.             </condition>
  20.         </condition>
  21. </extension>