выясняется, что проблема в tcl-скрипте, который роутит эти звонки - без него все ок! но tcl я не знаю, и разобраться в этом скрипте крайне сложно для меня... вот он.
proc init { } {
global isDebug
global param1
global callInfo
global legConnected set param1(interruptPrompt) true
set param1(abortKey) *
set param1(terminationKey) #
set legConnected false
set isDebug false
}
proc init_ConfigVars { } {
global isDebug
global aaParams
if [infotag get cfg_avpair_exists aa-pilot] {
set aaParams(aaPilot) [string trim [infotag get cfg_avpair aa-pilot]]
} else {
set aaParams(aaPilot) "NONE"
}
if [infotag get cfg_avpair_exists operator] {
set aaParams(oprtr) [string trim [infotag get cfg_avpair operator]]
} else {
set aaParams(oprtr) "NONE"
}
if [infotag get cfg_avpair_exists aa-fax] {
set aaParams(opfax) [string trim [infotag get cfg_avpair aa-fax]]
} else {
set aaParams(opfax) "NONE"
}
if [infotag get cfg_avpair_exists aa-allowdest] {
set aaParams(opallowed) [string trim [infotag get cfg_avpair aa-allowdest]]
} else {
set aaParams(opallowed) "NONE"
}
if [infotag get cfg_avpair_exists aa-hunt] {
set aaParams(list) [split [string trim [infotag get cfg_avpair aa-hunt]] ","]
} else {
set aaParams(list) $aaParams(oprtr)
}
if { $isDebug == "true" } {
puts "\naa-hunt: $aaParams(list)"
}
if [infotag get cfg_avpair_exists aa-moh] {
set aaParams(moh) [split [string trim [infotag get cfg_avpair aa-moh]] ","]
} else {
set aaParams(moh) "NONE"
}
if [infotag get cfg_avpair_exists aa-htimeout] {
set aaParams(aa-htimeout) [split [string trim [infotag get cfg_avpair aa-htimeout]] ","]
} else {
set aaParams(aa-htimeout) 10
}
if [infotag get cfg_avpair_exists aa-pass] {
set aaParams(aa-pass) [string trim [infotag get cfg_avpair aa-pass]]
} else {
set aaParams(aa-pass) 96661313
}
}
proc init_perCallVars { } {
global isDebug
global fcnt
global retrycnt
global dnis
global aaParams
if { $isDebug == "true" } {
puts "\nproc init_perCallvars"
}
set fcnt 0
set retrycnt 6
set dnis ""
set dnis [infotag get leg_dnis]
if { $isDebug == "true" } {
puts "\nDNIS $dnis"
}
set aaParams(admin) "NO"
}
proc act_Setup { } {
global isDebug
global param1
global dest
global beep
global callInfo
global dnis
global fcnt
global busyPrompt
global legConnected
global aaParams
puts "Incoming call to: $aaParams(aaPilot)"
if { $isDebug == "true" } {
set leg_isdid [infotag get leg_isdid]
puts "proc act_Setup: $leg_isdid"
}
set busyPrompt _dest_unreachable.au
set beep 0
init_perCallVars
infotag set med_language 1
if { ($dnis == "") || ($dnis == $aaParams(aaPilot)) } {
leg setupack leg_incoming
leg proceeding leg_incoming
leg connect leg_incoming
set legConnected true
if { $isDebug == "true" } {
puts "\nNo DNIS\n"
}
set param1(dialPlan) true
leg collectdigits leg_incoming param1
set cweekday [clock format [clock seconds] -format "%a"]
set chour [clock format [clock seconds] -format "%H"]
if {
(
($cweekday == "Mon" ||
$cweekday == "Tue" ||
$cweekday == "Wen" ||
$cweekday == "Thu" ||
$cweekday == "Fri" ) &&
($chour < 10 || $chour > 19)
) ||
($cweekday == "Sat" && ($chour < 10 || $chour > 14)) ||
($cweekday == "Sun")
} {
media play leg_incoming %s1000 _welcome.au %s500 _working_hours.au %s500 _enter_dest_$aaParams(aaPilot).au
} else {
media play leg_incoming %s1000 _welcome.au %s500 _enter_dest_$aaParams(aaPilot).au
}
} else {
set fcnt 6
leg setupack leg_incoming
handoff callappl leg_incoming default "DESTINATION=$dnis"
fsm setstate HANDOFF
}
}
proc act_GotDest { } {
global isDebug
global dest
global callInfo
global busyPrompt
global aaParams
global param1
set status [infotag get evt_status]
set dest [infotag get evt_dcdigits]
set callInfo(alertTime) $aaParams(aa-htimeout)
if { $isDebug == "true" } {
puts "\n proc act_GotDest: {$dest}"
}
if { $dest != "" } {
if { $aaParams(admin) == "NO" } {
if { $dest == $aaParams(aa-pass) } {
puts "ADMIN mode turned on for caller."
set aaParams(admin) "YES"
set param1(dialPlan) true
leg collectdigits leg_incoming param1
media play leg_incoming %s1000 _welcome.au
fsm setstate GETDEST
return
}
set res ""
regexp $aaParams(opallowed) $dest res
if { $res == "" } {
set status "cd_006"
}
}
} else {
set dest 0
}
if { ($status == "cd_004") } {
puts "Switching to $dest"
set callInfo(alertTime) 60
leg setup $dest callInfo leg_incoming
fsm setstate RINGING
# handoff callappl leg_incoming default "DESTINATION=$dest"
} else {
if { $status == "cd_006" } { set busyPrompt _dest_unreachable.au }
if { $isDebug == "true" } {
puts "\nCall [infotag get con_all] got event $status collecting destination"
}
if { [string length $dest] == 1 } {
if { $aaParams(list) != "NONE" } {
puts "Switching to aa-hunt"
set aaParams(v_delay) 1
set aaParams(v_huntpos) 1
set aaParams(v_media_playing) 0
act_HuntAgain
} else {
set dest $aaParams(oprtr)
leg setup $aaParams(opfax) callInfo leg_incoming
fsm setstate RINGING
# handoff callappl leg_incoming default "DESTINATION=$dest"
}
} elseif { $dest == "401" } {
puts "Switching to fax"
set callInfo(alertTime) 60
set dest $aaParams(opfax)
leg setup $aaParams(opfax) callInfo leg_incoming
fsm setstate RINGING
# handoff callappl leg_incoming default "DESTINATION=$dest"
} elseif { $dest == "402" } {
act_JustMusic
} else {
act_Select
}
}
}
proc act_JustMusic { } {
global isDebug
global aaParams
if { $isDebug == "true" } {
puts "\n proc act_JustMusic"
}
media play leg_incoming %s1000 $aaParams(moh)
fsm setstate JUSTMUSIC
}
proc act_MediaHunt { } {
global isDebug
if { $isDebug == "true" } {
puts "\n proc act_MediaHunt"
}
if { [infotag get evt_timer_name] == "waitwaitwait" } {
act_HuntAgain
}
}
proc act_NoMediaHunt { } {
global isDebug
global aaParams
if { $isDebug == "true" } {
puts "\n proc act_NoMediaHunt"
}
set aaParams(v_media_playing) 0
act_HuntAgain
}
proc act_HuntAgain { } {
global isDebug
global aaParams
if { $isDebug == "true" } {
puts "\n proc act_HuntAgain"
}
set current_ext [lindex $aaParams(list) [expr $aaParams(v_huntpos) - 1]]
set callInfo(alertTime) [expr $aaParams(v_delay) * $aaParams(aa-htimeout)]
leg setup $current_ext callInfo leg_incoming
fsm setstate CONTINUE
incr aaParams(v_huntpos)
}
proc act_LegDone { } {
global isDebug
global aaParams
set status [infotag get evt_status]
if { $isDebug == "true" } {
puts "\n proc act_LegDone: $status"
}
regexp {([0-9][0-9][0-9])} $status StatusCode
if { $StatusCode != "000" } {
if { $StatusCode == "007" } { incr aaParams(v_delay) } else { set aaParams(v_delay) 1 }
if { ($aaParams(v_huntpos) > [llength $aaParams(list)]) && ($aaParams(v_delay) <= [llength $aaParams(list)]) } {
set aaParams(v_media_playing) 0
set aaParams(v_huntpos) 1
media play leg_incoming %s1000 _op_busy.au %s1500
fsm setstate MEDIAOUT
} elseif { ($aaParams(v_huntpos) > [llength $aaParams(list)]) && ($aaParams(v_delay) > [llength $aaParams(list)]) } {
set aaParams(v_huntpos) 1
timer start named_timer 10 waitwaitwait
set aaParams(v_delay) 1
if { $aaParams(v_media_playing) == 0 } {
media play leg_incoming %s1000 _op_busy.au %s500 $aaParams(moh)
set aaParams(v_media_playing) 1
}
fsm setstate WAITWAITWAIT
} else {
act_HuntAgain
}
}
}
proc act_LegDoneRinging { } {
global isDebug
global aaParams
set status [infotag get evt_status]
if { $isDebug == "true" } {
puts "\n proc act_LegDoneRinging: $status"
}
regexp {([0-9][0-9][0-9])} $status StatusCode
if { $StatusCode != "000" } {
act_Select
}
}
proc act_Select { } {
global isDebug
global promptFlag2
global destBusy
global param1
global fcnt
global retrycnt
global busyPrompt
global aaParams
if { $isDebug == "true" } {
puts "\n proc act_Select"
}
set promptFlag2 0
set param1(interruptPrompt) true
set param1(abortKey) *
set param1(terminationKey) #
set param1(dialPlan) true
set param1(dialPlanTerm) true
leg collectdigits leg_incoming param1
if { $fcnt < $retrycnt } {
media play leg_incoming $busyPrompt %s500 _enter_dest_$aaParams(aaPilot).au
incr fcnt
fsm setstate GETDEST
} else {
act_DestBusy
}
}
proc act_DestBusy { } {
global isDebug
if { $isDebug == "true" } {
puts "\n proc act_DestBusy"
}
media play leg_incoming _disconnect.au
fsm setstate CALLDISCONNECT
}
proc act_Debug { } {
global isDebug
if { $isDebug == "true" } {
set evtName [infotag get evt_event]
puts "act_Debug got: $evtName"
}
}
proc act_Cleanup { } {
puts "Call finished"
call close
}
requiredversion 2.0
init
init_ConfigVars
set fsm(any_state,ev_disconnected) "act_Cleanup same_state"
set fsm(any_state,ev_disconnect_done) "act_Cleanup same_state"
set fsm(any_state,ev_any_event) "act_Debug same_state"
set fsm(CONTINUE,ev_setup_done) "act_LegDone same_state"
set fsm(WAITWAITWAIT,ev_setup_done) "act_LegDone same_state"
set fsm(JUSTMUSIC,ev_setup_done) "act_LegDone same_state"
set fsm(RINGING,ev_setup_done) "act_LegDoneRinging same_state"
set fsm(CALL_INIT,ev_setup_indication) "act_Setup GETDEST"
set fsm(GETDEST,ev_collectdigits_done) "act_GotDest HANDOFF"
set fsm(MEDIAOUT,ev_media_done) "act_HuntAgain CONTINUE"
set fsm(WAITWAITWAIT,ev_named_timer) "act_MediaHunt CONTINUE"
set fsm(WAITWAITWAIT,ev_media_done) "act_NoMediaHunt CONTINUE"
set fsm(CALLDISCONNECT,ev_media_done) "act_Cleanup same_state"
set fsm(JUSTMUSIC,ev_media_done) "act_JustMusic JUSTMUSIC"
fsm define fsm CALL_INIT