Вот что удалось придумать за день работы:proc init { } {
# Инициализация глобальных статических переменных
puts "\n proc Init start"
global param
global phonePattern
global commercePhone
global customerSupport
infotag set med_language_map 0 ru
infotag set med_location ru 0 tftp://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
infotag set med_location ru 1 tftp://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
infotag set med_language 0
set param(initialDigitTimeout) 10
set param(interruptPrompt) true
set phonePattern(1) {[1,2]}
# Телефонные номера служб "по умолчанию"
set customerSupport "7xxxxxxxxxx"
set commercePhone "7xxxxxxxxxx"
puts "\n proc Init finish"
}
proc act_Setup { } {
# Снятие трубки и сбор цифр
global param
puts "\a proc act_Setup start"
leg setupack leg_incoming
leg proceeding leg_incoming
leg connect leg_incoming
puts "\n playing welcome message and asking user for turning phone into tone mode...\n starting collection digits..."
media play leg_incoming _subscriberBusy.au %s500 _techSupport.au
# Звуковые файлы позже поменяются на нужные!
leg collectdigits leg_incoming param phonePattern
puts "\n proc act_Setup finish"
}
proc act_GotDest { } {
# Проверка правильности введенного номера и установка звонка
puts "\n proc act_GotDest start "
set status [infotag get evt_status]
set digits [infotag get evt_dcdigits]
switch $digits {
1 {
# Пользователь запросил соединение с абонентским отделом
puts "\n Subscriber asking connection with commerce department"
leg setup $commercePhone callinfo leg_incoming
fsm setstate CallSetupDone
set status [infotag get evt_status]
puts "\n Call [infotag get con_all] got event $status"
}
2 {
# Пользователь запросил соединение с техподдержкой
puts "\n Subscriber asking connection with customer support"
leg setup $customerSupport callinfo leg_incoming
fsm setstate CallSetupDone
set status [infotag get evt_status]
puts "\n Call [infotag get con_all] got event $status"
}
default {
# Несуществующий пункт меню
media play leg_incoming _wrongMenuPoint.au
fsm setstate CallClose
}
}
}
proc act_CallSetupDone { } {
# Проверка состояния установки звонка
puts "\n proc act_CallSetupDone start"
set status [infotag get evt_status]
switch $status {
ls_000 { set action "OK"}
ls_001 { set action "busy"}
ls_002 { set action "busy"}
ls_003 { set action "busy"}
ls_004 { set action "wrongnumber"}
ls_005 { set action "busy"}
ls_006 { set action "busy"}
ls_007 { set action "busy"}
ls_008 { set action "disconnect"}
ls_009 { set action "busy"}
ls_010 { set action "busy"}
ls_011 { set action "busy"}
ls_012 { set action "busy"}
ls_013 { set action "disconnect"}
ls_014 { set action "busy"}
ls_015 { set action "disconnect"}
ls_016 { set action "busy"}
default { set action "disconnect"}
}
if {$action == "wrongnumber"} {
puts "\n CallSetup got event $status \n The call setup failed because of an invalid number."
media play leg_incoming _wrongMenuPoint.au
fsm setstate CallClose
} elseif {$action == "busy"} {
puts "\n CallSetup got event $status - busy"
media play leg_incoming _subscriberBusy.au
fsm setstate CallClose
} elseif {$action == "disconnect" } {
puts "\n CallSetup got event $status - disconnected"
fsm setstat CallClose
act_Call_Close
} else {
puts "\n CallSetup got event $status - OK!"
fsm setstate CallClose
}
puts "\n proc act_CallSetupDone finish"
}
proc act_Call_Close { } {
# Процедура завершения звонка
call close
}
requiredversion 2.0
init
# FSM
set fsm(any_state,ev_disconnected) "act_Call_Close same_state"
set fsm(Call_Init,ev_setup_indication) "act_Setup Got_Dest"
set fsm(Got_Dest,ev_collectdigits_done) "act_GotDest CallSetupDone"
set fsm(CallSetupDone,ev_setup_done) "act_CallSetupDone CallClose"
set fsm(CallClose,ev_disconnected) "act_Call_Close same_state"
При звонке на скрипт идет fast busy и дебаг выдает следующую ошибку:
ov 13 18:04:35.706:
Nov 13 18:04:38.598: //-1//TCL2:HN863A04E0:/tcl_PutsCmd:
proc Init start
Nov 13 18:04:38.598:
Nov 13 18:04:38.602: //-1//TCL2:HN863A04E0:/tcl_PutsCmd:
proc Init finish
Nov 13 18:04:38.602:
Nov 13 18:04:38.602: //334887//TCL2:/tcl_PutsCmd: proc act_Setup start
Nov 13 18:04:38.602:
Nov 13 18:04:38.602: //334887//TCL2:/tcl_PutsCmd:
playing welcome message and asking user for turning phone into tone mode...
starting collection digits...
Nov 13 18:04:38.602:
Nov 13 18:04:38.606: //334887//TCL2:/TclInterpDriver: Tcl_Eval Failed in action=act_Setup code=1
code=ERROR
Nov 13 18:04:38.606: IVR TCL script failure
Result:
DigitCollect Command failed to intiate
Nov 13 18:04:38.606: IVR TCL script failure errorInfo:
DigitCollect Command failed to intiate
while executing
"leg collectdigits leg_incoming param phonePattern"
(procedure "act_Setup" line 15)
invoked from within
"act_Setup"
Не подскажете в чём ошибка и как таймаут сделать в рамках данной задачи?