IVR in demo config

Let's first have a look at the IVR that answers extension 5000 of the demo configuration. In /usr/local/freeswitch/conf/dialplan/default.xml dialplan it is defined as follows:

 
    <extension name="ivr_demo">   
      <condition field="destination_number" expression="^5000$"> 
        <action application="answer"/> 
        <action application="sleep" data="2000"/> 
        <action application="ivr" data="demo_ivr"/> 
      </condition> 
    </extension> 

This is easily one of the most exercised single snippets of FreeSWITCH configuration, because is so easy to use for testing purposes after a fresh installation. The relevant line is <action application="ivr" data="demo_ivr"/>, which will execute the "ivr" dialplan application, giving the string "demo_ivr" as argument.

The dialplan application "ivr" will look into FreeSWITCH configuration, searching for a voice menu where the "name" field has the value "demo_ivr". In this case, it will find it in the XML file /usr/local/freeswitch/conf/ivr_menus/demo_ivr.xml, located in the default voice menus configuration directory. The filename can be completely different; what is important is the value of the "name" field of the menu.

The voice menu "demo_ivr" has been written to exercise many features that constitute the building blocks of an interactive system: originating and bridging a call, doing an echo test, playing music on hold, connecting to one of the internal registered phones, playing a voice sub-menu, returning to the main menu, transferring to another extension in dialplan, and so on:

 
<include>   
      greet-long="phrase:demo_ivr_main_menu"   
  <menu name="demo_ivr"   
      greet-short="phrase:demo_ivr_main_menu_short"   
      invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"   
      exit-sound="voicemail/vm-goodbye.wav"   
      confirm-macro=""   
      confirm-key=""   
      tts-engine="flite"   
      tts-voice="rms"   
      confirm-attempts="3"   
      timeout="10000"   
      inter-digit-timeout="2000"   
      max-failures="3"   
      max-timeouts="3"   
      digit-len="4">   
    <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/[email protected]"/>   
    <entry action="menu-exec-app" digits="2" param="transfer 9196 XML default"/>    <!-- FS echo -->   
    <entry action="menu-exec-app" digits="3" param="transfer 9664 XML default"/>    <!-- MOH -->   
    <entry action="menu-exec-app" digits="4" param="transfer 9191 XML default"/>    <!-- ClueCon -->   
    <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>       <!-- Screaming monkeys -->   
    <entry action="menu-sub" digits="6" param="demo_ivr_submenu"/>                   
    <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML features"/>   
    <entry action="menu-top" digits="9"/>          <!-- Repeat this menu -->   
  </menu>   
<!-- ----------------------------------------------------------- --> 
  <menu name="demo_ivr_submenu"   
      greet-long="phrase:demo_ivr_sub_menu"   
      greet-short="phrase:demo_ivr_sub_menu_short"   
      invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"   
      exit-sound="voicemail/vm-goodbye.wav"   
      timeout="15000"   
      max-failures="3"   
      max-timeouts="3">   
    <entry action="menu-top" digits="*"/>   
   </menu>   
</include>   
 

The general workingsare probably already clear on first read. Also, please test it; you'll see that as time passes, it will become very familiar. In the next section, we'll look at the usage of each argument field that determines the voice XML "menu" behavior, and how to add "entries" to it (for example, actions that will be executed by the voice menu when the caller dials some DTMFs).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.76.89