Marshal
Marshal

Reputation: 6651

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:

-- 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.

Upvotes: 7

Views: 2614

Answers (1)

Alex K.
Alex K.

Reputation: 175766

If you use a generic modem there is unfortunately no guarantee that it will work in all situations in all countries; for example the US uses FSK signalling to pass the CID down the wire whereas India appears to use DTMF signalling.

It may well be the case that BSNL are using a signalling type the modem does not support (If it was the case that the CID was just not being passed, you would still expect to see an empty NMBR=)

I would test with a modem that you know supports DTMF signalling.

Additionally, if the government phones in an office behind a PBX, then that could be messing with how the CID is sent.

Upvotes: 2

Related Questions