views:

67

answers:

1

Is it possible to read bytes directly from modem or phone line without losing any info? If use SerialPort after ringing nothing happened on ReceiveData event! I want to read caller id info directly from line. My modem doesn't support Caller Id!

+3  A: 

The correct way to detect the caller ID is to use the TAPI API.

You can find a C# TAPI library (called ITAPI3) here. http://www.julmar.com/tapi/

Check the April 04, 2006 blog entry for some notes on building programs linked against it on 64-bit Windows.

And here's sample code:

TTAPI tapi = new TTAPI();

tapi.TE_CALLINFOCHANGE += (sender, e) =>
{
    if (e.Cause == CALLINFOCHANGE_CAUSE.CIC_CALLERID)
    {
        Console.WriteLine(e.Call.get_CallInfo(CALLINFO_STRING.CIS_CALLERIDNUMBER));
        Console.WriteLine(e.Call.get_CallInfo(CALLINFO_STRING.CIS_CALLERIDNAME));
    }
}

tapi.Initialize();

// ...
// Keep the TAPI object in memory so it can listen for events
// ...

tapi.ShutDown();