I use the following method to detect Caller ID when someone calls.
In the form upload, I install the following code:
this.serialPort1.PortName = "COM3"; this.serialPort1.BaudRate = 9600; this.serialPort1.DataBits = 8; this.serialPort1.RtsEnable = true; this.serialPort1.DataReceived += new SerialDataReceivedEventHandler(serialPort1_DataReceived); this.serialPort1.Open(); this.serialPort1.WriteLine("AT#cid=1" + System.Environment.NewLine); void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e) { richTextBox1.Text += this.serialPort1.ReadLine();
Team
this.serialPort1.WriteLine("AT#cid=1" + System.Environment.NewLine);
gave me a way out
OK
This ensures that Caller Id is supported by the modem and is operational.
I tried with some private telephone lines in our country (India), it gives the expected result, as shown below.
RING //On 1st Ring DATE = xxxxx //On 2nd Ring TIME = xxxx NMBR = xxxxxxxxx RING //On 3rd Ring RING //On 4th Ring
But when I try to use government telephones (BSNL Company in India), it cannot provide part of DATE, TIME and NMBR. He gives the following result.
RING //On 1st Ring RING //On 3rd Ring RING //On 4th Ring
Please note that nothing is displayed during the second ring.
Important Note:
- Government phones support the caller ID because when a telephone line is connected to a telephone tool, a number appears.
- The above code successfully works with many other landline telephones by private companies.
- Any idea why I am not getting the BSNL phone numbers, even though they are displayed on the Caller ID screen of the phone?
Edit: I send the following initialization commands to the modem in order to set it for DTMF receive mode.
AT#CID=1 //Enable Caller ID (Verbose) AT
Thanks in advance.
Marshal
source share