how detect caller id from phone line?

2020-02-03 04:21发布

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.

1条回答
唯我独甜
2楼-- · 2020-02-03 05:15

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();
查看更多
登录 后发表回答