[英]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.