-
راهنمایی برای نوشتن tcl
سلام استادان
من تازه ماخواسم tcl کارکنم
یه مطالبی از سایت cisco پیدا کردم
جند تا سوال داشتم اگه زحمتی نیست جواب بدین ممنون میشم
اول ببینید دستورات زیر که پیدا کردم در عمل هم جواب میده؟
acceptCall
set event [authenticate [ani] [dnis] info]
if {$event != "authenticated"} {
set state get_account
} else {
set state authen_pass
}
while {$state != "end"} {
if {[info proc do_$state] == do_$state}
do_$state
}
proc do_get_account {} {
global state
global account
set prompt(url) flash:enter_account.au
set prompt(interrupt) true
set prompt(abortKey) *
set prompt(terminationKey) #
set patterns(account) .+
set event [promptAndCollect prompt info patterns ]
if {$event == "collect success"} {
set state get_pin
set account $info(digits)
return 0
}
if {$event == "collect aborted"} {
set state get_account
return 0
}
if {$event == "collect fail"} {
set state get_account
return 0
}
set state end
return 0
}
proc do_get_pin {} {
global state
global pin
set prompt(url) flash:enter_pin.au
set prompt(interrupt) true
set prompt(abortKey) *
set prompt(terminationKey) #
set patterns(account) .+
set event [promptAndCollect prompt info patterns ]
if {$event == "collect success"} {
set state authenticate
set pin $info(digits)
return 0
}
if {$event == "collect aborted"} {
set state get_account
return 0
}
if {$event == "collect fail"} {
# timeout
if {$info(code) == 102} {
set state get_pin
return 0
}
# invalid number
if {$info(code) == 28} {
set state get_pin
return 0
}
}
set state end
return 0
}
proc do_authenticate {} {
global state
global pin
global account
set event [authenticate $account $pin info]
if { $event == "authenticated" } {
set state authen_pass
return 0
}
if {$event == "authentication failed"} {
set state authen_fail
return 0
}
set state end
return 0
}
proc do_get_dest {} {
global state
global destination
set prompt(url) flash:enter_destination.au
set prompt(interrupt) true
set prompt(abortKey) *
set prompt(terminationKey) #
set prompt(dialPlan) true
set event [promptAndCollect prompt info ]
if {$event == "collect success"} {
set state place_call
set destination $info(digits)
return 0
}
if {$event == "collect aborted"} {
set state get_dest
return 0
}
if {$event == "collect fail"} {
set state get_dest
return 0
}
set state end
return 0
}
proc do_authen_pass {} {
global state
global destination
set dnislen [string len [dnis]]
if { [did] && $dnislen } {
set destination [dnis]
set state place_call
} else {
set state get_dest
}
return 0
}
proc do_place_call {} {
global state
global destination
set event [placeCall $destination callInfo info]
if {$event == "active"} {
set state active
return 0
}
if {$event == "call fail"} {
set state place_fail
return 0
}
set state end
return 0
}
proc do_active_notimer {} {
global state
set event [waitEvent]
while { $event == "digit" } {
set event [waitEvent]
}
set state end
return 0
}
proc do_active_last_timer {} {
global state
set event [startTimer [creditTimeLeft] info]
while { $event == "digit" } {
set event [startTimer $info(timeLeft) info]
}
if { $event == "timeout" } {
clearOutgoingLeg retInfo
set state out_of_time
} else {
set state end
}
return 0
}
proc do_active_timer {} {
global state
if { [creditTimeLeft] < 10 } {
do_active_last_timer
return 0
}
set delay [expr [creditTimeLeft] - 10]
set event [startTimer $delay info]
while { $event == "digit" } {
set event [startTimer $info(timeLeft) info]
}
if { $event == "timeout" } {
insertMessage flash:beep.au retInfo
do_active_last_timer
} else {
set state end
}
return 0
}
proc do_active {} {
global state
if { ( [creditTimeLeft] == "unlimited") ||
([creditTimeLeft] == "uninitialized") } {
do_active_notimer
} else {
do_active_timer
}
return 0
}
proc do_out_of_time {} {
global state
set prompt(url) flashut_of_time.au
set prompt(playComplete) true
set event [promptAndCollect prompt info ]
set state end
return 0
}
proc do_authen_fail {} {
global state
set prompt(url) flash:auth_failed.au
set prompt(playComplete) true
set event [promptAndCollect prompt info ]
set state end
return 0
}
proc do_place_fail {} {
global state
playFailureTone 5 retInfo
set state end
return 0
}
#---------------------------------------
# And here is the main loop
#
acceptCall
set event [authenticate [ani] [dnis] info]
if {$event != "authenticated"} {
set state get_account
} else {
set state authen_pass
}
while {$state != "end"} {
puts "cid([callID]) running state $state"
if {$state == "get_account"} {
do_get_account
} elseif {$state == "get_pin"} {
do_get_pin
} elseif {$state == "authenticate"} {
do_authenticate
} elseif {$state == "get_dest"} {
do_get_dest
} elseif {$state == "place_call"} {
do_place_call
} elseif {$state == "active"} {
do_active
} elseif {$state == "authen_fail" } {
do_authen_fail
} elseif {$state == "authen_pass" } {
do_authen_pass
} elseif {$state == "place_fail"} {
do_place_fail
} elseif {$state == "out_of_time"} {
do_out_of_time
} else {
break
}
}
و این که چرا دستور زیر را در روتر میزنیم
call application voice callapp language 0 fa
call application voice callapp set-location fa 0 tftp://acct/ivr/prompts/fa/
یک سوال دیگر هم دارم
اگر بخواهم به صورت اتوماتیک اعتبار باقی مانده کاربر را به او اعلام کند من دستور زیر را پیدا کردم
set amt [getVariable radius creditAmount]
set param(interrupt) true
set param(abortKey) *
set param(dialPlan) true
set param(terminationKey) #
set ev [playPrompt param info en_you_have.au %a$amt %s1000 en_enter_dest.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
}
ولی یک دستور را منوجه نمییشم
set ev [playPrompt param info en_you_have.au %a$amt %s1000 en_enter_dest.au]
دستور %a$amt ینی اینه اعتبار را میخواند؟به چه زبانی آخه؟
ممنون میشم جواب بدین
موضوعات مشابه:
-
کسی نیست منو راهنمایی کنه
-
کممممممممممممممممکککککککک کک
کلمات کلیدی در جستجوها:
برچسب برای این موضوع
مجوز های ارسال و ویرایش
- شما نمی توانید موضوع جدید ارسال کنید
- شما نمی توانید به پست ها پاسخ دهید
- شما نمی توانید فایل پیوست ضمیمه کنید
- شما نمی توانید پست های خود را ویرایش کنید
-
قوانین انجمن