No announcement yet.

TAPI CallerID again

  • Filter
  • Time
  • Show
Clear All
new posts

    TAPI CallerID again

    I know this topic is on this forum and many others.
    I am trying to create a small program to show the telephone number of an incoming call.
    There seem to be a million ways to do it in VB, C#, .Net, etc, but I can't seem to find any way to do it in PB.

    This is using a normal modem (internal or external).
    No accessing the registry
    Win 98 through Vista (hopefully 95 too)

    From what I understand, the general steps are:
    1. Create a connection using lineInitializeEx
    A callback function is lauched in step 1 that can be used to trap various events.\
    2. Negotiate the TAPI version
    3. Select a device to use
    4. open that device using LineOpen

    5. Look for the callback message of %LINE_CALLSTATE and specifcally %LINECALLSTATE_OFFERING
    6. At that point, use LINE_CALLINFO to get the information of the incoming call
    5. Use LineGetCallStatus to see if it is offering
    6. Same as 6 above

    Am I missing something? Does anybody have PB examples of anything close to this?
    I go through the steps, but the code under LINECALLSTATE never is executed and LIneGetCallStatus gives an unknown status.

    oh, and yes, there is a phone line connected that can be used by other programs

    Any help would be appreciated.


    Bill Scharf

    [This message has been edited by Bill Scharf (edited May 02, 2007).]
    Bill Scharf

    Hello Bill,

    Search the source code forum for my posts of TAPI code.
    I had to overcome the all the hurdles of creating and initializing
    TAPI. From there you should be able to use LineGetCallStatus.

    Kind Regards


      What do you use to get the phone line into the computer?
      I'm sure caller id modem would work, but curious how others do it.
      I have used ani-232 adaptors for many years and have code if anyone needs it.
      The problem with this method is it only supports 1-line and the adaptors
      aren't getting very hard to find from Rochelle Communications.


      [This message has been edited by Mike Doty (edited May 06, 2007).]


        You can also use a multi-line unit. (We often used the one-line unit from Whozz Calling)


        "Simplicity is a prerequisite for reliability"


          i apologize for the slow reply--we just had our first child and i don't think my wife wanted me to bring the laptop to the hospital.

          thanks mike t, mike d, and peter. to mike d and peter--additional hardware is not an option. this is a very small feature of a program that many thousand users will use.
          mike trader--i very much appreciate your example at
          you did get much further than i ever would have. i had seen your example before and still could not get an "offering" status from the phone.
          however, i tried a few other shareware callerid programs (just to make sure everything with the hardware and os is set up), and all of a sudden now i am getting an "offering" status?!?!
          let me try to exaplain--here is the code:
              'this uses your code in which the wm_initdialog section of tapicallback 
              'does the initialization, version negotiation, and getlinedevcaps.
              'i added another button titled "listen" whose id is 777
              'in tapicallback i have simply this:
              case 777'"listen"
                   stemp = openline( devselected ) ' returns hline
                   'stemp returns no error
          with no other programs running, a call coming in does not get to %linecallstate_offering in linecallbackfunc
          with a program called phonetray running, the "offering" message does get there. therefore, i am guessing that i am forgetting a step somewhere--maybe with initializing something with the os and the other program is doing it for me...?
          does anybody know what might be going on? any guesses would be appreciated. please excuse my ignorance if i am overlooking anything obvious.

          bill scharf

          [this message has been edited by bill scharf (edited may 17, 2007).]
          Bill Scharf


            Does the MODEM have Caller ID?

            Is it enabled?

            See: and the user's
            manual for your MODEM.

            If the MODEM doesn't send Caller ID info to the PC, the PC can't
            display it





              This is a valid point, but something I have already thought about. This is one reason I tried a few other callerID programs with success. However, I am not even getting to the point of getting the call's info--I cannot seem to detect when the call is coming in unless PhoneTray is running.

              Bill Scharf
              Bill Scharf


                Did you look at the bottom of the page in the link?

                The number should be between the first and second "RING".

                A COMM LINE INPUT on a loop should let you capture it.