home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pcboard / callid11.zip / CALLID11.EXE / CALLERID.PPS < prev    next >
Text File  |  1993-06-19  |  5KB  |  171 lines

  1. ; *****************************************************************
  2. ; *                                                               *
  3. ; *                       CALLERID V 1.10                         *
  4. ; *                                                               *
  5. ; *                    Written in PPL for PCBoard                 *
  6. ; *                                                               *
  7. ; *                    Designed By:  Gary Meeker                  *
  8. ; *                                                               *
  9. ; *                    Began development: 04-06-93                *
  10. ; *                                                               *
  11. ; *****************************************************************
  12. ;
  13. ; This .PPE checks the secrity level of a user and if within the specified
  14. ; range, checks the Caller ID info for the phone number. If a number is
  15. ; found, then it writes it to the file specified.
  16. ;
  17. ; Usage:
  18. ;
  19. ; !Verify.PPE SecLow;SecHigh;IDType;CIDFile;PrivateFile;OutsideFile;NoMatchFile
  20. ;
  21. ; Where:
  22. ;      SecLow is the lowest level to display the file to
  23. ;     SecHigh is the highest level to display the file to
  24. ;      IDType is the type of Caller ID info or Position of the PhoneNumber+11
  25. ;             Predefined formats are 1-10
  26. ;             1 = Supra - scan for "NMBR = "           6
  27. ;             2 = ZyXEL - scan for "NUMBER: "          7
  28. ;             3                                        8
  29. ;             4                                        9
  30. ;             5                                       10
  31. ;     CIDFile is the caller ID file to create
  32. ; PrivateFile is the file to be displayed if the ID indicates Private
  33. ; OutsideFile is the file to be displayed if the ID indicates Outside Area
  34. ; NoMatchFile is the file to be displayed if the ID does not match Users Record
  35. ;
  36.  
  37. STRING CID, CIDFile, PrivateFile, NoMatchFile, OutsideFile
  38. STRING Private, Outside, Search(10)
  39. STRING HVPHONE, BDPHONE, TEMP, PhoneNumber, Filter
  40. INTEGER SecLow, SecHigh, IDType, Pos, OffSet, X
  41.  
  42. ;Assume a "P" indicates a PRIVATE number and "O" indicates a OUTSIDE AREA number
  43.  
  44. Private = "P"
  45. Outside = "O"
  46.  
  47. ;Characters to Filter out of Users Record Phone Numbers
  48.  
  49. Filter = " -()+"
  50.  
  51. ;Parse the command line
  52.  
  53. GETTOKEN SecLow
  54. GETTOKEN SecHigh
  55. GETTOKEN IDType
  56. GETTOKEN CIDFile
  57. GETTOKEN PrivateFile
  58. GETTOKEN OutsideFile
  59. GETTOKEN NoMatchFile
  60.  
  61. ;Create search Strings
  62.  
  63. Search(1) = "NMBR = "
  64. Search(2) = "NUMBER: "
  65.  
  66. ;Delete any existing CIDFile first if one was specified
  67.  
  68. IF (CIDFile <> "") THEN
  69.    IF (EXIST(CIDFile)) THEN
  70.       DELETE CIDFile
  71.    END IF
  72. END IF
  73.  
  74. ;Get the Caller ID string and the Users info so we can get to U_SEC and such
  75.  
  76. CID = CALLID()
  77.  
  78. GETUSER
  79.  
  80. ;Bail out if not within the desiredSecurity range or no Caller ID info
  81.  
  82. IF (U_Sec < SecLow | U_Sec > SecHigh | CID = "") STOP
  83.  
  84.  
  85. IF (NoMatchFile<>"") THEN
  86.  
  87.    ;Get HVPhone number and strip out other characters.
  88.  
  89.    TEMP = U_HVPHONE
  90.    GOSUB DoFilter
  91.    HVPHONE = TEMP
  92.  
  93.    ;Get BDPhone number and strip out other characters.
  94.  
  95.    TEMP = U_BDPHONE
  96.    GOSUB DoFilter
  97.    BDPHONE = TEMP
  98. END IF
  99.  
  100. ;Find the postion of the Phone Number in the Caller ID string
  101.  
  102. IF (IDType < 11) THEN
  103.    Pos = INSTR(CID, Search(IDType))
  104.    Offset = LEN(Search(IDType))
  105. ELSE
  106.    Pos = IDType
  107.    Offset = -11
  108. END IF
  109.  
  110. IF (Offset = 0) THEN
  111.    PRINTLN "I don't know that IDType! ("; IDType; ")"
  112.    STOP
  113. ELSEIF (Pos = 0) THEN
  114.    PRINTLN "Search Key not Found! ("; Search(IDType); ")"
  115.    STOP
  116. END IF
  117.  
  118. ;Pull out just the Phone Number
  119.  
  120. PhoneNumber = UPPER(TRIM(MID(CID, Pos + Offset, 10), " "))
  121.  
  122. ;If it's PRIVATE then show the file if specified
  123.  
  124. IF (LEFT(PhoneNumber, 1) = Private & PrivateFile  <> "") THEN
  125.    IF (EXIST(PrivateFile)) THEN
  126.       DISPFILE PrivateFile, LANG+SEC+GRAPH
  127.    END IF
  128.  
  129. ;If it's OUTSIDE AREA then show the file if specified
  130.  
  131. ELSEIF (LEFT(PhoneNumber, 1) = Outside & OutsideFile <> "") THEN
  132.    IF (EXIST(OutsideFile)) THEN
  133.       DISPFILE OutsideFile, LANG+SEC+GRAPH
  134.    END IF
  135.  
  136. ;If it's not Home/Voice or Business/Data then show the file if specified
  137.  
  138. ELSEIF (NoMatchFile <> "" & RIGHT(PhoneNumber, LEN(HVPHONE)) <> HVPHONE & RIGHT(PhoneNumber, LEN(BDPHONE)) <> BDPHONE) THEN
  139.    IF (EXIST(NoMatchFile)) THEN
  140.       DISPFILE NoMatchFile, LANG+SEC+GRAPH
  141.    END IF
  142. END IF
  143.  
  144. ;Verify all digits and a full 10 of them at that
  145.  
  146. IF (LEN(PhoneNumber) < 10) STOP
  147. FOR Pos = 1 TO 10
  148.    IF (INSTR(MASK_NUM(), MID(PhoneNumber, Pos, 1)) = 0) STOP
  149. NEXT Pos
  150.  
  151. ;Write the number as AAA-EEE-NNNN to the desired file if specifed
  152.  
  153. IF (CIDFile <> "") THEN
  154.    FCREATE 1, CIDFile, O_WR, S_DB
  155.       FPUTLN 1, LEFT(PhoneNumber, 3), "-", MID(PhoneNumber, 4, 3), "-", RIGHT(PhoneNumber, 4)
  156.    FCLOSE 1
  157. END IF
  158.  
  159. END
  160.  
  161. :DoFilter
  162.    FOR X = 1 TO LEN(Filter)
  163.       TEMP = STRIP(TEMP, MID(Filter, X, 1))
  164.    NEXT X
  165.    IF (TEMP = "") THEN
  166.       TEMP = "0000000000"
  167.    ELSEIF (LEFT(TEMP, 1) = "1") THEN
  168.       TEMP = MID(TEMP, 2, LEN(TEMP)-1)
  169.    END IF
  170. RETURN
  171.