How to get Caller ID in C#?
Asked Answered
G

3

10

I want to use 56K modem for getting telephone number of who calls the home phone. Is there a way to achieve this with C# ?

Goal answered 29/7, 2009 at 15:1 Comment(2)
That's pretty awesome, just have a popup or something whenever the phone rings. Downside: Who has a landline anymore...Wentzel
You should state the modem model. Enabling Caller ID differs among modems. USRobotoics modems require different AT commands than Conexant modems.Chess
H
18

Not all modems support caller ID. And for those that do, the implementation varies between manufacturers.

There caller ID is passed through the serial data so you will have to use the TAPI library (or Windows' HyperTerminal to test it). The caller ID number typically appears between the first and the second ring.

You will need to issue a command to the modem to activate caller ID. Typically:

AT#CID=1 (or AT+VCID=1)

OK

Check the documentation for your modem.

When a call comes in, the modem will receive the a call string. Typically:

RING

Then the caller ID text will come in. If I am remembering correctly, it will be in the form:

NMBR=XXXXXXXXXX

[I am looking for a reference. I will post a link when I can find it]

UPDATE: Ah, found one. Check out this page for the commands and connection strings for for various modems:

How to Test a Modem for Caller ID Support

Hayes answered 29/7, 2009 at 15:21 Comment(2)
okay i will try it at home, it will be very good if you find a reference.Thanks.Goal
I love you Robert! Everyone has AT#CID=1 but it didn't work. I tried AT+VCID=1 and it workedNl
A
5

It is possible, but there are some things about it you should note:

  • You still have to have caller ID supported by your carrier/provider. A basic POTS line won't include this information unless the carrier has done some extra work to add it. So you can't do this to avoid paying an extra caller ID fee.
  • It's not built into .Net. You'll have to call into the basic TAPI library. I've never worked with this library myself, so that's as much as I can tell you.
Antiquate answered 29/7, 2009 at 15:7 Comment(1)
I am sure that my phone line supports caller ID because the phone is showing the caller number on its scrreen. I will go on with TAPI, thanks.Goal
R
3

serialPort1.Open(); serialPort1.WriteLine("AT#cid=1" + System.Environment.NewLine); // where serialPort1 is the serial control for more detail see following link : http://www.itworld2.com/frmsCsharp.aspx

Ringside answered 30/10, 2009 at 16:39 Comment(1)
heh,didn't know you can add those strings commands with the writeline method.. tnx (the link doesn't work though)Platto

© 2022 - 2024 — McMap. All rights reserved.