found in my old hard drive, Cisco AS5300 - Jan 2001
Dehkadeh project, UIV. http://www.shafagh.com/dehkadeh

Router Configuration:
!
aaa new-model
aaa authentication login h323 group radius
aaa authentication login home local
aaa authentication ppp ppp local
aaa authorization exec h323 group radius
aaa authorization network ppp local
aaa accounting update newinfo
aaa accounting connection h323 start-stop group radius
!
ip domain-name dehkadeh.com
ip host call 194.225.193.3
!
call fallback probe-timeout 2
call rsvp-sync
call application voice callapp tftp://call//tftpboot/call.tcl
call application voice callapp uid-len 12
call application voice callapp pin-len 0
call application voice callapp warning-time 300
call application voice callapp language 1 fa
call application voice callapp language 2 en
call application voice callapp set-location fa 0 tftp://call//tftpboot/prompts/fa/
call application voice callapp set-location en 0 tftp://call//tftpboot/prompts/en/
!
voice class codec 1
codec preference 1 g723ar53 bytes 140
codec preference 2 g729r8 bytes 140
!
dial-peer voice 1 pots
application callapp
port 1:1
!
dial-peer voice 666 voip
destination-pattern .T
session target ras
!...
TCL Script:
# Script Locked by: CiscoOfficial
# Script Version: 1.1.3
# Script Name:
# Script Lock Date: Sat Sep 16 13:53:15 2000
# debitcard.tcl
#------------------------------------------------------------------
# July 14th 1999, Connie Chiu
#
# Copyright (c) 1999, 2000 by cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
#
# Description:
#
# The debitcard application allows a user to to select the lanaguage
# mode based on the langauges that are configured through the CLIs.
# The application then prompts and collects the card number. The
# card number consists of a uid and pin where uid-length and pin-length
# are configured through through CLIs.
# Authentication is done with the card number. If it passes authentication,
# the application plays the amount available in the user's debitcard. It then
# prompts and collects the destination number.
# If authentication fails, the application allows user to retry and the number
# of retries is configured through the CLI.
# Authorization is done with the destination number. If authorization is
# successful, the application plays a time duration which indicates the amount of
# talk time in the user's debitcard account and places the call.
# If authorization fails, the application allows users to retry.
#
# The main routine is at the bottom.
#
# Modifications (5/12):
#
# - Added new playprompt usage
# - Notify user if AAA server is dead
# - Spanish lang support
# - For account with zero credit, only allow them to make toll-free calls
# - type ahead with Long Pound feature
#
# Modifications (6/7)
#
# - Play failure tone instead of a prompt when place_call fails
# - Play a prompt when an invalid language is selected
#
# Modifications (6/24)
# - Enable long pound detection only for debitcard application
#
# Modifications (6/25)
# - Deleted while loop at the end of the script
# - Script will loop back to start at beginning.
#
# Modifications (7/7)
# - new verb setVariable
# - Usage : setVariable language 1
# setvariable longpound true
# - replaced all language prefixes (en_, sp_) with genric prefixes (prefix1, prefix2 etc)
#
# Modifications (7/13)
# - Modified prompt playing sequence in select_language for primary and secondary
# languages
#
# Modifications (8/6)
# - Allow 1 language support
# - After long pound, skip the first authorization request, ie. creditamt is not
# played back to the user
# - Play error prompts depending on return codes for Radius
proc do_select_language {} {
global state
global retryCnt
global selectCnt
global prefix
global wrongLanguage
global param5
global param2
global param1
global prefix1
global prefix2
global totalLang
set param5(maxDigits) 1
if {$totalLang == 1} {
set prefix [getVariable local language]
set ev [playPrompt param1 info [set prefix]_welcome.au]
set state get_card_number
return 0
}
if {$selectCnt == 0} {
set ev [playPrompt param5 info [set prefix1]_welcome.au %s1000 [set prefix1]_lang_sel1.au %s1000 [set prefix2]_lang_sel2.au]
} else {
if {$wrongLanguage == 1} {
set ev [playPrompt param5 info [set prefix1]_wrong_lang_sel.au %s1000 [set prefix1]_lang_sel1.au %s1000 [set prefix2]_lang_sel2.au]
} else {
set ev [playPrompt param5 info [set prefix1]_no_lang_sel.au %s1000 [set prefix1]_lang_sel1.au %s1000 [set prefix2]_lang_sel2.au]
}
}
if {$ev == "collect success"} {
set lang $info(digits)
set langSel [setVariable language $lang]
if {($langSel == "language not specified in configuration") || ($langSel == "language not supported")} {
incr selectCnt
set wrongLanguage 1
if {$selectCnt < $retryCnt} {
set state select_language
} else {
set ev [playPrompt param2 info [set prefix1]_generic_final.au]
set state end
}
} else {
set prefix [getVariable local language]
set state get_card_number
}
return 0
}
if {($ev == "collect fail") || ($ev == "collect timeout")} {
incr selectCnt
if {$selectCnt < $retryCnt} {
set state select_language
} else {
set ev [playPrompt param2 info [set prefix1]_generic_final.au]
set state end
}
return 0
}
set state end
return 0
}
proc do_get_card_number {} {
global state
global account
global pin
global promptFlag
global count
global accountLen
global pinLen
global retryCnt
global prefix
global param1
global param2
set cardLen [expr $accountLen + $pinLen]
set param1(maxDigits) $cardLen
if {$count == 0} {
set ev [playPrompt param1 info [set prefix]_enter_card_num.au]
} else {
if {$promptFlag == 1 } {
set ev [playPrompt param1 info [set prefix]_invalid_digits.au]
}
if {$promptFlag == 2} {
set ev [playPrompt param1 info [set prefix]_auth_fail.au]
}
if {$promptFlag == 3} {
set ev [playPrompt param1 info [set prefix]_no_card_entered.au]
}
}
if { $ev == "collect success" } {
set number $info(digits)
set numberlen [ string length $number ]
if { $numberlen == $cardLen } {
set account [ string range $number 0 [expr $accountLen -1]]
set pin [ string range $number $accountLen [expr $cardLen -1]]
set state first_authorize
} else {
incr count
set promptFlag 1
if {$count < $retryCnt} {
set state get_card_number
} else {
# no more tries
set ev [playPrompt param2 info [set prefix]_final.au]
set state end
}
}
return 0
}
if {$ev == "collect aborted"} {
set state get_card_number
return 0
}
if {($ev == "collect fail") || ($ev == "collect timeout")} {
incr count
set promptFlag 3
if {$count < $retryCnt} {
set state get_card_number
} else {
set ev [playPrompt param2 info [set prefix]_final.au]
set state end
}
return 0
}
set state end
return 0
}
proc do_first_authorize {} {
global state
global pin
global account
global count
global retryCnt
global promptFlag
global prefix
global param2
global amt
set ev [authorize $account $pin "" [ani] info]
set returncode [getVariable radius returnCode]
if { $ev == "authorized" } {
set amt [getVariable radius creditAmount]
set state get_dest
return 0
}
if {$ev == "authorization failed"} {
incr count
set promptFlag 2
if { $count < $retryCnt } {
set state get_card_number
} else {
set state first_authorize_fail
}
return 0
}
if {$returncode == "Uknown variable name"} {
set ev [playPrompt param2 info [set prefix]_no_aaa.au]
}
set state end
return 0
}
proc do_get_dest {} {
global state
global destination
global fcnt
global retryCnt
global promptFlag2
global prefix
global pound
global destBusy
global param3
global amt
if {$fcnt == 0} {
if {$amt == 0} {
set ev [playPrompt param3 info [set prefix]_zero_bal.au]
set state end
# set $creditTime umlimited
} elseif {$amt > 999999.99} {
set ev [playPrompt param3 info [set prefix]_invalid_amt.au [set prefix]_dollars.au %s1000 [set prefix]_enter_dest.au]
} elseif {$pound == 1} {
set pound 0
set ev [playPrompt param3 info [set prefix]_disconnect.au %s1000 [set prefix]_enter_dest.au]
} elseif {$destBusy == 1} {
set destBusy 0
set ev [playPrompt param3 info [set prefix]_dest_busy.au]
} else {
set ev [playPrompt param3 info [set prefix]_you_have.au %a$amt %s1000 [set prefix]_enter_dest.au]
}
} else {
if {$promptFlag2 == 1} {
set ev [playPrompt param3 info [set prefix]_reenter_dest.au]
}
if {$promptFlag2 == 2} {
set ev [playPrompt param3 info [set prefix]_author_fail.au]
}
if {$promptFlag2 == 3} {
set ev [playPrompt param3 info [set prefix]_no_dest_entered.au]
}
}
if {$ev == "collect success"} {
set destination $info(digits)
set state second_authorize
return 0
}
if {$ev == "collect aborted"} {
set state get_dest
return 0
}
if {$ev == "collect fail"} {
incr fcnt
set promptFlag2 1
if {$fcnt < $retryCnt} {
set state get_dest
} else {
set state collect_fail
}
return 0
}
if {$ev == "collect timeout"} {
incr fcnt
set promptFlag2 3
if {$fcnt < $retryCnt} {
set state get_dest
} else {
set state collect_fail
}
return 0
}
set state end
return 0
}
proc do_second_authorize {} {
global state
global destination
global account
global pin
global creditTime
global warnTime
global promptFlag2
global fcnt
global retryCnt
global prefix
global noPlay
global param2
global noTimeLimit
global amt
set ev [authorize $account $pin $destination [ani] info]
set returncode [getVariable radius returnCode]
if {$returncode == 13} {
# allow user to make toll-free calls
set noTimeLimit 1
set state place_call
return 0
}
if {$returncode == 52} {
# Redirect to customer service using redirect number
set noTimeLimit 1
set state place_call
return 0
}
if {$ev == "authorized"} {
set creditTime [getVariable radius creditTime]
if {$creditTime == "uninitialized"} {
set ev [ playPrompt param2 info [set prefix]_no_aaa.au]
set state end
} elseif {$creditTime == "unlimited"} {
set noTimeLimit 1
# play mesg only if time left is 20 secs > warntime
} elseif {[expr $creditTime - $warnTime] <>
set noPlay 1
set ev [ playPrompt param2 info [set prefix]_you_have.au %t$creditTime ]
} else {
set ev [ playPrompt param2 info [set prefix]_you_have.au %t$creditTime ]
}
set state place_call
return 0
}
if {$ev == "authorization failed"} {
incr fcnt
set promptFlag2 2
#play prompt base on return code
if {$returncode == 3} {
set ev [playPrompt param2 info [set prefix]_account_blocked.au]
set state end
}
if {$returncode == 4} {
set ev [playPrompt param2 info [set prefix]_zero_bal.au]
set noTimeLimit 1
set state place_call
return 0
}
if {$returncode == 5} {
set ev [playPrompt param2 info [set prefix]_card_expired.au]
set state end
}
if {$returncode == 7} {
set ev [playPrompt param2 info [set prefix]_blocked.au]
set state end
}
if {$returncode == 9} {
set ev [playPrompt param2 info [set prefix]_dest_blocked.au]
set state end
}
if {$returncode == 12} {
set ev [playPrompt param2 info [set prefix]_not_enuf.au]
set state end
}
if {$returncode == "Uknown variable name"} {
set ev [playPrompt param2 info [set prefix]_no_aaa.au]
set state end
}
if { $fcnt < $retryCnt } {
set state get_dest
} else {
set state second_authorize_fail
}
return 0
}
set state end
return 0
}
proc do_place_call {} {
global state
global destination
global account
set callInfo(accountNum) $account
set ev [placeCall $destination callInfo info]
if {$ev == "active"} {
set state active
return 0
}
if {$ev == "call fail"} {
set state place_fail
return 0
}
set state end
return 0
}
proc do_active_notimer {} {
global state
set ev [waitEvent]
while { $ev == "digit" } {
set ev [waitEvent]
}
set state end
return 0
}
proc do_active_last_timer {} {
global state
global warnTime
global creditTime
global fcnt
global noPlay
global prefix
global pound
if { $noPlay == 1} {
set ev [startTimer [expr $creditTime -1] info]
} else {
set ev [startTimer [expr $warnTime - 4] info]
}
while { $ev == "digit"} {
set ev [startTimer $info(timeLeft) info]
}
if { $ev == "longpound" } {
set fcnt 0
set noPlay 0
set pound 1
clearOutgoingLeg info
#set state first_authorize
set state get_dest
return 0
} elseif { $ev == "timeout" } {
clearOutgoingLeg info
set state out_of_time
} else {
set state end
}
return 0
}
proc do_active_timer {} {
global state
global warnTime
global creditTime
global prefix
global fcnt
global noPlay
global pound
global param4
set delay [expr $creditTime - $warnTime]
set ev [startTimer $delay info]
while {$ev == "digit"} {
set ev [startTimer $info(timeLeft) info]
}
if { $ev == "longpound" } {
set fcnt 0
set noPlay 0
set pound 1
clearOutgoingLeg info
#set state first_authorize
set state get_dest
return 0
}
if {$ev == "outgoing disconnected"} {
set fcnt 0
set pound 1
#set state first_authorize
set state get_dest
return 0
}
if { $ev == "timeout" } {
if {$noPlay == 1} {
do_active_last_timer
} else {
set ev [playPrompt param4 info [set prefix]_you_have.au %t$warnTime]
do_active_last_timer
}
} else {
set state end
}
return 0
}
proc do_active {} {
global state
global creditTime
global warnTime
global noTimeLimit
if { ($noTimeLimit == 1) || ( $creditTime == "unlimited") ||
( $creditTime == "uninitialized") } {
do_active_notimer
} else {
if {$creditTime <$warnTime} {
do_active_last_timer
} else {
do_active_timer
}
}
return 0
}
proc do_out_of_time {} {
global state
global prefix
global param2
set ev [playPrompt param2 info [set prefix]_disconnect.au]
set state end
return 0
}
proc do_first_authorize_fail {} {
global state
global prefix
global param2
set returncode [getVariable radius returnCode]
set ev [playPrompt param2 info [set prefix]_final.au]
set state end
return 0
}
proc do_second_authorize_fail {} {
global state
global prefix
global param2
set returncode [getVariable radius returnCode]
set ev [playPrompt param2 info [set prefix]_final.au]
set state end
return 0
}
proc do_collect_fail {} {
global state
global prefix
global param2
set ev [playPrompt param info [set prefix]_dest_collect_fail.au]
set state end
return 0
}
proc do_place_fail {} {
global state
global prefix
global destBusy
global param2
set destBusy 1
#playFailureTone 5 retInfo
#set state end
set state get_dest
return 0
}
#-------------------------------------------------------
# main
#
acceptCall
set fcnt 0
set selectCnt 0
set lang 0
set count 0
set promptFlag 0
set promptFlag2 0
set wrongLanguage 0
set noPlay 0
set prefix en
set pound 0
set destBusy 0
set noTimeLimit 0
set param1(interrupt) true
set param1(abortKey) *
set param1(terminationKey) #
set param2(interrupt) true
set param2(abortKey) *
set param2(terminationKey) #
set param2(playComplete) true
set param3(interrupt) true
set param3(abortKey) *
set param3(terminationKey) #
set param3(dialPlanTerm) true
set param4(interrupt) true
set param4(abortKey) *
set param4(terminationKey) #
set param4(playComplete) true
set param4(insertMessage) true
set param5(interrupt) true
#install params
set accountLen [getVariable config uidLen]
set pinLen [getVariable config pinLen]
set retryCnt [getVariable config retryCount]
set operatorNum [getVariable config redirectNumber]
set warnTime [getVariable config warningTime]
# set primary language
setVariable language 1
set prefix1 [getVariable local language]
# set secondary language
setVariable language 2
set prefix2 [getVariable local language]
setVariable longPound true
set totalLang [getVariable local totalLanguages]
if {$totalLang == 0} {
set state end
return 0
} else {
set state select_language
}
while {$state != "end"} {
puts "cid([callID]) app running state $state"
if {$state == "select_language"} {
do_select_language
} elseif {$state == "get_card_number"} {
do_get_card_number
} elseif {$state == "first_authorize"} {
do_first_authorize
} elseif {$state == "second_authorize"} {
do_second_authorize
} elseif {$state == "second_authorize_pass" } {
do_second_authorize_pass
} elseif {$state == "get_dest"} {
do_get_dest
} elseif {$state == "place_call"} {
do_place_call
} elseif {$state == "active"} {
do_active
} elseif {$state == "first_authorize_fail" } {
do_first_authorize_fail
} elseif {$state == "second_authorize_fail" } {
do_second_authorize_fail
} elseif {$state == "collect_fail" } {
do_collect_fail
} elseif {$state == "place_fail"} {
do_place_fail
} elseif {$state == "out_of_time"} {
do_out_of_time
} else {
break
}
}
# Script Approval Signature: C/dc57
for more information:
0 comments:
Post a Comment