CallerID Detection: Doesnt work with some phones

I am using the following method to detect the Caller ID when someone calls.

On form load I set 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();
            //richTextBox1.Text += this.serialPort1.ReadExisting();
            //richTextBox1.Text += this.serialPort1.ReadByte().ToString();

        }

The command

this.serialPort1.WriteLine("AT#cid=1" + System.Environment.NewLine);

gave me the output

OK

Which ensures that Caller Id is supported by modem and is working.

I tried with some private phone lines in our country (India), it gives the expected output as 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 with government telephones (BSNL Company in India), it fails to give DATE,TIME and NMBR part. It gives the following output.

RING               //On 1st Ring    
RING               //On 3rd Ring        
RING               //On 4th Ring

Please notice that there is nothing shown during 2nd Ring.

Important Note:

  • Government phones do support caller id, because when the phone line is connected to the phone instrument, number does shows up.
  • Above code is successfully working with many other fixed-line phones by private companies.

-- Any idea why dont I get numbers from BSNL phones, despite they display on phone Caller ID screen ?

Edit: I pass the following initializing commands to modem to set it for DTMF receive mode.

AT#CID=1  //Enable Caller ID (Verbose)
AT#VLS=0  //Voice Source--Telephone Line (Go on hook)
AT#VTD=3F,3F,3F  //Enable DTMF Transmit, Receive and Voice Online 
AT#CLS=8  //Sets Modem to Voice Mode

Thank you in advance.

7
задан Vadim Kotov 22 August 2017 в 09:29
поделиться