From chrisbware, 6 Years ago, written in FreeSWITCH.
- view diff
Embed
  1. <extension name="distinct_ringback">
  2.         <condition field="${user_exists}" expression="^true$">
  3.                  <action application="limit" data="hash ${domain_name} direct_${destination_number} ${limit_max} ${limit_destination}"/>
  4.                  <action application="set" data="ncalls=${limit_usage(hash ${domain_name} direct_${destination_number})}" inline="true"/>
  5.         </condition>
  6.        <condition field="${ncalls}" expression="[1-9]" break="never">
  7.                  <action application="set" data="ringback=%(300, 300, 440);%(300, 3000, 440);"/>
  8.                  <anti-action application="set" data="ringback=$${it-ring}"/>
  9.        </condition>
  10.        <condition>
  11.                  <action application="set" data="hangup_after_bridge=true"/>
  12.                  <action application="export" data="domain_name=${domain_name}"/>
  13.                  <action application="set" data="force_transfer_context=mydomain.it"/>
  14.                  <action application="bridge data="{force_transfer_context=mydomain.it}user/${destination_number}@${domain_name}"/>
  15.        </condition>
  16. </extension>