Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how detect caller id from phone line?

Tags:

c#

serial-port

Is it possible to read bytes directly from modem or phone line without losing any info? If use SerialPort after ringing nothing happens on ReceiveData event.

I want to read caller id info directly from the line. My modem doesn't support Caller Id.

like image 499
Jalal Avatar asked Jun 27 '10 17:06

Jalal


1 Answers

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();
like image 86
user240515 Avatar answered Oct 04 '22 03:10

user240515