From fs, 7 Years ago, written in FreeSWITCH.
- view diff
Embed
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. - <!--     NOTICE:
  3.    
  4.     This context is usually accessed via authenticated callers on the sip profile on port 5060
  5.     or transfered callers from the public context which arrived via the sip profile on port 5080.
  6.    
  7.     Authenticated users will use the user_context variable on the user to determine what context
  8.     they can access.  You can also add a user in the directory with the cidr= attribute acl.conf.xml
  9.     will build the domains ACL using this value.
  10.  
  11.   -->
  12. - <!--  http://wiki.freeswitch.org/wiki/Dialplan_XML
  13.   -->
  14. - <include>
  15. - <context name="default">
  16. - <extension name="unloop">
  17.   <condition field="${unroll_loops}" expression="^true$" />
  18. - <condition field="${sip_looped_call}" expression="^true$">
  19.   <action application="deflect" data="${destination_number}" />
  20.   </condition>
  21.   </extension>
  22. - <extension name="inbound-test">
  23.   -
  24. - <condition field="destination_number" expression="^1000$">
  25.   <action application="set" data="continue_on_fail=true" />
  26.   <action application="set" data="call_timeout=30" />
  27.   <action application="answer" />
  28.   <action application="sleep" data="1000" />
  29.   <action application="ivr" data="demo_ivr" />
  30.   <action application="export" data="ringback=local_stream://moh" />
  31.   <action application="set" data="continue_on_fail=true" />
  32.   <action application="set" data="hangup_after_bridge=true" />
  33.   <action application="bridge" data="user/1001@${domain_name}" />
  34.   <action application="bridge" data="${group_call(sales@${domain_name})}" />
  35.   <action application="bridge" data="group/support@${domain_name}" />
  36.   <action application="bridge" data="group/billing@${domain_name}" />
  37.   <action application="bridge" data="sofia/gateway/${default_gateway}/9322306212" />
  38.   </condition>
  39.   </extension>
  40. - <!--  Example of doing things based on time of day.
  41.  
  42.          year = 4 digit year. Example year="2009"
  43.          yday = 1-365
  44.          mon = 1-12
  45.          mday = 1-31
  46.          week = 1-52
  47.          mweek= 1-6
  48.          wday = 1-7
  49.          hour = 0-23
  50.          minute = 0-59
  51.          minute-of-day = 1-1440
  52.          
  53.          Example:
  54.          <condition minute-of-day="540-1080"> (9am to 6pm EVERY day)
  55.          do something ...
  56.          </condition>
  57.    
  58.   -->
  59. - <extension name="tod_example" continue="true">
  60. - <condition wday="2-6" hour="9-18">
  61.   <action application="set" data="open=true" />
  62.   </condition>
  63.   </extension>
  64. - <!--  Example of routing based on holidays
  65.  
  66.         This example covers all US Federal holidays except for inauguration day.
  67.    
  68.   -->
  69. - <extension name="holiday_example" continue="true">
  70. - <condition mday="1" mon="1">
  71. - <!--  new year's day
  72.   -->
  73.   <action application="set" data="open=false" />
  74.   </condition>
  75. - <condition wday="2" mweek="3" mon="1">
  76. - <!--  martin luther king day is the 3rd monday in january
  77.   -->
  78.   <action application="set" data="open=false" />
  79.   </condition>
  80. - <condition wday="2" mweek="3" mon="2">
  81. - <!--  president's day is the 3rd monday in february
  82.   -->
  83.   <action application="set" data="open=false" />
  84.   </condition>
  85. - <condition wday="2" mon="5" mday="25-31">
  86. - <!--  memorial day is the last monday in may (the only monday between the 25th and the 31st)
  87.   -->
  88.   <action application="set" data="open=false" />
  89.   </condition>
  90. - <condition mday="4" mon="7">
  91. - <!--  independence day
  92.   -->
  93.   <action application="set" data="open=false" />
  94.   </condition>
  95. - <condition wday="2" mday="1-7" mon="9">
  96. - <!--  labor day is the 1st monday in september (the only monday between the 1st and the 7th)
  97.   -->
  98.   <action application="set" data="open=false" />
  99.   </condition>
  100. - <condition wday="2" mweek="2" mon="10">
  101. - <!--  columbus day is the 2nd monday in october
  102.   -->
  103.   <action application="set" data="open=false" />
  104.   </condition>
  105. - <condition mday="11" mon="11">
  106. - <!--  veteran's day
  107.   -->
  108.   <action application="set" data="open=false" />
  109.   </condition>
  110. - <condition wday="5-6" mweek="4" mon="11">
  111. - <!--  thanksgiving is the 4th thursday in november and usually there's an extension for black friday
  112.   -->
  113.   <action application="set" data="open=false" />
  114.   </condition>
  115. - <condition mday="25" mon="12">
  116. - <!--  Christmas
  117.   -->
  118.   <action application="set" data="open=false" />
  119.   </condition>
  120.   </extension>
  121. - <extension name="global-intercept">
  122. - <condition field="destination_number" expression="^886$">
  123.   <action application="answer" />
  124.   <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/global)}" />
  125.   <action application="sleep" data="2000" />
  126.   </condition>
  127.   </extension>
  128. - <extension name="group-intercept">
  129. - <condition field="destination_number" expression="^\*8$">
  130.   <action application="answer" />
  131.   <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/${callgroup})}" />
  132.   <action application="sleep" data="2000" />
  133.   </condition>
  134.   </extension>
  135. - <extension name="intercept-ext">
  136. - <condition field="destination_number" expression="^\*\*(\d+)$">
  137.   <action application="answer" />
  138.   <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/$1)}" />
  139.   <action application="sleep" data="2000" />
  140.   </condition>
  141.   </extension>
  142. - <extension name="redial">
  143. - <condition field="destination_number" expression="^(redial|870)$">
  144.   <action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}" />
  145.   </condition>
  146.   </extension>
  147. - <extension name="global" continue="true">
  148. - <condition field="${call_debug}" expression="^true$" break="never">
  149.   <action application="info" />
  150.   </condition>
  151. - <condition field="${default_password}" expression="^1234$" break="never">
  152.   <action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" />
  153.   <action application="log" data="CRIT Open $${conf_dir}/vars.xml and change the default_password." />
  154.   <action application="log" data="CRIT Once changed type 'reloadxml' at the console." />
  155.   <action application="log" data="CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" />
  156.   <action application="sleep" data="10000" />
  157.   </condition>
  158. - <!--    This is an example of how to auto detect if telephone-event is missing and activate inband detection
  159.      
  160.   -->
  161. - <!--       <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never">
  162.         <action application="set" data="rtp_payload_number=$1"/>
  163.         <anti-action application="start_dtmf"/>
  164.       </condition>
  165.      
  166.   -->
  167. - <condition field="${rtp_has_crypto}" expression="^($${rtp_sdes_suites})$" break="never">
  168.   <action application="set" data="rtp_secure_media=true" />
  169. - <!--  Offer SRTP on outbound legs if we have it on inbound.
  170.   -->
  171. - <!--  <action application="export" data="rtp_secure_media=true"/>
  172.   -->
  173.   </condition>
  174. - <!--   Since we have inbound-late-negotation on by default now the
  175.          above behavior isn't the same so you have to do one extra step.
  176.        
  177.   -->
  178.   <condition field="${endpoint_disposition}" expression="^(DELAYED NEGOTIATION)" />
  179. - <condition field="${switch_r_sdp}" expression="(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)" break="never">
  180.   <action application="set" data="rtp_secure_media=true" />
  181. - <!--  Offer SRTP on outbound legs if we have it on inbound.
  182.   -->
  183. - <!--  <action application="export" data="rtp_secure_media=true"/>
  184.   -->
  185.   </condition>
  186. - <condition>
  187.   <action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}" />
  188.   <action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}" />
  189.   <action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}" />
  190.   <action application="export" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}" />
  191.   </condition>
  192.   </extension>
  193. - <!--  If sip_req_host is not a local domain then this has to be an external sip uri
  194.   -->
  195. - <!--     <extension name="external_sip_uri" continue="true">
  196.       <condition field="source" expression="mod_sofia"/>
  197.       <condition field="${outside_call}" expression="^$"/>
  198.       <condition field="${domain_exists(${sip_req_host})}" expression="true">
  199.         <anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
  200.       </condition>
  201.     </extension>
  202.    
  203.   -->
  204. - <!--  Snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
  205.    
  206.   -->
  207. - <extension name="snom-demo-2">
  208. - <condition field="destination_number" expression="^9001$">
  209.   <action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}" />
  210.   <action application="transfer" data="3000" />
  211.   </condition>
  212.   </extension>
  213. - <extension name="snom-demo-1">
  214. - <condition field="destination_number" expression="^9000$">
  215. - <!-- <key> <light> <label> <user> <host> <profile> <action_name> <action>
  216.   -->
  217.   <action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}" />
  218.   <action application="playback" data="$${hold_music}" />
  219.   </condition>
  220.   </extension>
  221. - <extension name="eavesdrop">
  222. - <condition field="destination_number" expression="^88(\d{4})$|^\*0(.*)$">
  223.   <action application="answer" />
  224.   <action application="eavesdrop" data="${hash(select/${domain_name}-spymap/$1$2)}" />
  225.   </condition>
  226.   </extension>
  227. - <extension name="eavesdrop">
  228. - <condition field="destination_number" expression="^779$">
  229.   <action application="answer" />
  230.   <action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)" />
  231.   <action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)" />
  232.   <action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)" />
  233.   <action application="eavesdrop" data="all" />
  234.   </condition>
  235.   </extension>
  236. - <extension name="call_return">
  237. - <condition field="destination_number" expression="^\*69$|^869$|^lcr$">
  238.   <action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}" />
  239.   </condition>
  240.   </extension>
  241. - <extension name="del-group">
  242. - <condition field="destination_number" expression="^80(\d{2})$">
  243.   <action application="answer" />
  244.   <action application="group" data="delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}" />
  245.   <action application="gentones" data="%(1000, 0, 320)" />
  246.   </condition>
  247.   </extension>
  248. - <extension name="add-group">
  249. - <condition field="destination_number" expression="^81(\d{2})$">
  250.   <action application="answer" />
  251.   <action application="group" data="insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}" />
  252.   <action application="gentones" data="%(1000, 0, 640)" />
  253.   </condition>
  254.   </extension>
  255. - <extension name="call-group-simo">
  256. - <condition field="destination_number" expression="^82(\d{2})$">
  257.   <action application="bridge" data="{leg_timeout=15,ignore_early_media=true}${group(call:$1@${domain_name})}" />
  258.   </condition>
  259.   </extension>
  260. - <extension name="call-group-order">
  261. - <condition field="destination_number" expression="^83(\d{2})$">
  262.   <action application="bridge" data="{leg_timeout=15,ignore_early_media=true}${group(call:$1@${domain_name}:order)}" />
  263.   </condition>
  264.   </extension>
  265. - <extension name="extension-intercom">
  266. - <condition field="destination_number" expression="^8(10[0-4][0-9])$">
  267.   <action application="set" data="dialed_extension=$1" />
  268.   <action application="export" data="sip_auto_answer=true" />
  269.   <action application="bridge" data="user/${dialed_extension}@${domain_name}" />
  270.   </condition>
  271.   </extension>
  272. - <!--  
  273.          dial the extension (1000-1019) for 30 seconds and go to voicemail if the
  274.          call fails (continue_on_fail=true), otherwise hang up after a successful
  275.          bridge (hangup_after_bridge=true)
  276.    
  277.   -->
  278. - <extension name="Local_Extension">
  279. - <condition field="destination_number" expression="^(10[0-4][0-9])$">
  280.   <action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}" />
  281.   <action application="set" data="RECORD_COPYRIGHT=(c) 2011" />
  282.   <action application="set" data="RECORD_SOFTWARE=FreeSWITCH" />
  283.   <action application="set" data="RECORD_ARTIST=FreeSWITCH" />
  284.   <action application="set" data="RECORD_COMMENT=FreeSWITCH" />
  285.   <action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}" />
  286.   <action application="set" data="RECORD_STEREO=true" />
  287.   <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav" />
  288.   <action application="export" data="dialed_extension=$1" />
  289. - <!--  bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app>
  290.   -->
  291.   <action application="bind_meta_app" data="1 b s execute_extension::dx XML features" />
  292.   <action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav" />
  293.   <action application="bind_meta_app" data="3 b s execute_extension::cf XML features" />
  294.   <action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features" />
  295.   <action application="set" data="ringback=${us-ring}" />
  296.   <action application="set" data="transfer_ringback=$${hold_music}" />
  297.   <action application="set" data="call_timeout=30" />
  298. - <!--  <action application="set" data="sip_exclude_contact=${network_addr}"/>
  299.   -->
  300.   <action application="set" data="hangup_after_bridge=true" />
  301. - <!-- <action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/>
  302.   -->
  303.   <action application="set" data="continue_on_fail=true" />
  304.   <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}" />
  305.   <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}" />
  306.   <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}" />
  307.   <action application="hash" data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}" />
  308.   <action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}" />
  309. - <!-- <action application="export" data="nolocal:rtp_secure_media=${user_data(${dialed_extension}@${domain_name} var rtp_secure_media)}"/>
  310.   -->
  311.   <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}" />
  312.   <action application="bridge" data="user/${dialed_extension}@${domain_name}" />
  313.   <action application="answer" />
  314.   <action application="sleep" data="1000" />
  315.   <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}" />
  316.   </condition>
  317.   </extension>
  318. - <extension name="Local_Extension_Skinny">
  319. - <condition field="destination_number" expression="^(11[0-4][0-9])$">
  320.   <action application="set" data="dialed_extension=$1" />
  321.   <action application="export" data="dialed_extension=$1" />
  322.   <action application="set" data="call_timeout=30" />
  323.   <action application="set" data="hangup_after_bridge=true" />
  324.   <action application="set" data="continue_on_fail=true" />
  325.   <action application="bridge" data="skinny/internal/${destination_number}" />
  326.   <action application="answer" />
  327.   <action application="sleep" data="1000" />
  328.   <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}" />
  329.   </condition>
  330.   </extension>
  331. - <extension name="group_dial_sales">
  332. - <condition field="destination_number" expression="^2000$">
  333.   <action application="bridge" data="${group_call(sales@${domain_name})}" />
  334.   </condition>
  335.   </extension>
  336. - <extension name="group_dial_support">
  337. - <condition field="destination_number" expression="^2001$">
  338.   <action application="bridge" data="group/support@${domain_name}" />
  339.   </condition>
  340.   </extension>
  341. - <extension name="group_dial_billing">
  342. - <condition field="destination_number" expression="^2002$">
  343.   <action application="bridge" data="group/billing@${domain_name}" />
  344.   </condition>
  345.   </extension>
  346. - <!--  voicemail operator extension
  347.   -->
  348. - <extension name="operator">
  349. - <condition field="destination_number" expression="^(operator|0)$">
  350.   <action application="set" data="transfer_ringback=$${hold_music}" />
  351.   <action application="transfer" data="1000 XML features" />
  352.   </condition>
  353.   </extension>
  354. - <!--  voicemail main extension
  355.   -->
  356. - <extension name="vmain">
  357. - <condition field="destination_number" expression="^vmain$|^4000$|^\*98$">
  358.   <action application="answer" />
  359.   <action application="sleep" data="1000" />
  360.   <action application="voicemail" data="check default ${domain_name}" />
  361.   </condition>
  362.   </extension>
  363. - <!--  
  364.          This extension is used by mod_portaudio so you can pa call sip:someone@example.com
  365.          mod_portaudio will pass the entire string to the dialplan for routing.
  366.    
  367.   -->
  368. - <extension name="sip_uri">
  369. - <condition field="destination_number" expression="^sip:(.*)$">
  370.   <action application="bridge" data="sofia/${use_profile}/$1" />
  371.   </condition>
  372.   </extension>
  373. - <!--  start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml
  374.    
  375.   -->
  376. - <extension name="nb_conferences">
  377. - <condition field="destination_number" expression="^(30\d{2})$">
  378.   <action application="answer" />
  379.   <action application="conference" data="$1-${domain_name}@default" />
  380.   </condition>
  381.   </extension>
  382. - <extension name="wb_conferences">
  383. - <condition field="destination_number" expression="^(31\d{2})$">
  384.   <action application="answer" />
  385.   <action application="conference" data="$1-${domain_name}@wideband" />
  386.   </condition>
  387.   </extension>
  388. - <extension name="uwb_conferences">
  389. - <condition field="destination_number" expression="^(32\d{2})$">
  390.   <action application="answer" />
  391.   <action application="conference" data="$1-${domain_name}@ultrawideband" />
  392.   </condition>
  393.   </extension>
  394. - <!--  MONO 48kHz conferences
  395.   -->
  396. - <extension name="cdquality_conferences">
  397. - <condition field="destination_number" expression="^(33\d{2})$">
  398.   <action application="answer" />
  399.   <action application="conference" data="$1-${domain_name}@cdquality" />
  400.   </condition>
  401.   </extension>
  402. - <!--  dial the FreeSWITCH conference via SIP
  403.   -->
  404. - <extension name="freeswitch_public_conf_via_sip">
  405. - <condition field="destination_number" expression="^9(888|8888|1616|3232)$">
  406.   <action application="export" data="hold_music=silence" />
  407. - <!--  
  408.              This will take the SAS from the b-leg and send it to the display on the a-leg phone.
  409.              Known working with Polycom and Snom maybe others.
  410.        
  411.   -->
  412. - <!--  <action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )}  \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/>
  413.         <action application="export" data="nolocal:zrtp_secure_media=true"/>
  414.        
  415.   -->
  416.   <action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org" />
  417.   </condition>
  418.   </extension>
  419. - <!--  This extension will start a conference and invite a group.
  420.         At anytime the participant can dial *2 to bridge directly to the boss.
  421.         All other callers are then hung up on.
  422.    
  423.   -->
  424. - <extension name="mad_boss_intercom">
  425. - <condition field="destination_number" expression="^0911$">
  426.   <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1" />
  427.   <action application="set" data="conference_auto_outcall_caller_id_number=0911" />
  428.   <action application="set" data="conference_auto_outcall_timeout=60" />
  429.   <action application="set" data="conference_auto_outcall_flags=mute" />
  430.   <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}" />
  431.   <action application="set" data="sip_exclude_contact=${network_addr}" />
  432.   <action application="conference_set_auto_outcall" data="${group_call(sales)}" />
  433.   <action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}" />
  434.   </condition>
  435.   </extension>
  436. - <!--  This extension will start a conference and invite a few of people.
  437.         At anytime the participant can dial *2 to bridge directly to the boss.
  438.         All other callers are then hung up on.
  439.    
  440.   -->
  441. - <extension name="mad_boss_intercom">
  442. - <condition field="destination_number" expression="^0912$">
  443.   <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss2" />
  444.   <action application="set" data="conference_auto_outcall_caller_id_number=0912" />
  445.   <action application="set" data="conference_auto_outcall_timeout=60" />
  446.   <action application="set" data="conference_auto_outcall_flags=mute" />
  447.   <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}" />
  448.   <action application="set" data="sip_exclude_contact=${network_addr}" />
  449.   <action application="conference_set_auto_outcall" data="loopback/9664" />
  450.   <action application="conference" data="madboss_intercom2@default+flags{endconf|deaf}" />
  451.   </condition>
  452.   </extension>
  453. - <!-- This extension will start a conference and invite several people upon entering
  454.   -->
  455. - <extension name="mad_boss">
  456. - <condition field="destination_number" expression="^0913$">
  457. - <!-- These params effect the outcalls made once you join
  458.   -->
  459.   <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss" />
  460.   <action application="set" data="conference_auto_outcall_caller_id_number=0911" />
  461.   <action application="set" data="conference_auto_outcall_timeout=60" />
  462.   <action application="set" data="conference_auto_outcall_flags=none" />
  463. - <!-- <action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>
  464.   -->
  465. - <!-- Add as many of these as you need, These are the people you are going to call
  466.   -->
  467.   <action application="conference_set_auto_outcall" data="loopback/9664" />
  468.   <action application="conference" data="madboss3@default" />
  469.   </condition>
  470.   </extension>
  471. - <!--  a sample IVR  
  472.   -->
  473. - <extension name="ivr_demo">
  474. - <condition field="destination_number" expression="^5000$">
  475.   <action application="answer" />
  476.   <action application="sleep" data="2000" />
  477.   <action application="ivr" data="demo_ivr" />
  478.   </condition>
  479.   </extension>
  480. - <!--  Create a conference on the fly and pull someone in at the same time.
  481.   -->
  482. - <extension name="dynamic_conference">
  483. - <condition field="destination_number" expression="^5001$">
  484.   <action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org" />
  485.   </condition>
  486.   </extension>
  487. - <extension name="rtp_multicast_page">
  488. - <condition field="destination_number" expression="^pagegroup$|^7243$">
  489.   <action application="answer" />
  490.   <action application="esf_page_group" />
  491.   </condition>
  492.   </extension>
  493. - <!--  
  494.          Parking extensions... transferring calls to 5900 will park them in a queue.
  495.    
  496.   -->
  497. - <extension name="park">
  498. - <condition field="destination_number" expression="^5900$">
  499.   <action application="set" data="fifo_music=$${hold_music}" />
  500.   <action application="fifo" data="5900@${domain_name} in" />
  501.   </condition>
  502.   </extension>
  503. - <!--  
  504.          Parking pickup extension.  Calling 5901 will pickup the call.
  505.    
  506.   -->
  507. - <extension name="unpark">
  508. - <condition field="destination_number" expression="^5901$">
  509.   <action application="answer" />
  510.   <action application="fifo" data="5900@${domain_name} out nowait" />
  511.   </condition>
  512.   </extension>
  513. - <!--  
  514.          Valet park retrieval, works with valet_park extension below.
  515.          Retrieve a valet parked call by dialing 6000 + park number + #
  516.    
  517.   -->
  518. - <extension name="valet_park">
  519. - <condition field="destination_number" expression="^(6000)$">
  520.   <action application="answer" />
  521.   <action application="valet_park" data="valet_parking_lot ask 1 11 10000 ivr/ivr-enter_ext_pound.wav" />
  522.   </condition>
  523.   </extension>
  524. - <!--  
  525.          Valet park 6001-6099.  Blind x-fer to 6001, 6002, etc. to valet park the call.
  526.          Dial 6001, 6002, etc. to retrieve a call that is already valet parked.
  527.          After call is retrieved, park extension is free for another call.
  528.    
  529.   -->
  530. - <extension name="valet_park">
  531. - <condition field="destination_number" expression="^((?!6000)60\d{2})$">
  532.   <action application="answer" />
  533.   <action application="valet_park" data="valet_parking_lot $1" />
  534.   </condition>
  535.   </extension>
  536. - <!--  This extension is used with Snom phones.  
  537.        
  538.         Set a function key to park+lot (lot being a number or name.)
  539.         Set type to Park+Orbit.  You can then park and pickup using
  540.         the softkey on the phone.  Should work with other phones.
  541.    
  542.   -->
  543. - <extension name="park">
  544.   <condition field="source" expression="mod_sofia" />
  545. - <condition field="destination_number" expression="park\+(\d+)">
  546.   <action application="fifo" data="$1@${domain_name} in undef $${hold_music}" />
  547.   </condition>
  548.   </extension>
  549. - <!--  The extension is parking pickup with a to param of the fifo we are calling
  550.         Some phones send things like orbit= and you can extract that info.
  551.    
  552.   -->
  553. - <extension name="unpark">
  554.   <condition field="source" expression="mod_sofia" />
  555.   <condition field="destination_number" expression="^parking$" />
  556. - <condition field="${sip_to_params}" expression="fifo\=(\d+)">
  557.   <action application="answer" />
  558.   <action application="fifo" data="$1@${domain_name} out nowait" />
  559.   </condition>
  560.   </extension>
  561. - <!--        This extension is used with Linksys phones.
  562.  
  563.        Set a Phone tab option Call Park Serv to yes. You can park and
  564.        pickup using soft keys "park" and "unpark" found during
  565.        active call when moving navigation button. The other option
  566.        is to use phone's star codes (defaults to *38 and *39).
  567.    
  568.   -->
  569. - <extension name="park">
  570.   <condition field="source" expression="mod_sofia" />
  571.   <condition field="destination_number" expression="callpark" />
  572. - <condition field="${sip_refer_to}">
  573. - <expression>
  574. - <![CDATA[ <sip:callpark@${domain_name};orbit=(\d+)>
  575.   ]]>
  576.   </expression>
  577.   <action application="fifo" data="$1@${domain_name} in undef $${hold_music}" />
  578.   </condition>
  579.   </extension>
  580. - <!--        This extension is used with Linksys phones.
  581.  
  582.        The extension is parking pickup with a to param of the fifo
  583.        we are calling. Linksys sends orbit=<parkingslotnumber>
  584.        and we extract that info.
  585.    
  586.   -->
  587. - <extension name="unpark">
  588.   <condition field="source" expression="mod_sofia" />
  589.   <condition field="destination_number" expression="pickup" />
  590. - <condition field="${sip_to_params}" expression="orbit\=(\d+)">
  591.   <action application="answer" />
  592.   <action application="fifo" data="$1@${domain_name} out nowait" />
  593.   </condition>
  594.   </extension>
  595. - <!--  Here are some examples of how to override the ringback heard by the
  596.         far end.  You have two variables that you can use to override this.
  597.        
  598.         ringback          - used when a call isn't answered. (early media)
  599.         transfer_ringback - used when the call is already answered. (post answer)
  600.    
  601.   -->
  602. - <!--  Demonstration of how to override the ringback in various situations
  603.   -->
  604. - <extension name="wait">
  605. - <condition field="destination_number" expression="^wait$">
  606.   <action application="pre_answer" />
  607.   <action application="sleep" data="20000" />
  608.   <action application="answer" />
  609.   <action application="sleep" data="1000" />
  610.   <action application="playback" data="voicemail/vm-goodbye.wav" />
  611.   <action application="hangup" />
  612.   </condition>
  613.   </extension>
  614. - <extension name="fax_receive">
  615. - <condition field="destination_number" expression="^9178$">
  616.   <action application="answer" />
  617.   <action application="playback" data="silence_stream://2000" />
  618.   <action application="rxfax" data="$${temp_dir}/rxfax.tif" />
  619.   <action application="hangup" />
  620.   </condition>
  621.   </extension>
  622. - <extension name="fax_transmit">
  623. - <condition field="destination_number" expression="^9179$">
  624.   <action application="txfax" data="$${temp_dir}/txfax.tif" />
  625.   <action application="hangup" />
  626.   </condition>
  627.   </extension>
  628. - <!--  Send a 180 and let the far end generate ringback.
  629.   -->
  630. - <extension name="ringback_180">
  631. - <condition field="destination_number" expression="^9180$">
  632.   <action application="ring_ready" />
  633.   <action application="sleep" data="20000" />
  634.   <action application="answer" />
  635.   <action application="sleep" data="1000" />
  636.   <action application="playback" data="voicemail/vm-goodbye.wav" />
  637.   <action application="hangup" />
  638.   </condition>
  639.   </extension>
  640. - <!--  Send a 183 and send uk-ring as the ringtone. (early media)
  641.   -->
  642. - <extension name="ringback_183_uk_ring">
  643. - <condition field="destination_number" expression="^9181$">
  644.   <action application="set" data="ringback=$${uk-ring}" />
  645.   <action application="bridge" data="{ignore_early_media=true}loopback/wait" />
  646.   </condition>
  647.   </extension>
  648. - <!--  Send a 183 and use music as the ringtone. (early media)
  649.   -->
  650. - <extension name="ringback_183_music_ring">
  651. - <condition field="destination_number" expression="^9182$">
  652.   <action application="set" data="ringback=$${hold_music}" />
  653.   <action application="bridge" data="{ignore_early_media=true}loopback/wait" />
  654.   </condition>
  655.   </extension>
  656. - <!--  Answer the call and use music as the ringtone. (post answer)
  657.   -->
  658. - <extension name="ringback_post_answer_uk_ring">
  659. - <condition field="destination_number" expression="^9183$">
  660.   <action application="set" data="transfer_ringback=$${uk-ring}" />
  661.   <action application="answer" />
  662.   <action application="bridge" data="{ignore_early_media=true}loopback/wait" />
  663.   </condition>
  664.   </extension>
  665. - <!--  Answer the call and use music as the ringtone. (post answer)
  666.   -->
  667. - <extension name="ringback_post_answer_music">
  668. - <condition field="destination_number" expression="^9184$">
  669.   <action application="set" data="transfer_ringback=$${hold_music}" />
  670.   <action application="answer" />
  671.   <action application="bridge" data="{ignore_early_media=true}loopback/wait" />
  672.   </condition>
  673.   </extension>
  674. - <extension name="ClueCon">
  675. - <condition field="destination_number" expression="^9191$">
  676.   <action application="set" data="effective_caller_id_name=ClueCon IVR" />
  677.   <action application="bridge" data="sofia/$${domain}/2000@bkw.org" />
  678.   </condition>
  679.   </extension>
  680. - <extension name="show_info">
  681. - <condition field="destination_number" expression="^9192$">
  682.   <action application="answer" />
  683.   <action application="info" />
  684.   <action application="sleep" data="250" />
  685.   <action application="hangup" />
  686.   </condition>
  687.   </extension>
  688. - <extension name="video_record">
  689. - <condition field="destination_number" expression="^9193$">
  690.   <action application="answer" />
  691.   <action application="record_fsv" data="$${temp_dir}/testrecord.fsv" />
  692.   </condition>
  693.   </extension>
  694. - <extension name="video_playback">
  695. - <condition field="destination_number" expression="^9194$">
  696.   <action application="answer" />
  697.   <action application="play_fsv" data="$${temp_dir}/testrecord.fsv" />
  698.   </condition>
  699.   </extension>
  700. - <extension name="delay_echo">
  701. - <condition field="destination_number" expression="^9195$">
  702.   <action application="answer" />
  703.   <action application="delay_echo" data="5000" />
  704.   </condition>
  705.   </extension>
  706. - <extension name="echo">
  707. - <condition field="destination_number" expression="^9196$">
  708.   <action application="answer" />
  709.   <action application="echo" />
  710.   </condition>
  711.   </extension>
  712. - <extension name="milliwatt">
  713. - <condition field="destination_number" expression="^9197$">
  714.   <action application="answer" />
  715.   <action application="playback" data="{loops=-1}tone_stream://%(251,0,1004)" />
  716.   </condition>
  717.   </extension>
  718. - <extension name="tone_stream">
  719. - <condition field="destination_number" expression="^9198$">
  720.   <action application="answer" />
  721.   <action application="playback" data="{loops=10}tone_stream://path=${conf_dir}/tetris.ttml" />
  722.   </condition>
  723.   </extension>
  724. - <!--  install zrtp_agent.lua into scripts (ZRTP == 9787)
  725.   -->
  726. - <extension name="zrtp_enrollement">
  727. - <condition field="destination_number" expression="^9787$">
  728.   <action application="lua" data="zrtp_agent.lua" />
  729.   </condition>
  730.   </extension>
  731. - <!--  You will no longer hear the bong tone.  The wav file is playing stating the call is secure.
  732.         The file will not play unless you have both TLS and SRTP active.
  733.    
  734.   -->
  735. - <extension name="hold_music">
  736.   <condition field="destination_number" expression="^9664$" />
  737. - <condition field="${rtp_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
  738.   <action application="answer" />
  739.   <action application="execute_extension" data="is_secure XML features" />
  740.   <action application="playback" data="$${hold_music}" />
  741.   <anti-action application="set" data="zrtp_secure_media=true" />
  742.   <anti-action application="answer" />
  743.   <anti-action application="playback" data="silence_stream://2000" />
  744.   <anti-action application="execute_extension" data="is_zrtp_secure XML features" />
  745.   <anti-action application="playback" data="$${hold_music}" />
  746.   </condition>
  747.   </extension>
  748. - <extension name="laugh break">
  749. - <condition field="destination_number" expression="^9386$">
  750.   <action application="answer" />
  751.   <action application="sleep" data="1500" />
  752.   <action application="playback" data="phrase:funny_prompts" />
  753.   <action application="hangup" />
  754.   </condition>
  755.   </extension>
  756. - <!--  You can place files in the default directory to get included.
  757.    
  758.   -->
  759.   <X-PRE-PROCESS cmd="include" data="default/*.xml" />
  760. - <!--     <extension name="refer">
  761.       <condition field="${sip_refer_to}">
  762.         <expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
  763.       </condition>
  764.       <condition field="${sip_refer_to}">
  765.         <expression><![CDATA[<sip:(.*)@(.*)>]]></expression>
  766.         <action application="set" data="refer_user=$1"/>
  767.         <action application="set" data="refer_domain=$2"/>
  768.         <action application="info"/>
  769.         <action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
  770.       </condition>
  771.     </extension>
  772.    
  773.   -->
  774. - <!--  This is an example of how to override the RURI on an outgoing invite to a registered contact.
  775.    
  776.   -->
  777. - <!--     <extension name="ruri">
  778.       <condition field="destination_number" expression="^ruri$">
  779.         <action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/>
  780.       </condition>
  781.     </extension>
  782.    
  783.     <extension name="7004">
  784.       <condition field="destination_number" expression="^7004$">
  785.         <action application="set" data="ruri_profile=default"/>
  786.         <action application="set" data="ruri_user=2000"/>
  787.         <action application="set" data="ruri_contact=1001@${domain_name}"/>
  788.         <action application="execute_extension" data="ruri"/>
  789.       </condition>
  790.     </extension>
  791.    
  792.   -->
  793. - <extension name="enum">
  794.   <condition field="${module_exists(mod_enum)}" expression="true" />
  795. - <condition field="destination_number" expression="^(.*)$">
  796.   <action application="transfer" data="$1 enum" />
  797.   </condition>
  798.   </extension>
  799.   </context>
  800.   </include>