You are on page 1of 2

#---------------------------------

# Welcome message + call


#---------------------------------

proc act_Setup { } {
puts "\n---- in act_Setup \n"
leg proceeding leg_incoming
leg connect leg_incoming
media play leg_incoming flash:welcome.au
puts "\n---- playing welcome.au \n"
}
proc act_playtone_ring { } {
global dest
puts "\n---- in palytone ring \n"
set dest 1234
leg setup $dest callInfo leg_incoming

}
proc act_playtone_busy { } {
global delay
puts "\n---- in palytone busy \n"
playtone leg_incoming tn_busy
}
proc act_CallSetupDone { } {
puts "\n---- in act_CallSetupDone \n"
set status [infotag get evt_status]
playtone leg_incoming tn_none
if { $status != "ls_000"} {
puts "\n ------ status$status ------\n"
if { $status == "ls_007" } {
puts "The call was released with User Busy\n"
media play leg_incoming flash:welcome.au
puts "------- returning after playing busy\n"
fsm setstate CALL_INIT
return
}
puts "\n----- fell through to close the call --\n"
call close
}
}
proc act_Cleanup { } {
puts "\n---- in act_Cleanup \n"
call close
}

#----------------------------------
# State Machine
#----------------------------------
set fsm(any_state,ev_disconnected) "act_Cleanup same_state"
set fsm(CALL_INIT,ev_setup_indication) "act_Setup same_state"
set fsm(CALL_INIT,ev_media_done) "act_playtone_ring PLACECALL"

set fsm(PLACECALL,ev_setup_done) "act_CallSetupDone CALLACTIVE"


set fsm(PLACECALL,ev_media_done) "act_playtone_busy same_state"
set fsm(PLACECALL,ev_leg_timer) "act_Cleanup same_state"
set fsm(CALLACTIVE,ev_disconnected) "act_Cleanup CALLDISCONNECT"
set fsm(CALLDISCONNECT,ev_disconnected) "act_Cleanup same_state"
set fsm(CALLDISCONNECT,ev_media_done) "act_Cleanup same_state"
set fsm(CALLDISCONNECT,ev_disconnect_done) "act_Cleanup same_state"
fsm define fsm CALL_INIT

You might also like