Cisco Unified CME Basic Automatic Call Distribution and Auto Attendant Service
======================================================================

This Feature is supported in Cisco IOS 12.4 mainline, 12.4(4)XC, 12.4(9)T, 12.3(14)T, 12.3(11)XL and later releases 

For Cisco Unified CME 3.2.1 and later, basic automatic call distribution (B-ACD) and auto attendant (AA) service is
available to provide the following:
 *  A menu for outside callers with options that allow one-key dialing and extension-number access
 *  Call queuing
 *  Tools for obtaining call statistics

Cisco Unified CME B-ACD and AA service (hereinafter referred to as Cisco Unified CME B-ACD) is configured using ephone hunt groups and Tool Command Language (Tcl) scripts: an AA script that handles AA call flow and a call queue script that directs call queue traffic to available ephone-dns in an ephone hunt group.

The AA script provides an audio menu with up to four options. Three of these options provide the ability to transfer callers to the pilot numbers of ephone hunt groups. The remaining option triggers an audio message that tells callers to enter an extension number. For example, callers to a newspaper might hear "Thank you for calling the Times" If you know your party's extension, press one; to place an advertisement or subscribe to the Times, press two; for the editorial department, press three; for the operator, press 0. Callers who do not select an option will hear the greeting and menu options repeated. If the number of retries exceeds a configurable number of retries (default is 4,) the call will automatically be transferred to operator hunt-group. 

Cisco Unified CME B-ACD operation is based on ephone hunt group configurations. When a caller selects a menu option, the AA script is instructed to either allow callers to enter an extension number or call the corresponding ephone hunt groups pilot number. If it is latter, then the call queue script is activated and the call is placed in a queue so it can to be transferred to an ephone-dn when it becomes available. Note that up to twenty ephone-dns can be configured per ephone hunt group.

Each of the ephone-dns can be assigned to sets of ephones in meaningful ways. For example, the reporters at the Times might each have a phone with a button configured with an ephone-dn for personal calls and a second button configured with ephone-dns listed under the ephone hunt group that handles calls to the editorial department (menu option 2). When callers select option 2, their call will be forwarded to a call queue, sent to an ephone-dn when it becomes available, and ring on the second button of all of the reporters phones.

After a menu selection has been made, the AA and call queue scripts work together to do the following:
 *  Add each call to the call queue of the selected menu options ephone hunt group. Note that the length of the
    call queues is set by configuring the call queue script parameters.
 *  Periodically attempt to transfer calls to an available ephone-dn in menu selections ephone hunt group.
 *  Issue a second greeting at designated intervals. For example, you could configure Cisco Unified CME B-ACD to repeat
    every 30 seconds, Please stay on the line, a representative will be with you.
 *  Transfer calls to voice mail after they have been in a call queue for specified period of time.

The AA and call queue scripts are configured using a set of call application voice commands that allow you to enter file names and set parameters, such as the length of call queues. Editing of a scripts contents is not recommended or supported by the Cisco Technical Assistance Center (TAC). If you want Cisco to develop customized scripts for you, contact the developer support group at developer-support@cisco.com. This is a fee-based service. If you are interested in developing Tcl scripts yourself, you can join the Cisco Developer Support Program. This fee-based service provides you with a consistent level of support and provides an easy process for opening, updating, and tracking issues using the Online Case tracking tool available at Cisco.com.

     Note: To participate in the Cisco Developer Support Program, you must have a signed Developer Support
      Agreement. For more details and for access to this agreement, go to
      http://www.cisco.com/warp/public/570/index.html, or contact developer-support@cisco.com.

In addition to basic call answering and distribution, the Cisco Unified CME B-ACD service provides the
following features in Cisco 3.2.3 and later versions:
* Cisco Unified CME B-ACD Drop-Through Mode
* Cisco Unified CME B-ACD Multiple Auto-Attendant Services

In Cisco Unified CME 3.2.3 and later versions, a drop-through mode can be selected for an AA service.
When an AA is configured for drop-through mode, the AA sends incoming calls directly to a call queue.
Once in the queue, a caller hears ringback if an agent is available or music on hold (MOH) if all agents are busy. If a prompt for drop-through mode is configured, a caller hears the prompt before being sent to the queue as described. Note that customers cannot make interactive choices in drop-through mode;calls are simply answered and routed to a call queue. Refer to the documentation for additional details and configuration.

Cisco Unified CME 3.2.3 and later versions support the creation of multiple AA services that feed into a single call-queue application that services up to ten hunt groups (individual call queues). Each of the AAs can be set up to use particular options or to reach particular hunt groups, and AAs can share hunt groups.
For instance, you can have three AAs that each use three hunt groups, or you can have five AAs that share some of the nine hunt groups, or nine AAs that each use one hunt group. The tenth hunt group is always reserved for a shared operator hunt group. This flexibility allows companies to create different automatic attendant treatment for different classes of callers. Refer to the documentation for additional details and configuration.

Download Tcl Scripts and Audio Prompts
=======================================
In this task, you prepare the script files and prompt files that are necessary for your Cisco Unified CME B-ACD service.
SUMMARY STEPS
1. Download the Cisco Unified CME B-ACD tar archives to a TFTP server that is accessible to the Cisco Unified CME router.
2. Rerecord audio files if necessary.
3. enable
4. archive tar /xtract source-url flash:

Files required for this feature to work
=======================================
TCL IVR Script Files:

app-b-acd-2.1.2.2.tcl ;B-ACD Call Queuing application Script
app-b-acd-aa-2.1.2.2.tcl ;B-ACD Auto Attendant Script

Audio Files:

en_bacd_welcome.au
en_bacd_options_menu.au
en_bacd_invalidoption.au
en_bacd_enter_dest.au
en_bacd_disconnect.au
en_bacd_allagentsbusy.au
en_bacd_music_on_hold.au
en_bacd_xferto_operator.au

Monitoring Cisco Unified CME B-ACD Activity
===================================
Two call report methods allow you to monitor call activity. One is the show ephont-hunt command, which outputs data with descriptions. The other uses trivial file transfer protocol (TFTP) to transfer raw data automatically to files. The data can be merged into chart or graph for easier reading by an application such as Microsoft Access or Excel.

The show ephone-hunt command displays call statistics for ephone hunt groups that have been
configured with the "statistics collect" command. The "statistics collect" command starts the gathering of call statistics. The collection process starts when the command is issued, and statistics are sent into an array that holds the data for one week (168 hours). After this period, the statitstic are sent to a buffer and a new set of statistics are sent to the array. Statistics are added to the buffer weekly and can only be removed with the no statistic collect command. The statistics collection must be active for each ephone hunt group. Otherwise, there will be no statistics for the ephone hunt group in the array and the show hunt-group command will have nothing to display. If the statistic collect is not issued for an ephone hunt group, then an error message will occur. 

For example:

Router(config)# show ephone-hunt 1 stat last 1 hour
Hunt Group 1 stat collect not enabled

To TFTP transfer statistics from the statistics array to a set of files, you must do the following:
 * Create a group of files to which the statistic will be sent.
 * Enable statistics collection for the desired ephone hunt groups.
 * Configure the statistics-gathering parameters.

Configuration Example of the Cisco Unified CME B-ACD Service
====================================================
The following configuration is for a Cisco Unified CME B-ACD service with two ephone hunt group menu
options. When callers press 3, they will be transferred to the pilot number for ephone hunt group 1; pressing 4 transfers callers to the pilot number for ephone hunt group 2. The pilot number to the Cisco Unified CME B-ACD AA script is 8005550100. Ephone hunt group 1 supports four ephone-dns (list 1001...1004 command); ephone hunt group 2, ten ephone-dns (list 200...2010 command). Each of set of ephone hunt groups ephone-dns are overlaid on button 1 and button 2 on ephones 1 through 14. If a callers press 5, thet will be permitted to enter their extension directly. If 3 is pressed, the call will go to pilot number 1111 (and then go to one of ephone hunt group 1 ephone-dns). If 4 is pressed, the call will go to pilot number 2222 (and then go to one of ephone hunt group 2 ephone-dns). Ephone-dns are selected by their availability and by the search methods used by each ephone hunt group. For this example, calls to ephone hunt group 1 will go to an available ephone-dn that has been idle the longest (ephone-hunt 1 longest-idle command).
If callers press 3 or 4, their calls will be transferred to the corresponding ephone hunt group's call queue. In this example, each ephone hunt group is configured to have up to ten calls in their individual queues. If all of the ephone-dns are unavailable, the calls will wait in queues and try to transfer to ephone hunt group pilot numbers every 15 seconds. As they are waiting, they will hear a second greeting every 60 seconds. After 600 seconds has lapsed, they will be sent to voice mail (5000). If voice mail is busy, the call will attempt to reach voice mail two times every 15 seconds. If voice mail is still unavailable, the caller will hear a busy signal. Because the ephone-dns in this example are overlaid (for example, button 1o1,2,3,4), calls that go through will ring on all available ephones configured with the available ephone-dn.

telephony-service
hunt-group report url [prefix tftp://ip-address/directory-name.../prefix | suffix from-number to
to-number]
hunt-group report every <number> hours
(Optional) hunt-group report delay <number> hour
exit

ephone-dn 1
number 1001
.
.
.
ephone-dn 4
number 1004

ephone-dn 5
number 2001
.
.
.
ephone-dn 14
number 2010

ephone 1
mac-address 1111.1111.1111
button 1o1,2,3,4

ephone 4
mac-address 2222.2222.2222
button 1o1,2,3,4

ephone 5
mac-address 4444.4444.4444
button 1o5,6,7,8,9
button 2o10,11,12,13,14
.
.
.
ephone 14
mac-address 1414.1414.1414
button 1o5,6,7,8,9
button 2o10,11,12,13,14
!
ephone-hunt 1 longest-idle
pilot 1111
list 1001,1002,1003,1004
timeout 18
statistics collect ;enables statistics collection
!
ephone-hunt 2 longest-idle
pilot 2222
list 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010
timeout 18
statistics collect
!
The following example contains the commands to configure B-ACD with IOS releases 12.3(14)T and higher:
====================================================
dial-peer voice 1000 pots
service aa
incoming called-number 8005551000
port 1/0:23

application
 service aa flash:app-b-acd-aa-2.1.2.2.tcl      
! defines the application-name of the AA script as aa
  paramspace english language en
! specifies language as English
  paramspace english index 1
  paramspace english location flash:
! declares location of audio files
  param service-name queue
! associates AA script with queue stript
  param handoff-string aa
! specifies the AA application name that will be used as a handoff string to the call-queue script.
  param aa-pilot 8005550100 
! set access number to Cisco Unified CME B-ACD
  param number-of-hunt-grps 2
!declares the number of ephone hunt group menu options. range 1 - 3
  param second-greeting-time 60
! set time interval CME B-ACD waits before playing second (all-agents busy) greeting, range 30 - 120 seconds
  param call-retry-timer 15
! set time interval in which call in queue can attempt to access available ephone-dns and voice mail, range 5 - 30 seconds
  param max-time-call-retry 600
! set maximum time calls can wait in queue, range 60 - 3600 seconds
  param voice-mail 5000
! declares B-ACD voice mail pilot number
  param max-time-vm-retry 2
! maximum times CME B-ACD can attempt to transfer call to voicemail, range 1 - 3
  param dial-by-extension-option 5
!declares menu option number for extension dial. This should not overlap with hunt group options
    param max-extension-length 4 
! declares the maximum length of the extension that the user can dial when dial-by-extension-option is chosen.
! The default value of this parameter is 5. If max-extension-length is set to 0 then there will not be any restriction for number of digits in an extension    
! exercise caution before setting the max-extension-length to 0 as this may let the user make unauthorized calls 
    param welcome-prompt _aa1_welcome.au 
! declares the welcome prompt. The actual file in the flash should be en_aa1_welcome.au
   param menu-timeout 6
! The default value of this parameter is 4. Range is 1 ? 10. If the number of retries for playing the greeting and menu options exceeds the menu-timeout parameter, the call will be transferred to the operator hunt group. The operator hunt-group is the highest numbered aa-hunt. For example, in sample below the operator hunt group is aa-hunt4, pilot number 2222.

 service queue flash:app-b-acd-2.1.2.2.tcl
!defines the application-name of the queue script as gqueueh 
  param queue-len 10
!declares the queue length per ephone hunt group, range 10 - 30
  param number-of-hunt-grps 2
!number of hunt-group menu options, range 1 - 3. Should be same as configured in the AA application
  param aa-hunt3 1111
!declares menu option 3 and associates it with the ephone hunt group pilot number 1111
  param aa-hunt4 2222
  param queue-manager-debugs 1
!enables collection of debugging information. 0 disables collection of debugging information
!Enable debug voip ivr script can also be enabled to view the debugs 

The following example contains the commands to configure B-ACD with IOS releases prior to 12.3(14)T:
====================================================

dial-peer voice 1000 pots
application aa
incoming called-number 8005551000
port 1/0:23

call application voice aa flash:app-b-acd-aa-2.1.2.2.tcl 
! defines the application-name of the AA script as aa
call application voice aa language 1 en
! specifies language as English
call application voice aa set-location en 0 flash: 
! declares location of audio files
call application voice aa aa-pilot 8005550100 
! set access number to Cisco Unified CME B-ACD
call application voice aa call-retry-timer 15 
! set time interval in which call in queue can attempt to access available ephone-dns and voice mail, range 5 - 30 seconds
call application voice aa second-greeting-time 60 
! set time interval CME B-ACD waits before playing second (all-agents busy) greeting, range 30 - 120 seconds
call application voice aa max-time-call-retry 600
!maximum time calls can wait in queue, range 60 - 3600 seconds
call application voice aa max-time-vm-retry 2 
!maximum time calls can attempt to be transferred to voicemail, range 1 - 3
call application voice aa service-name queue 
!associates AA script with queue stript
call application voice aa handoff-string 
!specifies the AA application name that will be used as a handoff string to the call-queue script.
call application voice aa dial-by-extension-option 5 
!declares menu option number for extension dial. This should not overlap with hunt group options
call application voice aa voice-mail 5000
!declares B-ACD voice mail pilot number
call application voice aa number-of-hunt-grps 2 
!declares the number of ephone hunt group menu options. range 1 - 3
call application voice aa welcome-prompt _aa1_welcome.au 
! declares the welcome prompt. The actual file in the flash should be en_aa1_welcome.au
call application voice aa max-extension-length 4 
!declares the maximum length of the extension that the user can dial when dial-by-extension-option is chosen.
! The default value of this parameter is 5. If max-extension-length is set to 0 then there will not be any restriction for number of digits in an extension    
! exercise caution before setting the max-extension-length to 0 as this may let the user make unauthorized calls 
call application voice queue flash:app-b-acd-2.1.2.2.tcl 
!defines the application-name of the queue script as gqueueh 
call application voice queue queue-len 10 
!declares the queue length per ephone hunt group, range 10 - 30
call application voice queue aa-hunt3 1111 
!declares menu option 3 and associates it with the ephone hunt group pilot number 1111
call application voice queue aa-hunt4 2222
call application voice queue number-of-hunt-grps 2 
!number of hunt-group menu options, range 1 - 3. Should be same as configured in the AA application
call application voice queue queue-manager-debugs 1 
!enables collection of debugging information. 0 disables collection of debugging information
!Enable debug voip ivr script can also be enabled to view the debugs 

Troubleshooting Tips
====================
Use the debug voip ivr script command to display debugging messages for the AA script. Note that
you must first enable the collection of call queue data from the Cisco Unified CME B-ACD call queue
script with the call application voice queue-manager-debugs command.

To remove the AA application, issue the no service command under the AA dial peers. Prior to 12.3(14)T, 
issue the no application command under the AA dial peers to remove the AA application.

To stop the call queue application script, use the call applications session stop command.
Also note that to AA application has to be removed before stopping call queue application script because a
new incoming call will automatically start the call queuing application even if it has been stopped using the call application session stop CLI. 
If the call queuing application is stopped when the calls are in the queue, the calls in the queue will be dropped.


