home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
pcboard
/
callid11.zip
/
CALLID11.EXE
/
CALLERID.PPS
< prev
next >
Wrap
Text File
|
1993-06-19
|
5KB
|
171 lines
; *****************************************************************
; * *
; * CALLERID V 1.10 *
; * *
; * Written in PPL for PCBoard *
; * *
; * Designed By: Gary Meeker *
; * *
; * Began development: 04-06-93 *
; * *
; *****************************************************************
;
; This .PPE checks the secrity level of a user and if within the specified
; range, checks the Caller ID info for the phone number. If a number is
; found, then it writes it to the file specified.
;
; Usage:
;
; !Verify.PPE SecLow;SecHigh;IDType;CIDFile;PrivateFile;OutsideFile;NoMatchFile
;
; Where:
; SecLow is the lowest level to display the file to
; SecHigh is the highest level to display the file to
; IDType is the type of Caller ID info or Position of the PhoneNumber+11
; Predefined formats are 1-10
; 1 = Supra - scan for "NMBR = " 6
; 2 = ZyXEL - scan for "NUMBER: " 7
; 3 8
; 4 9
; 5 10
; CIDFile is the caller ID file to create
; PrivateFile is the file to be displayed if the ID indicates Private
; OutsideFile is the file to be displayed if the ID indicates Outside Area
; NoMatchFile is the file to be displayed if the ID does not match Users Record
;
STRING CID, CIDFile, PrivateFile, NoMatchFile, OutsideFile
STRING Private, Outside, Search(10)
STRING HVPHONE, BDPHONE, TEMP, PhoneNumber, Filter
INTEGER SecLow, SecHigh, IDType, Pos, OffSet, X
;Assume a "P" indicates a PRIVATE number and "O" indicates a OUTSIDE AREA number
Private = "P"
Outside = "O"
;Characters to Filter out of Users Record Phone Numbers
Filter = " -()+"
;Parse the command line
GETTOKEN SecLow
GETTOKEN SecHigh
GETTOKEN IDType
GETTOKEN CIDFile
GETTOKEN PrivateFile
GETTOKEN OutsideFile
GETTOKEN NoMatchFile
;Create search Strings
Search(1) = "NMBR = "
Search(2) = "NUMBER: "
;Delete any existing CIDFile first if one was specified
IF (CIDFile <> "") THEN
IF (EXIST(CIDFile)) THEN
DELETE CIDFile
END IF
END IF
;Get the Caller ID string and the Users info so we can get to U_SEC and such
CID = CALLID()
GETUSER
;Bail out if not within the desiredSecurity range or no Caller ID info
IF (U_Sec < SecLow | U_Sec > SecHigh | CID = "") STOP
IF (NoMatchFile<>"") THEN
;Get HVPhone number and strip out other characters.
TEMP = U_HVPHONE
GOSUB DoFilter
HVPHONE = TEMP
;Get BDPhone number and strip out other characters.
TEMP = U_BDPHONE
GOSUB DoFilter
BDPHONE = TEMP
END IF
;Find the postion of the Phone Number in the Caller ID string
IF (IDType < 11) THEN
Pos = INSTR(CID, Search(IDType))
Offset = LEN(Search(IDType))
ELSE
Pos = IDType
Offset = -11
END IF
IF (Offset = 0) THEN
PRINTLN "I don't know that IDType! ("; IDType; ")"
STOP
ELSEIF (Pos = 0) THEN
PRINTLN "Search Key not Found! ("; Search(IDType); ")"
STOP
END IF
;Pull out just the Phone Number
PhoneNumber = UPPER(TRIM(MID(CID, Pos + Offset, 10), " "))
;If it's PRIVATE then show the file if specified
IF (LEFT(PhoneNumber, 1) = Private & PrivateFile <> "") THEN
IF (EXIST(PrivateFile)) THEN
DISPFILE PrivateFile, LANG+SEC+GRAPH
END IF
;If it's OUTSIDE AREA then show the file if specified
ELSEIF (LEFT(PhoneNumber, 1) = Outside & OutsideFile <> "") THEN
IF (EXIST(OutsideFile)) THEN
DISPFILE OutsideFile, LANG+SEC+GRAPH
END IF
;If it's not Home/Voice or Business/Data then show the file if specified
ELSEIF (NoMatchFile <> "" & RIGHT(PhoneNumber, LEN(HVPHONE)) <> HVPHONE & RIGHT(PhoneNumber, LEN(BDPHONE)) <> BDPHONE) THEN
IF (EXIST(NoMatchFile)) THEN
DISPFILE NoMatchFile, LANG+SEC+GRAPH
END IF
END IF
;Verify all digits and a full 10 of them at that
IF (LEN(PhoneNumber) < 10) STOP
FOR Pos = 1 TO 10
IF (INSTR(MASK_NUM(), MID(PhoneNumber, Pos, 1)) = 0) STOP
NEXT Pos
;Write the number as AAA-EEE-NNNN to the desired file if specifed
IF (CIDFile <> "") THEN
FCREATE 1, CIDFile, O_WR, S_DB
FPUTLN 1, LEFT(PhoneNumber, 3), "-", MID(PhoneNumber, 4, 3), "-", RIGHT(PhoneNumber, 4)
FCLOSE 1
END IF
END
:DoFilter
FOR X = 1 TO LEN(Filter)
TEMP = STRIP(TEMP, MID(Filter, X, 1))
NEXT X
IF (TEMP = "") THEN
TEMP = "0000000000"
ELSEIF (LEFT(TEMP, 1) = "1") THEN
TEMP = MID(TEMP, 2, LEN(TEMP)-1)
END IF
RETURN