📄 app_voicemail_offramp.2.0.0.0.tcl
字号:
# Script Locked by: CiscoOfficial# Script Version: 2.0.0.0# Script Name: app_voicemail_offramp# Script Lock Date: Wed Aug 7 16:17:02 2002##------------------------------------------------------------------# Copyright (c) 2002 by Cisco Systems, Inc.# All rights reserved.# # Offramp script for Mail Notification#------------------------------------------------------------------#proc init { } { global authen_methods set authen_methods(x-account) 1 set authen_methods(envelope-from) 2 set authen_methods(envelope-to) 3 set authen_methods(gateway) 4 set authen_methods(none) 0} proc init_ConfigVars { } { global account global auCtrl global accCtrl global auMethod global authen_methods global password global accountList global mailScript global dsnScript set account 0# authentication and accounting disabled by default set auCtrl 0 set accCtrl 0 if { [ infotag get cfg_avpair_exists authentication] } { set authenCtrl [ infotag get cfg_avpair authentication ] if { $authenCtrl == "enable" } { set auCtrl 1 } } puts "\n\t\t**** Authentication control is $auCtrl" if { [ infotag get cfg_avpair_exists accounting] } { set accountCtrl [ infotag get cfg_avpair accounting ] if { $accountCtrl == "enable" } { set accCtrl 1 } } puts "\n\t\t**** Accounting control is $accCtrl" set auMethod 0 if { [ infotag get cfg_avpair_exists authen-method] } { set auMethod [ infotag get cfg_avpair authen-method ] set auMethod $authen_methods($auMethod) } puts "\n\t\t**** Authentication method is $auMethod" if { [ infotag get cfg_avpair_exists password] } { set password [ infotag get cfg_avpair password ] } else { set password "" } puts "\n\t\t**** Default password is $password" if { [ infotag get cfg_avpair_exists accounting-list] } { set accountList [ infotag get cfg_avpair accounting-list ] } else { # The default accounting list name set accountList fax } puts "\n\t\t**** Accounting method is $accountList" if { [ infotag get cfg_avpair_exists mail-script] } { set mailScript [ infotag get cfg_avpair mail-script ] puts "\n\t\t**** mail-script configured $mailScript" } else { # The default accounting list name set mailScript voice-mail } puts "\offramp script is $mailScript"} proc act_Setup { } { global args global auMethod global account global auCtrl global accCtrl global accountList init_ConfigVars puts "\n\t\t**** app_voicemail_offramp.tcl: act_Setup" leg setupack leg_incoming leg proceeding leg_incoming leg connect leg_incoming if { $auMethod == 0 } { if { $auCtrl == 1} { puts "\n\t\t**** Authentication enabled but no method specified" set account "" } } elseif { $auMethod == 1 } { set account [ infotag get med_x_account ] } elseif { $auMethod == 2 } { set account [ infotag get med_envelope_from ] } elseif { $auMethod == 3 } { set account [ infotag get med_envelope_to ] } elseif { $auMethod == 4 } { set account [ infotag get cfg_gateway_id ] } set args "au-ctrl=[set auCtrl]" set args "[set args], acc-ctrl=[set accCtrl]" set args "[set args], au-method=[set auMethod]" set args "[set args], accounting-list=[set accountList]" act_authenticate}proc act_authenticate { } { global auMethod global account global auStatus global auCtrl global password puts "\n\t\t**** app_voicemail_offramp.tcl: act_authenticate" if { ($auCtrl == 0) || ($auMethod == 0) } { set auStatus 1 act_placecall return } if { [ infotag get cfg_avpair_exists authen-list] } { set authenList [ infotag get cfg_avpair authen-list ] } else { set authenList fax } set info(authen-list) $authenList aaa authorize $account $password "" "" leg_incoming info fsm setstate AUTHORIZE}proc act_authorize_done { } { global callInfo global auStatus set status [infotag get evt_status] puts "\n\t\t**** app_voicemail_offramp.tcl: act_authorize_done" puts "\n\t\t**** status is $status" if { $status == "ao_000" } { set auStatus 1 act_placecall } else { fsm setstate CALL_FAILED leg disconnect leg_incoming di_21 # cause REJECT }}proc act_placecall { } { puts "\n\t\t**** app_voicemail_offramp.tcl: act_placecall" set dnis [infotag get leg_dnis] set dnislen [string len $dnis ] puts "\n\t\t**** dnis before=$dnis" puts "\n\t\t**** dnis after=$dnis" if { $dnislen } { leg setup $dnis callInfo leg_incoming fsm setstate PLACECALL } else { puts "\n\t\t**** dnis length 0, closing call" call close } }proc act_CallSetupDone { } { global cause global account global auStatus global args global mailScript global dsnScript puts "\n\t\t**** app_voicemail_offramp.tcl: act_CallSetupDone" fsm setstate CALL_ACTIVE set status [infotag get evt_status] if { $status == "ls_000"} { # success puts "\n\t\t**** removing connection" } else { # error puts "\n\t\t**** bad return from setup req, status=$status" fsm setstate CALL_FAILED if {$status == "ls_006"} { # busy set cause "17" } elseif {$status == "ls_002"} { # RNA set cause "19" } elseif {$status == "ls_004"} { # invalid number set cause "28" } else { # unspecified set cause "31" } leg disconnect leg_incoming $cause }}proc act_ADisc { } { puts "\n\t\t**** app_voicemail_offramp.tcl: act_ADisc" call close}proc act_DestroyDone { } { puts "\n\t\t**** app_voicemail_offramp.tcl: act_DestroyDone" puts "\n\t\t**** disconnecting call leg"}proc act_DiscDone { } { global account global auStatus global args global mailScript global dsnScript set args "[set args], au-status=[set auStatus]" set args "[set args], account=[set account]" set args "[set args], mail-trigger=[infotag get leg_incoming]" puts "\n\t\t**** app_voicemail_offramp.tcl: act_DiscDone" puts "\n\t\t**** handoff to $mailScript" handoff appl [ infotag get leg_outgoing] $mailScript $args}init #----------------------------------# State Machine#---------------------------------- set fsm(CALL_INIT,ev_setup_indication) "act_Setup PLACECALL" set fsm(AUTHORIZE,ev_authorize_done) "act_authorize_done SAMESTATE" set fsm(PLACECALL,ev_setup_done) "act_DiscDone CALL_CLOSED" set fsm(CALL_ACTIVE,ev_destroy_done) "act_DiscDone CALL_CLOSED" fsm define fsm CALL_INIT# Script Approval Signature: C/f188
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -