home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Telecom
/
1996-04-telecom-walnutcreek.iso
/
caller-id
/
asp.procomm
< prev
next >
Wrap
Internet Message Format
|
1993-07-30
|
11KB
From telecom@delta.eecs.nwu.edu Fri Jul 23 12:37:33 1993
Received: from delta.eecs.nwu.edu by gaak.LCS.MIT.EDU via TCP with SMTP
id AA03577; Fri, 23 Jul 93 12:37:28 EDT
Received: by delta.eecs.nwu.edu id AA14039
(5.65c/IDA-1.4.4 for ptownson@gaak.lcs.mit.edu); Fri, 23 Jul 1993 11:37:20 -0500
Date: Fri, 23 Jul 1993 11:37:20 -0500
From: TELECOM Moderator <telecom@delta.eecs.nwu.edu>
Message-Id: <199307231637.AA14039@delta.eecs.nwu.edu>
To: ptownson@gaak.LCS.MIT.EDU
Subject: callid.asp.using.procomm
Status: RO
>From telecom Fri Jul 23 07:59:30 1993
Received: by delta.eecs.nwu.edu id AA09040
(5.65c/IDA-1.4.4 for \telecom); Fri, 23 Jul 1993 07:59:24 -0500
Received: from uvs1.orl.mmc.com by delta.eecs.nwu.edu with SMTP id AA29769
(5.65c/IDA-1.4.4 for <telecom@delta.eecs.nwu.edu>); Fri, 23 Jul 1993 07:58:46 -0500
Received: from TCCSLR.DECnet MAIL11D_V3 by uvs1.orl.mmc.com (5.57/Ultrix3.0-C)
id AA16314; Fri, 23 Jul 93 09:01:10 -0400
Date: Fri, 23 Jul 93 09:01:09 -0400
Message-Id: <9307231301.AA16314@uvs1.orl.mmc.com>
From: padgett@tccslr.dnet.mmc.com (A. Padgett Peterson, P.E. Information Security)
To: "telecom@delta.eecs.nwu.edu"@UVS1.dnet.mmc.com
Subject: Pat - Caller-ID ASPect file for procomm
Status: R
;**************************************************************
; CALLID.ASP (C) 1992 by Padgett Peterson
;
; CALLID.ASP is a PROCOMM Aspect script file that may be
; used on those telephone lines returning such information.
; This version is being made available as FREEWARE and may
; be included/distributed freely so long as 1) This copyright
; notice remains intact, 2) No changes are made to this
; script, and 3) No charge beyond a minimal distribution
; fee is levied.
;
; As such no warranty is made for fitness of any kind and
; use is strictly at the recipient's own risk.
;
; The program requires a modem that will return Caller-ID
; values when instructed. Use will permit screening of
; calls prior to the line being placed off-hook: if the
; calling number is blocked or does not appear in the file
; CALLID.DAT, the line will not be answered.
;
; One effective use would be on a line having both modem
; and FAX service. If the call is not from a known host,
; the modem will not pick up and the FAX or voice mail
; may connect instead. If this use is selected it will be
; necessary to set the FAX not to answer until sufficient
; time has elapsed after the first ring for the list of known
; numbers to be scanned and a decision made.
;
; CALLID makes use of two files CALLID.DAT, the repository
; of numbers to be answered in the format <number>;<text>.
; The <number> must contain all digits returned by the
; Caller-ID stream but the format is unimportant since all
; non-numeric characters will be stripped. Syntactically,
; (407)555-1212 is the same as 407.555.1212, 4075551212, or
; 407 555 1212. The second file CALLID.LOG is created or
; appended when the script executes and contains the information
; on calls attempted.
;
; For proper use as a PROCOMM "HOST" the HOST SETUP must be set
; to EXIT on completion. The only known problem at this time
; is the condition if an "approved" number calls the system
; and hangs up before a connection is made. In this case PROCOMM
; may "hang" in the HOST "waiting" mode and will answer the
; next call. This is a problem with the HOST mode that will require
; complete HOST emulation in the ASPECT file to correct (in work).
;
; Version History
;
; 0.71 (beta) 1 November 1992 Southern Bell/Supra FAX/Modem
; version, 1st issue.
;
; For more information contact the author at (407)352-6007 6-9 pm
; EST (no collect calls) or write to POB 1203, Windermere, FLA,
; 34786. Please enclose a #10 SASE.
;
; PROCOMM, PROCOMM+, and ASPECT are registered products of
; Datastorm Inc. (800)326-4799
;
; Supra FAX/Modem is a product of the Supra Corp. (800)727-8647
;
;*******************************************************************
;
define atcmd "AT^M" ; basic AT command
define cichk "AT#CID=?^M" ; these commands are valid for a Supra
define cicmd "AT#CID=1^M" ; FAX/Modem with Caller-ID enabled
define noans "ATS0=0^M" ; Reset modem to non-answer
define ringmsg "RING"
define okstr "OK"
define erstr "ERROR"
define blank " "
define logfil "callid.log" ; Log file for received calls
define datfil "callid.dat" ; Data files for "approved" numbers
;
; Global Variables
;
string idline,strnum,instr,crlf,tmps1,tmps2
integer idlen,tmpn1,flag,dflag,pos,char,nhi
;
proc main
;
;
strset crlf 10 1
;
; Setup
;
set keys on
set display off
vidsave 0
box 8 21 15 77 00
box 7 20 14 75 79
atsay 8 28 79 " Caller-ID Handler (C) 1992 by Padgett "
;
; Make sure modem is turned on
;
set rxdata on
atsay 10 22 79 "Waiting for Modem"
transmit noans
call getstr with &instr
call getstr with &instr
strcmp instr okstr 2
if success
atsay 10 22 79 "Modem Responding "
else
atsay 10 22 79 "Modem not responding "
set rxdata off
waitquiet 2 2
goto enditall
endif
;
; Check for Caller-Id supporting modem
;
atsay 10 40 79 "- Caller-ID Initializing"
set rxdata on
transmit cicmd
call getstr with instr ; flush command echo
call getstr with &instr ; get response
strcmp instr erstr 5 ; IF not "ERROR" assume OK
;
if success
atsay 10 65 79 "- Failed"
waitquiet 2 2
goto enditall
else
atsay 10 65 79 "- Success"
call getstr with instr ; flush OK
endif
;
; Open the data file
;
findfirst datfil
if found
atsay 11 22 79 "Data File Present"
fopen 0 datfil "rt"
if success
atsay 11 40 79 "- Opened"
dflag=1
else
atsay 12 22 79 "Data file could not be opened - terminating"
waitquiet 2 2
goto enditall
endif
else
atsay 11 22 79 "No Data File - Logging only"
dflag=0
endif
;
; Open the LOG file
;
openlog:
findfirst logfil
if found
fopen 1 logfil "at"
fseek 1 0 2
else
log open logfil
log close
goto openlog
endif
if success
atsay 12 22 79 "Log File -"
else
atsay 12 22 79 "Log file could not be opened - terminating"
waitquiet 2 2
goto close0
endif
;
; Record Date & Time to Log - monkey motion but allows both
; screen and file write
if dflag==0
fwrite 1 "Logging only, " 14
endif
strset tmps1 32 27
strupdt tmps1 "Opened:" 0 7
date tmps2
strupdt tmps1 tmps2 8 8
time tmps2 1
strupdt tmps1 tmps2 17 8
fatsay 12 42 79 "%.25s" tmps1
strupdt tmps1 crlf 25 1
tmpn1=26
fwrite 1 tmps1 tmpn1
;
; Create LOG Box
;
box 17 21 23 77 00
box 16 20 22 75 79
atsay 17 40 79 "- Received Calls -"
;
; Wait For Ring Signal
;
when 0 "RING" call numhan
ringlp:
atsay 13 22 79 "Waiting for Ring - Press any key to abort"
set display off
set rxdata off
;
if hitkey == 0
goto ringlp
endif
set keys off
goto close1
;
; End the program
;
close1:
fclose 1
close0:
if dflag == 1
fclose 0
endif
enditall:
cwhen 0
set rxdata off
vidrest 0
set display on
exit
endproc
;
;----------------------------------------------------------------------
;
; Procedure to concatenate numbers from a string up to the first blank
; and strip out all other characters
proc stripnum
strparm in1,out1
intparm j1
integer i1,p1,c1
;
; Find the limit of what is to be checked
;
find in1 ";" p1
if not found
strlen in1 p1
endif
;
; Now concatenate just the numbers
;
j1 = -1
strset out1 0 40
;
for i1 = 0 upto p1
strpeek in1 i1 c1
if (c1 > 47) && (c1 < 58)
j1= j1 + 1
strpoke out1 j1 c1
endif
endfor
;
endproc
;----------------------------------------------------------
;
; Procedure to create an input string of characters to <cr>
; from the COM port. May also be used to flush the port.
;
proc getstr
;
strparm gss
integer gsj,gsc
;
set rxdata on
strset gss 0 40
gsj=0
lp2:
comgetcd gsc
if gsc < 32
if (gsj != 0) || (gsc == -1)
goto endit
else
goto lp2
endif
endif
strpoke gss gsj gsc
gsj = gsj + 1
goto lp2
;
endit:
;
endproc
;
;---------------------------------------------------------------------------
;
; Call Handling Procedure - Procedure is called by WHEN "RING" command
;
proc numhan
;
cwhen 0
atsay 13 22 79 " Checking Number "
chklp:
strset instr 0 40
strset tmps2 0 41
call getstr with &instr ; get date
strcmp instr "TIME" 4
if not success
strcmp instr "RING" ; second string will be RING if no Caller-ID
if not success
goto chklp
else
goto endnh
endif
endif
;
scroll 1 18 22 21 74 79 ; new entry so scroll the screen
;
fatsay 21 22 79 "%.15s" instr
fwrite 1 instr 15 ; log the time
call getstr with &tmps1 ; get number
call stripnum with tmps1 &tmps2 &idlen ; strip it
;
if dflag == 0
atsay 13 22 79 " Logging Calling Number "
goto nonum
endif
;
; Check the number
;
rewind 0
;
while not eof 0
strset idline 0 41
fgets 0 idline
call stripnum with idline &strnum &idlen
if idlen < 1
goto noline
endif
strcmp strnum tmps2 idlen
if success
goto foundnum
endif
noline:
endwhile
;
; Number not found
;
atsay 13 22 79 " No Match - "
nonum:
flag=0
fwrite 1 " No Match " 10
fwrite 1 tmps2 40
fwrite 1 crlf 1
goto wrtnum
;
; Number Found
;
foundnum:
flag=1
fwrite 1 " Match " 10
;
; Strip any control characters out of idline
;
strlen idline pos
for nhi=1 upto pos
strpeek idline nhi char
if char < 32
strpoke idline nhi 32
endif
endfor
;
; Now output the entry to the LOG file
;
fwrite 1 idline 40
fwrite 1 crlf 1
strcpy tmps2 idline 40
;
; Put the Information on the screen also (last 4 numbers)
;
wrtnum:
fatsay 21 35 79 "%.40s" tmps2
;
; DOIT
;
if flag == 1
vidsave 1
atsay 13 22 79 " Number Matched - Entering HOST mode "
HOST
transmit noans ; Just to be sure
vidrest 1
endif
;
endnh:
set display off
set rxdata off
atsay 13 22 79 "System resetting - Waiting for silence "
waitquiet 5 forever
when 0 "RING" call numhan
endproc
;---------------------------------------------------------------------