cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
581
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Edgar Almonte on 05-04-2010 01:55:14 PM
Hello,
 
I downloaded "Latest VXML Quickstart guide samples.zip" from the Cisco website and I am trying to test the TCL script. The script is loaded in my router and I can call in and hear the audio files but I dont remember how to configure variables from the CLI. The script uses a variable called "acme-sales" that needs to be set from the CLI but I cant find out how to do that. Below is the TCL script.
 

# Script Version: 1.0.0
# Script Name: acme_hybrid
#
#------------------------------------------------------------------------------
#
# Copyright (c) 2003 by Cisco Systems, Inc.
# All rights reserved.
#
# SAMPLE APPLICATION AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND BY
# CISCO, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
# OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, SATISFACTORY
# QUALITY OR ARISING FROM A COURSE OF DEALING, LAW, USAGE, OR TRADE PRACTICE. CISCO TAKES
# NO RESPONSIBILITY REGARDING ITS USAGE IN AN APPLICATION. THE APPLICATION IS PROVIDED
# AS AN EXAMPLE ONLY, THEREFORE CISCO DOES NOT MAKE ANY REPRESENTATIONS REGARDING ITS
# RELIABILITY, SERVICEABILITY, OR FUNCTION. IN NO EVENT DOES CISCO WARRANT THAT THE
# SOFTWARE IS ERROR FREE OR THAT CUSTOMER WILL BE ABLE TO OPERATE THE SOFTWARE WITHOUT
# PROBLEMS OR INTERRUPTIONS. NOR DOES CISCO WARRANT THAT THE SOFTWARE OR ANY EQUIPMENT
# ON WHICH THE SOFTWARE IS USED WILL BE FREE OF VULNERABILITY TO INTRUSION OR ATTACK.
# THIS SAMPLE APPLICATION IS NOT SUPPORTED BY CISCO IN ANY MANNER. CISCO DOES NOT ASSUME
# ANY LIABILITY ARISING FROM THE USE OF THE APPLICATION. FURTHERMORE, IN NO EVENT SHALL
# CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INCIDENTAL OR CONSEQUENTIAL DAMAGES, LOST
# PROFITS, OR LOST DATA, OR ANY OTHER INDIRECT DAMAGES EVEN IF CISCO OR ITS SUPPLIERS
# HAVE BEEN INFORMED OF THE POSSIBILITY THEREOF.
#
#------------------------------------------------------------------------------
#
# Description:
#
# This sample TCL-VXML hybrid application demonstrates how to separate the VXML
# portion to handle the IVR and the TCL portion to handle call control. The VXML
# dialogs will play prompts and collect inputs. The main TCL script handles the
# call control portion which provides the equivalent function of the standard VXML
# Transfer. When the user calls into the gateway, a VXML dialog is invoked. The
# VXML dialog queries user input from a menu option.
# The VXML document returned presents the user with choices of who he can call.
# The TCL document reads av-pair values with phone number correspond to user input
# and place the call.
#----------------------------------------------------------------------------
#
# Procedure init_perCallVars
# In this procedure, the global variables are initialized
#
proc init_perCallVars { } {
global tclProc
global baseURI
global destination
set baseURI http://HTTP-SERVER/quickstart/
set tclProc ""
set destination ""
}
#----------------------------------------------------------------------------------------
# Procedure act_VxmlDialog1
# In this procdure, a VXML document is invoked and the VXML dialog prompts
# the user to enter an option from the menu option. User input is passed back
# to the TCL script.
#
proc act_VxmlDialog1 { } {
global baseURI
# the base URL is the location of this TCL script
set vxmlDialog1 {
<vxml version="2.0">
<form id="main">
<field name="getdigit" type="digits?length=1">
<grammar type="application/grammar+regex">[123]</grammar>
<noinput>
<prompt>
<audio src="audio/no_input.au"/>
<audio src="audio/menu_option.au" caching="fast"/>
</prompt>
</noinput>
<nomatch>
<audio src="audio/beep.au"/>
<audio src="audio/menu_option.au" caching="fast"/>
</nomatch>
<prompt bargein="false">
<audio src="audio/welcome.au"/>
</prompt>
<prompt bargein="true">
<audio src="audio/menu_option.au" caching="fast"/>
</prompt>
<filled>
<exit namelist="getdigit"/>
</filled>
</field>
</form>
</vxml>
}
leg setupack leg_incoming
leg proceeding leg_incoming
leg connect leg_incoming
leg vxmldialog leg_incoming -u $baseURI -v $vxmlDialog1
}
 
#-------------------------------------------------------------------------------------------
# Procedure act_Transfer
# This procedure is called when the application receives the vxml_dialog_done
# event. It checks for the user input from the VXML dialog, then retrieves the
# av pair with a phone number corresponds to user input and places a call to
# that number. If user select 1 or if av pair value is not configured then play
# busy.au and goodbye prompts and disconnect the call.
#
 
proc act_Transfer { } {
global tclProc
global destination
global transfer_param
set tclProc Transfer
# check the sub-event name
set exp_ev vxml.session.complete
set ev [infotag get evt_vxmlevent]
if {$ev != $exp_ev} {
puts "\n\n\t\t **** Expected event $exp_ev, got $ev"
}
# check the dialog status
set status [infotag get evt_status]
switch $status {
"vd_000" {
#get the transfer attribute, destination
infotag get evt_vxmlevent_params transfer_param
set destination ""
if !{[info exists transfer_param(getdigit)]} {
puts "\n\n\t\t **** getdigit does not exist"
act_LogStatus $status $tclProc
}
set vxml_option $transfer_param(getdigit)
if { $vxml_option == "2" } {
if { [infotag get cfg_avpair_exists acme-sales] } {
set destination [string trim [infotag get cfg_avpair acme-sales]]
}
} elseif { $vxml_option == "3" } {
if { [infotag get cfg_avpair_exists acme-service] } {
set destination [string trim [infotag get cfg_avpair acme-service]]
}
}
if { $destination != "" } {
leg setup $destination callInfo leg_incoming
} else {
puts "\n\n\t\t **** NO acme-sales or acme-service numbers configured from CLI"
media play leg_incoming flash:busy.au flash:goodbye.au
fsm setstate CALLDISCONNECT
return
}
}
"vd_001" -
"vd_002" -
"vd_003" {
puts "\n\n\t\t **** VXML Dialog status, expected vd_000, got $status"
act_LogStatus $status $tclProc
}
}
}
#-------------------------------------------------------------------------------------------
# Procedure act_TransferDone
# If leg setup is successful, the 2 parties are conferenced. If not, the status
# of leg setup is sent to the web server.
proc act_TransferDone { } {
 
global tclProc
global destination
global transferStatus
set tclProc TransferDone
set status [infotag get evt_status]
puts "\n\n\t\t **** Status of leg setup is $status \n"
switch $status {
"ls_000" {
puts "\n\n\t\t **** Call status is $status, call active \n"
}
"ls_007" {
puts "\n\n\t\t **** Call status is $status, Destination is Busy \n"
set transferStatus NOANSWER
act_LogStatus $transferStatus $tclProc
}
"ls_008" {
puts "\n\n\t\t **** Call status is $status, Incoming Disconnected \n"
set transferStatus NEAR_END_DISCONNECT
act_LogStatus $transferStatus $tclProc
}
"ls_009" {
puts "\n\n\t\t **** Call status is $status, Outcoming Disconnect \n"
set transferStatus FAR_END_DISCONNECT
act_LogStatus $transferStatus $tclProc
}
default {
puts "\n\n\t\t **** Call status is $status\n"
set transferStatus UNKNOWN
act_LogStatus $transferStatus $tclProc
}
}
}
#--------------------------------------------------------------------------------------------
# Procedure act_LogStatus
# The status code for leg setup, vxml dialog are sent to the backend web server
# in this procedure.
proc act_LogStatus {statusCode tclProcedure} {
global baseURI
 
puts "\n\n\t\t***** Status Code is $statusCode in procedure $tclProcedure"
set vxmlDialog2 {
<vxml version="2.0">
<form id="main">
<var name="ANI" expr="session.telephone.ani"/>
<var name="STATUSCODE" expr="com.cisco.params.code"/>
<var name="PROCEDURE" expr="com.cisco.params.procedure"/>
<catch event="error.badfetch.com">
<log>Web Server down ! Submit action in VxmlDialog2 failed. </log>
<exit/>
</catch>
 
<block>
<log> TCL Status Code : <value expr="STATUSCODE"/> found in TCL Procedure : <value expr="PROCEDURE"/></log>
<submit expr="http://HTTP-SERVER/quickstart/status.php'" method="get" namelist="ANI STATUSCODE PROCEDURE"/>
</block>
</form>
</vxml>
}
set tclStatusParam(code) $statusCode
set tclStatusParam(procedure) $tclProcedure
leg vxmldialog leg_incoming -u $baseURI -v $vxmlDialog2 -p tclStatusParam
fsm setstate LOGSTATUS
}
¿
#-------------------------------------------------------------------------------------
# Procedure act_HandleOutgoing
# When the called party hangs up, the connection is destroyed
 
proc act_HandleOutgoing { } {
if {[infotag get evt_legs] == [infotag get leg_outgoing]} {
# Outgoing disconnected
connection destroy con_all
} else {
call close
fsm setstate CALLDISCONNECT
}
}
proc act_Cleanup { } {
puts "\n\n\t\t **** act_Cleanup"
call close
}
requiredversion 2.0
init_perCallVars
#----------------------------------
# State Machine
#----------------------------------
set fsm(any_state,ev_disconnected) "act_Cleanup same_state"
set fsm(CALL_INIT,ev_setup_indication) "act_VxmlDialog1 WEBQUERY"
set fsm(WEBQUERY,ev_vxmldialog_done) "act_Transfer TRANSFER"
set fsm(TRANSFER,ev_setup_done) "act_TransferDone CALLACTIVE"
set fsm(CALLACTIVE,ev_disconnected) "act_HandleOutgoing CONNDESTROY"
set fsm(LOGSTATUS,ev_vxmldialog_done) "act_Cleanup same_state"
set fsm(CALLDISCONNECT,ev_disconnect_done) "act_Cleanup same_state"
set fsm(CALLDISCONNECT,ev_media_done) "act_Cleanup same_state"
set fsm(CALL_INIT,ev_media_done) "act_MediaWait same_state"
set fsm(CALLDISCONNECT,ev_disconnect_done) "act_Cleanup same_state"
 
fsm define fsm CALL_INIT

Subject: RE: How do I load TCL variables from the CLI?
Replied by: Yawming Chen on 05-04-2010 02:32:17 PM
You can refer to Tcl and VXML programming guide.
 
Thanks
 
http://developer.cisco.com/web/vgapi/docs?p_p_id=110_INSTANCE_KtCE&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_pos=1&p_p_col_count=2&_110_INSTANCE_KtCE_struts_action=%2Fdocument_library_display%2Fview&_110_INSTANCE_K...
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links