/* Script to Answer On Voice Calls */

Call RxFuncAdd 'SysSleep', 'RexxUtil', 'SysSleep'
Call RxFuncAdd 'SysGetKey', 'RexxUtil', 'SysGetKey'
Call RxFuncAdd 'SysCls', 'RexxUtil', 'SysCls'
Call RxFuncAdd 'SysTempFileName', 'RexxUtil', 'SysTempFileName'
Call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'

signal on halt

crlf=d2c(13)d2c(10)
beginf_w='FE'
beginf_s='B6'
endf='A5A5'
i=0

/* ------------- Entry Point -------------- */

Call SysCls

rc=crlf "       Automatic AVC56 AutoAnswer v 1.00 (c) By Alek Winner." crlf
say rc

parse arg filename


do until rc = ''
rc=c2x(charin(filename,,1))

if rc=beginf_w | rc=beginf_s then
 do
 rc=c2x(charin(filename,,1))
 if rc=beginf_w | rc=beginf_s then i=i+1
 end

end

say "Frames="i
say i*0.02 "sec"

call stream filename,'c','close'

rc=chars(filename)

say "Real" rc / 38 * 0.02

call stream filename,'c','close'
