본문 바로가기

Window Programming/VB

Caller ID Software, Visual Basic


Caller ID Software
Programming
Hardware

Hardware
Hardware
Caller ID Software
Programming
Hardware
Contact


Microsoft Visual Basic Software Download

NOTE:This is an actual working version. For the program to work as intended you need an Identifier, Visual Basic 6.0, and Caller ID service from your telephone company.

These download files contains a Microsoft Visual Basic project file (Identifier.vbp) and form file (Identifier.frm). You must have enough experience with Visual Basic to know what to do with these files to get the application to work. It contains a form which uses the MS Comm Control. This control may need to be registered in order to work.

To download Version 6.0 click here... vb60.zip (10K bytes)

About the Software and Programming

The Identifier was designed to easily integrate with software applications. The Identifier sends an ASCII string to the computer via the serial port when ever it sees an event on a phone line. This event string is very simple to process.

If you want to integrate the Identifier with an existing application and you already know how to access a serial port, it should take less than an hour to write a basic interface.

This is an example Microsoft Visual Basic application which demonstrates how easily the Identifier interfaces with Visual Basic. It uses the MS Comm Control. This Microsoft control comes with Visual Basic.


UPDATE: This software was originally written in VB4 back in the mid '90's. Today there are much better ways to access the COM port. There are some suggestions on the MS Comm Control Page

The programming techniques to process the output from the Identifier explained here are still valid even though the code is outdated.

By the way this and the free VB modem caller id project are the only VB code I ever wrote. And they were written over 10 years ago. Go easy on the critique of my style.


The Identifier output strings (events) always start with a plus sign and end with a carriage return (see examples below). Be sure to also look at the Identifier's output example's page. as well as in "Identifier Event Format" section a couple of paragraphs down on this page.

This VB software monitors the serial port. It sets up the MS Comm control to fire an event upon reception of each character transmitted from the Identifier. It looks for a plus sign. Once it see the plus sign it saves the following characters until it sees a carriage return. As soon as it sees the carriage return it processes the event.

Comm Port Routine

The following portion of the source code shows how each character is processed as it is received from the serial port. This code runs when the MS Comm control fires its "comEvReceive" event. The character is assigned to the variable "strCommChar".

Select Case strCommChar 
  Case "+"              'Beginning of Identifier Event
    strIdentifier = ""
  Case Chr$(10)         'Ignore the Line Feed after the CR
    ' ignore line feed
  Case Chr$(13)         'Carriage Return, End of Identifier Event String
     IdentifierEvent (strIdentifier)  ' The Identifier Event is passed to a processing routine
   Case Else            'Append the received character to the Identifier String
     strIdentifier = strIdentifier + strCommChar 
End Select

Identifier Event Format

The first character after the plus sign identifies what type of Identifier event occurred. Although commas separate the data in the event string, it is actually a fixed field format. Therefore you do not have to search for the commas to extract the data. A simple substring function is all that is required because the data is always in the same place for each type of event.

WARNING: If you want to use a comma delimited function such as split() or filter(), beaware that the caller id name field may contain a comma. So on a +1 caller id event do not use these functions.

The following is an annotated example of the real time data from the Identifier with all events enabled. The example is two calls, one to another line with Caller ID and one to a line with Distinctive Ring but no Caller ID. This example has all realtime events enabled. Each type of event may selectively turn on or off. All data is output in a fixed field format.


+2,4,002				     OFF HOOK OUTGOING LINE 2
+5,3,002				     DTMF DIGIT 3 PRESSED LINE 2
+5,4,002					  "      4        "
+5,4,002					  "      4        "
+5,7,002					  "      7        "
+5,6,002					  "      6        "
+5,6,002					  "      6        "
+5,5,002					  "      5        "
+2,1,001				      RING START LINE 1
+2,2,001				      RING STOP LINE 1
+1,9543447665,Y E S TELECOM   ,001	      CALLER ID INFO INCOMING LINE 1
+2,1,001				      RING START LINE 1
+2,2,001				      RING STOP LINE 1
+2,3,001				      OFF HOOK INCOMING LINE 1
+2,0,002				      ON HOOK LINE 2 IDLE
+2,0,003				      ON HOOK LINE 1 IDLE


Event Processing Example

The following source code takes the Identifier Event string passed by the above Comm routine and extracts the information. The Identifier Event string is passed without the preceding plus sign. The first character indicates the type of Identifier Event. The types are:
  • 1 Caller ID, Number and Name
  • 2 Line Status
  • 3 Watchdog or Serial Number
  • 4 Caller ID, Out of Area or Private
  • 5 Touch Tone (DTMF)
  • 8 Caller ID Signal Error

Event Processing Source Code


strEventType = Mid$(strEvent, 1, 1)  'The first character indicates the type of event
Select Case strEventType
  Case "1"                                     'Caller ID Event
    intLineNumber = CByte(Mid$(strEvent, 30, 3)) 'Get line number
    strCallerIdNumber = Mid$(strEvent, 3, 10)    'Get Caller's phone number
    strCallerIdName = Mid$(strEvent, 14, 15)     'Get Caller ID Name
  Case "2"                                     'Line status event
    intLineNumber = CByte(Mid$(strEvent, 5, 3))  'Get Line Number
    Select Case Mid$(strEvent, 3, 1)             'Get type of line status event
    Case "0"                                       'On hook/Idle event
      strDialed(intLineNumber) = ""                  ' Clear all data
      strCallerIdName = ""
      strCallerIdNumber = ""
      strStatus = "Idle"
    Case "1"                                     'Ring Start Event
      strStatus = "Ringing"
    Case "3"                                     'Off Hook incoming call
      strStatus = "Answered"
    Case "4"
      strStatus = "Outgoing Call"                'Off Hook originating call
    End Select
  Case "3"                       'Serial Number or Watchdog Event
    Exit Sub                     ' Do not process
Case "4"                      'Caller ID Event - Out of Area or Private
    intLineNumber = CByte(Mid$(strEvent, 5, 3))
    strCallerIdNumber = ""
    If Mid$(strEvent, 3, 1) = "P" Then   'Private Caller ID, blocked by caller
      strCallerIdName = "Private"
    Else
      strCallerIdName = "Out of Area"    'Caller ID data not available to telco
    End If
    
  Case "5"                      'DTMF event
    intLineNumber = CByte(Mid$(strEvent, 5, 3)) 'Get line number and Save this digit
                                                ' with any previous digits received
                                                ' on this line
    strDialed(intLineNumber) = strDialed(intLineNumber) + Mid$(strEvent, 3, 1) 
              'Third char. of event is the Digit
Case "8"                                          ' Caller ID Signal Error Event
    intLineNumber = CByte(Mid$(strEvent, 5, 3))
    strCallerIdName = "Unknown"
End Select