# Script Locked by: CiscoOfficial
# Script Version: 2.0.1.1
# Script Name: app_faxmail_offramp
# Script Lock Date: Tue Apr 2 16:17:47 2002
#
#------------------------------------------------------------------
# January 2000, Fary Aryaman
#
# Copyright (c) 2001 by Cisco Systems, Inc.
# All rights reserved.
#
# Offramp script for Faxmail T.37 Store and Forward Fax
#------------------------------------------------------------------
#
# Script compatability matrix:
#
# IOS version compatability
# Any 12.2(0.x)T images where x > 19
#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
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 "\nAuthentication control is $auCtrl"
if { [ infotag get cfg_avpair_exists accounting] } {
set accountCtrl [ infotag get cfg_avpair accounting ]
if { $accountCtrl == "enable" } {
set accCtrl 1
}
}
puts "\nAccounting 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 "\nAuthentication method is $auMethod"
if { [ infotag get cfg_avpair_exists password] } {
set password [ infotag get cfg_avpair password ]
} else {
set password ""
}
puts "\nDefault 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 "\Accounting method is $accountList"
}
proc act_Setup { } {
global args
global auMethod
global account
global auCtrl
global accCtrl
global accountList
init_ConfigVars
if { $auMethod == 0 } {
if { $auCtrl == 1} {
puts "\nAuthentication 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
if { ($auCtrl == 0) || ($auMethod == 0) } {
set auStatus 1
act_handoff
return
}
if { [ infotag get cfg_avpair_exists authen-list] } {
set authenList [ infotag get cfg_avpair authen-list ]
} else {
# The default authentication list name
set authenList fax
}
set info(authen-list) $authenList
aaa authorize $account $password "" "" leg_incoming -s $authenList
fsm setstate AUTHORIZE
}
proc act_authorize_done { } {
global callInfo
global auStatus
set status [infotag get evt_status]
puts "\nstatus is $status"
if { $status == "ao_000" } {
set auStatus 1
} else {
set auStatus 0
}
act_handoff
}
proc act_handoff { } {
global account
global auStatus
global args
set args "[set args], au-status=[set auStatus]"
set args "[set args], account=[set account]"
handoff appl [ infotag get leg_incoming] lib_off_app $args
# call close
}
proc act_ADisc { } {
connection destroy con_all
}
proc act_DestroyDone { } {
leg disconnect LG_ALL
}
proc act_DiscDone { } {
call close
}
init
#----------------------------------
# State Machine
#----------------------------------
set fsm(CALL_INIT,ev_setup_indication) "act_Setup CALL_DISCONNECTING"
set fsm(CALL_ACTIVE,ev_disconnected) "act_ADisc CONF_DESTROYING"
set fsm(CONF_DESTROYING,ev_destroy_done) "act_DestroyDone CALL_DISCONNECTING"
set fsm(CALL_DISCONNECTING,ev_disconnect_done) "act_DiscDone CALL_DISCONNECTING"
set fsm(any_state,ev_disconnected) "act_DiscDone CALL_CLOSED"
set fsm(AUTHORIZE,ev_authorize_done) "act_authorize_done SAMESTATE"
fsm define fsm CALL_INIT
# Script Approval Signature: C/ce01