gpt4 book ai didi

c# - 来电显示检测 : Doesnt work with some phones

转载 作者:太空狗 更新时间:2023-10-29 20:37:41 24 4
gpt4 key购买 nike

我正在使用以下方法来检测有人来电时的来电显示。

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

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

这确保调制解调器支持来电显示并正常工作。

我在我们国家(印度)尝试了一些私有(private)电话线,它给出了如下预期的输出。

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

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

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

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

请注意,在 2nd 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

提前谢谢你。

最佳答案

如果您使用通用调制解调器,很遗憾,不能保证它在所有国家/地区的所有情况下都能正常工作;例如,美国使用 FSK 信号通过线路传递 CID,而印度似乎使用 DTMF 信号。

很可能是 BSNL 使用了调制解调器不支持的信号类型(如果 CID 没有被传递,您仍然希望看到一个空的 NMBR=)

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

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

关于c# - 来电显示检测 : Doesnt work with some phones,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5897916/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com