[英]How to get phone number when have an incoming call on PCI modem
我想建立像callerID应用程序的Java应用程序。
当有来电时,此应用程序将在文本框中显示电话号码。
我使用serialEvent函数,并在收到消息时进行检测。 但是我刚收到RING文本。
public synchronized void serialEvent(SerialPortEvent oEvent) {
if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
try {
String inputLine=input.readLine();
System.out.println(inputLine);
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
我们如何获得电话号码?
ps:我使用PCI调制解调器
您可能必须向调制解调器发送串行命令,然后等待其回复。 环顾网络,我发现了这一点:
AT commands are issued to the modem to control the modems operation
and software configuration. The basic command syntax is as follows:
<command><parameter>
The <command> is a combination of the attention prefix (AT) followed by
the AT command.
然后是这些特定的命令(似乎需要“ AT”东西):
I10, I11 Displays connection information. If the modem has not
connected with a remote DCE the ATI 11 commands returns -
No Previous Call.
因此,如果您发送调制解调器“ ATI10”或“ ATI11”,它会告诉您其状态,其中可能包括其连接的电话号码。
还有以下命令可以启用将输入号码打印到串行端口:
+VCID=<value> Caller ID
Use this command to enable or disable caller ID.
+VCID=0 Disable caller ID.
+VCID=1 Enable caller ID with formatted presentation.
+VCID=2 Enable caller ID with out formatting.
同样,我认为它需要AT前缀。
我没有办法测试其中的任何一个,但是本指南似乎很好地描述了许多串行命令,并且在这里我可以从中获取信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.