简体   繁体   中英

How to get phone number when have an incoming call on PCI modem

I want to build the java application like callerID application.
When having an incoming call then this application will show phone number in the textbox.
I use serialEvent function and detected when have incoming. But I just got RING text.

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

How can we get the phone number?

ps: I use PCI modem

You may have to send the modem a serial command and wait for it to reply. Looking around the web I found this:

   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.

And then these specific commands (that seem to need that "AT" thing):

I10, I11 Displays connection information. If the modem has not
connected with a remote DCE the ATI 11 commands returns -
No Previous Call.

So it seems if you send the modem "ATI10" or "ATI11" it'll tell you it's status, which may include the phone number it's connected to.

There's also these commands which might enable printing the incoming number to the serial port:

+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.

Again, I think it needs the AT prefix.

I have no way to test any of these, but this guide seems to give a good description of a lot of the serial commands and is where I pull my info from:

http://www.airlinkplus.com/manuals/m-aml001.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM