C# - TAPI Question

Hi guys 'n gals,

I have a phone line attached to my computer's modem, I would like to make a bit of software which will, detect when a phone rings up the line connected to the computer, and tell me the number of the caller. Anybody have any ideas on this?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the CallNotificationEvent() to capture the CallerID...  This example is in VB.Net but could easily be converted to C# >:)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cyber-DrugsAuthor Commented:

Thanks for the link, it's quite a large bit of code in there doing numerous different things, am I right in assuming I only need the following?

Import TAPI3Lib

        Private Sub CallNotificationEvent()
            ' here we should check to see various notifications of new and ended calls

            Select Case CallNotificationObject.Event

                    ' the notification is for a monitored call

                    ' the notification is for an owned call
            End Select

        End Sub

and merely, convert that to C#, or do I need more for what I am trying to achieve?
This is the event handler portion that you would need as well to process the event:
        Private CallInfoObject As ITCallInfoChangeEvent
        Private Sub CallInfoEvent()
            ' here you can extract information from the call

            'the code to extract the caller ID
            ' >>> put the following code in a try block and swallow the exception if it gives errors
            Dim CallerID As String
            CallerID = CallInfoObject.Call.CallInfoString(CALLINFO_STRING.CIS_CALLERIDNAME)

        End Sub
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Cyber-DrugsAuthor Commented:
Sorry to sound a bit daft, but what triggers the function call when the Modem is contacted by an outside phone line? Should I have something checking the status every few seconds, or how does this work?

the code example that wz on codeproject creates a "listener" that connects to the TAPI... so you should not need anything more there...
Cyber-DrugsAuthor Commented:

Just to let you know, I haven't forgot about this question, I've just been quite a bit busy, I will hopefully to get to close this question off this evening, if everything goes smoothly.

Thank you for your patience thus far.
Cyber-DrugsAuthor Commented:
Sorry for taking so long to get around to accepting this question, I've been a bit busy with a few other things, thanks for your patience. :o)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.