来电显示检测:不适用于某些手机

发布于 2024-11-05 09:33:33 字数 1849 浏览 0 评论 0原文

当有人打电话时,我使用以下方法来检测来电显示。

在表单加载时,我设置了以下代码:

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();

        }

该命令

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

给了我输出

OK

,这确保了调制解调器支持来电显示并且正在工作。

我尝试使用我们国家(印度)的一些私人电话线,它给出的预期输出如下。

RING               //On 1st Ring
DATE = xxxxx       //On 2nd Ring
TIME = xxxx
NMBR = xxxxxxxxx

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

但是当我尝试使用政府电话(印度 BSNL 公司)时,它无法提供日期、时间和 NMBR 部分。它给出以下输出。

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

请注意,第二次响铃时没有任何显示。

重要提示:

  • 政府电话确实支持来电显示,因为当电话线连接到电话仪器时,号码不会显示向上。
  • 上述代码已成功与私营公司的许多其他固定电话配合使用。

- 知道为什么我无法从 BSNL 电话获取号码,尽管它们显示在电话来电显示屏幕上?

编辑:我将以下初始化命令传递给调制解调器以将其设置为 DTMF 接收模式。

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

先感谢您。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝眼泪 2024-11-12 09:33:33

不幸的是,如果您使用通用调制解调器,则不能保证它可以在所有国家/地区的所有情况下工作;例如,美国使用 FSK 信令通过线路传递 CID,而印度似乎使用 DTMF 信令。

很可能 BSNL 使用调制解调器不支持的信令类型(如果只是未传递 CID,您仍然会看到一个空的 NMBR=

我会使用您知道支持 DTMF 信号的调制解调器进行测试。

此外,如果政府在 PBX 后面的办公室打电话,那么可能会扰乱 CID 的发送方式。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文