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.
Step 1: On the Home Screen, tap Phone. Step 2: Press the left menu button and tap Settings. Step 3: Under Call settings, tap Supplementary services. Step 4: Tap Caller ID to turn it on or off.
Other phone settings which may prevent caller id to work:Please disable Battery Optimization for Truecaller. Please try setting Truecaller as your Default Phone App. Go to Security > Auto start > Enable Truecaller. Go to Power management > Background app management > Enable Truecaller.
Both Android and iOS devices let you hide your caller ID, making you show up as No Caller ID, Private, or Blocked to everyone you call. If you want to temporarily unblock your number after changing these settings, dial *82 before the number you want to call. This overrides your settings and shows your caller ID again.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With