⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app_debit_callback.2.0.0.0.tcl

📁 tcl app debit card system
💻 TCL
📖 第 1 页 / 共 2 页
字号:
        }    }}proc act_GotDest { } {    global callback_leg_id    global dontPlayAmount    global billing_model    global promptFlag2    global destination    global retryCnt    global account    global fcnt    global ani    global pin    set status [infotag get evt_status]    switch $status {	"cd_004" -	"cd_005"  {            set destination [infotag get evt_dcdigits]            set avsend(h323-ivr-out,0) "service:$billing_model"            aaa authorize $account $pin $ani $destination $callback_leg_id -a avsend	}	"cd_002 " {            if {$dontPlayAmount == 1} {                act_JustGetDest	    } else {                act_GetDest	    }            fsm setstate same_state 	}        "cd_003" -        "cd_006" -        "cd_007" -        "cd_010" {            incr fcnt            if {$fcnt < $retryCnt} {                set promptFlag2 1                act_GetDest                fsm setstate same_state	    } else {                 # No more tries                media play $callback_leg_id _generic_final.au                fsm setstate CALLDISCONNECT	    }       	}        "cd_001" {            incr fcnt            if {$fcnt < $retryCnt} {                set promptFlag2 3                act_GetDest                fsm setstate same_state            } else {                 # No more tries                media play $callback_leg_id _generic_final.au                fsm setstate CALLDISCONNECT	    }        	}    }}proc act_SecondAuthorized { } {    global callback_leg_id    global billing_model    global commandHandle    global promptFlag2    global destination    global noTimeLimit    global creditTime    global retryCnt    global warnTime    global noPlay    global fcnt    global guid        if {[infotag get aaa_avpair_exists h323-return-code]} {        # Get h323-return-code                set returnCode [infotag get aaa_avpair h323-return-code]        if {$returnCode == 13} {            # Allow user to make toll-free calls            set noTimeLimit 1             act_CallSetup        } elseif {$returnCode == 52} {            # Redirect to customer service using redirect number            set noTimeLimit 1             act_CallSetup        } else {            set status [infotag get evt_status]            switch $status {                "ao_000" {                    # Get credit time                    if {[infotag get aaa_avpair_exists h323-credit-time]} {                        set creditTime [infotag get aaa_avpair h323-credit-time]                    } else {	                set creditTime "uninitialized"                    }	            if {$creditTime == "uninitialized"} {                        media play $callback_leg_id _no_aaa.au                        fsm setstate CALLDISCONNECT	            } elseif {$creditTime == "umlimited"} {                        set noTimeLimit 1	            } elseif {[expr $creditTime - $warnTime] < 20} {                        set noPlay 1                        media play $callback_leg_id _you_have.au %t$creditTime _connect.au	            } else {                        media play $callback_leg_id _you_have.au %t$creditTime _connect.au    	            }                }	        default {                     # Authorization failed                    act_PlayReturnCode $returnCode                    if { $returnCode == 4 } {                        # Special case,no retry check also                        set noTimeLimit 1	            } else {                        fsm setstate CALLDISCONNECT	            }    	        }            }        }    } else {        # No return code from radius        media play $callback_leg_id _no_aaa.au        fsm setstate CALLDISCONNECT    }}proc act_PlayReturnCode {returnCode} {    global callback_leg_id    switch $returnCode {        3 {             media play $callback_leg_id _account_blocked.au        }        4 {             media play $callback_leg_id _zero_bal.au        }        5 {             media play $callback_leg_id _card_expired.au        }        7 {             media play $callback_leg_id _blocked.au        }        9 {             media play $callback_leg_id _dest_blocked.au        }        12 {            media play $callback_leg_id _not_enuf.au        }        default {             media play $callback_leg_id _no_aaa.au        }    }}proc act_CallSetup { } {    global callback_leg_id    global commandHandle    global destination    global newGuidInd    global account    global guid    if {$newGuidInd > 0} {        puts "\nleg setup with NEW GUID !!!\n"        set callInfo(newguid) true        set newGuidInd 0    } else {        puts "\nleg setup with OLD GUID !!!\n"    }    # Set the avlist for the callback leg    set avListSend(h323-call-origin,r) "callback"    aaa accounting update $callback_leg_id -a avListSend    # Set up call to destination    set new_guid2 [infotag get aaa_new_guid]    set new_guid3 [infotag get aaa_new_guid]    set dest_guids "$new_guid2 $new_guid3"    set callInfo(guid)         $dest_guids    set callInfo(incomingGuid) $guid    set callInfo(accountNum)   $account    leg setup $destination callInfo     set commandHandle [infotag get last_command_handle]}proc act_CallSetupDone { } {    global callback_leg_id    global dest_leg_id    global newGuidInd    set status [infotag get evt_status]    if {$status == "ls_000"} {        # Request for new guid for next call        set newGuidInd 1	set dest_leg_id [infotag get evt_legs]	# Connect the two legs	connection create $callback_leg_id $dest_leg_id      }  elseif { ($status == "ls_002") || ($status == "ls_004") ||                ($status == "ls_007") || ($status == "ls_009") || ($status == "ls_010") } {        # Call setup timeout/invalid no/Destination Busy/dest disconnect/conference failed/        act_DestBusy    } else {        # Leg setup fail         set tone [infotag get evt_status]        playtone $callback_leg_id $tone        timer start leg_timer 5  $callback_leg_id         fsm setstate CALLDISCONNECT    }}proc act_SetupTimer { } {    global callback_leg_id    global noTimeLimit    global creditTime    global warnTime    global noPlay    global pound    set pound 0    if {$noTimeLimit == 1 || $creditTime == "unlimited" || $creditTime == "uninitialized"} {        # No timer    } elseif {$creditTime < $warnTime} {        if {$noPlay == 1} {            timer start leg_timer [expr $creditTime -1] $callback_leg_id        } else {            timer start leg_timer [expr $warnTime - 4] $callback_leg_id        }        fsm setstate CALLLASTACTIVE    } else {        set delay [expr $creditTime - $warnTime]        timer start leg_timer $delay $callback_leg_id        fsm setstate CALLACTIVE    }}proc act_TerminateSetup { } {    global commandHandle    if {[infotag get evt_digit] == "#" } {        # Pound is pressed during setup        set DURATION 1000            set duration [infotag get evt_digit_duration]        if {$duration >= $DURATION} {            # Longpound detected            set returnCode [command terminate $commandHandle]            puts "\n supress any tones that might be active \n"            playtone leg_incoming "tn_none"            if {$returnCode == 0} {                # Continue to wait for the ev_setup_done            } elseif {$returnCode == 1} {                # The call setup command is done, no event will be returned                act_JustGetDest                fsm setstate GETDEST            } elseif {$returnCode == 2} {                # Invalid command.  Maybe setup had not been initiated,                # attempt to wait for it.                fsm setstate PLACECALL            }        } else {            # Not a long pound, ignore            fsm setstate same_state        }    } else {        # Ignore non-pound key entry        fsm setstate same_state    }}proc act_HandleOutgoing { } {    global outgoingDisconnect    global callback_leg_id    global pound    if {[infotag get evt_legs] != $callback_leg_id} {        # Called party party hung up        connection destroy con_all        set outgoingDisconnect 1        set pound 1    } else {        # Calling party hung up        call close         fsm setstate CALLDISCONNECT    }}proc act_LongPound { } {    global duration    global pound    set DURATION 1000    set evtDigit [infotag get evt_digit]    if {$evtDigit == "#"} {         # Pound is pushed        set duration [infotag get evt_digit_duration]        if {$duration >= $DURATION} {            # Long pound detected            set pound 1            connection destroy con_all        } else  {            set pound 0            fsm setstate same_state        }    } else {        fsm setstate same_state    }}proc act_JustGetDest { } {    global outgoingDisconnect     global callback_leg_id    global promptFlag2    global destBusy    global param2    global pound    global fcnt    set param2(ignoreInitialTermKey) true    leg collectdigits $callback_leg_id param2    if {$fcnt == 0} {        if {$outgoingDisconnect == 1} {            set outgoingDisconnect 0            media play $callback_leg_id _disconnect.au %s1000 _enter_dest.au        } elseif {$destBusy == 1} {            set destBusy 0            media play $callback_leg_id _dest_busy.au        } else {            media play $callback_leg_id _enter_dest.au        }    } else {        if {$promptFlag2 == 1} {            media play $callback_leg_id _reenter_dest.au        }        if {$promptFlag2 == 2} {            media play $callback_leg_id _author_fail.au        }        if {$promptFlag2 == 3} {            media play $callback_leg_id _no_dest_entered.au        }    } }proc act_ConnDestroyed { } {    global dontPlayAmount     global dest_leg_id    leg disconnect $dest_leg_id    init_perCallVars    set dontPlayAmount 1    act_JustGetDest}proc act_DestBusy { } {    global destBusy        set destBusy 1    act_JustGetDest    fsm setstate GETDEST}proc act_ActiveTimer { } {    global callback_leg_id    global dest_leg_id    global creditTime    global warnTime    global noPlay    if {$noPlay == 1} {        timer start leg_timer  [expr $creditTime -1] $callback_leg_id    } else {        connection destroy con_all        timer start leg_timer [expr $warnTime - 4] $callback_leg_id        fsm setstate CALLWARN    }}proc act_CallWarnDestroy { } {    global warnTime    media play $callback_leg_id _you_have.au %t$warnTime}proc act_CallWarnMedia { } {    global callback_leg_id    global dest_leg_id    connection create $callback_leg_id $dest_leg_id  }proc act_ConnectionDestroy { } {    connection destroy con_all}proc act_LastActiveTimer { } {    media play $callback_leg_id _disconnect.au}proc act_Ignore { } {    puts "Event Capture"}proc act_Cleanup { } {    call close}requiredversion 2.0init # Get Variablesinit_ConfigVars#----------------------------------#   State Machine#----------------------------------set fsm(any_state,ev_disconnected)           "act_Cleanup           same_state"  set fsm(CALL_INIT,ev_setup_indication)       "act_Setup             AUTHENTICATE" set fsm(AUTHENTICATE,ev_authorize_done)      "act_Authenticated     BEEP"set fsm(BEEP,ev_leg_timer)                   "act_Cleanup           same_state"set fsm(BEEP,ev_disconnected)                "act_Disconnect        DISCONNECT" set fsm(DISCONNECT,ev_disconnect_done)       "act_ReSetup           RESETUP"set fsm(RESETUP,ev_setup_done)               "act_ReSetupDone       LANGSELECTION"set fsm(ONELANG,ev_media_done)               "act_GetCard           CARDSELECTION"set fsm(LANGSELECTION,ev_collectdigits_done) "act_LangSelect        CARDSELECTION"set fsm(CARDSELECTION,ev_collectdigits_done) "act_GotCardNumber     AUTHORIZE"  set fsm(AUTHORIZE,ev_authorize_done)         "act_FirstAuthorized   GETDEST"set fsm(GETDEST,ev_collectdigits_done)       "act_GotDest           SECONDAUTHORIZE"set fsm(SECONDAUTHORIZE,ev_authorize_done)   "act_SecondAuthorized  PLACECALL"set fsm(SECONDAUTHORIZE,ev_setup_done)       "act_CallSetupDone     CONFERENCING"set fsm(PLACECALL,ev_media_done)             "act_CallSetup         PLACECALL"set fsm(PLACECALL,ev_digit_end)              "act_TerminateSetup    WAITFORSETUPDONE"  set fsm(PLACECALL,ev_setup_done)             "act_CallSetupDone     CONFERENCING"set fsm(WAITFORSETUPDONE,ev_setup_done)      "act_JustGetDest       GETDEST"set fsm(CONFERENCING,ev_create_done)         "act_SetupTimer        CALLACTIVE"set fsm(CALLACTIVE,ev_leg_timer)             "act_ActiveTimer       CALLLASTACTIVE"set fsm(CALLACTIVE,ev_digit_end)             "act_LongPound         CONNDESTROY"set fsm(CALLACTIVE,ev_disconnected)          "act_HandleOutgoing    CONNDESTROY"set fsm(CALLLASTACTIVE,ev_leg_timer)         "act_ConnectionDestroy PLAYDISCONNECT"set fsm(CALLLASTACTIVE,ev_digit_end)         "act_LongPound         CONNDESTROY"set fsm(PLAYDISCONNECT,ev_destroy_done)      "act_LastActiveTimer   CALLDISCONNECT"set fsm(CALLWARN,ev_destroy_done)            "act_CallWarnDestroy   same_state"set fsm(CALLWARN,ev_media_done)              "act_CallWarnMedia     CALLLASTACTIVE"set fsm(CALLWARN,ev_destroy_done)            "act_CallWarnDestroy   same_state"set fsm(CALLWARN,ev_media_done)              "act_CallWarnMedia     same_state"set fsm(CALLWARN,ev_create_done)             "act_Ignore            CALLLASTACTIVE"set fsm(CONNDESTROY,ev_destroy_done)         "act_ConnDestroyed     GETDEST"set fsm(CALLDISCONNECT,ev_media_done)        "act_Cleanup           same_state"set fsm(CALLDISCONNECT,ev_disconnect_done)   "act_Cleanup           same_state"set fsm(CALLDISCONNECT,ev_leg_timer)         "act_Cleanup           same_state"  fsm define fsm CALL_INIT# Script Approval Signature: C/367d

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -