AVM Fritz!Box provides a phone call monitor. To access the information, you have to activate Port 1012 in the Box. The setting is not available from the GUI, but you can use your phone to switch the feature on and off.
Dial #96*5* to enable the call monitor ( #96*5* to disable ).
To access the information via telnet for example, you also have to enable telnetd in your FRITZ!Box . Dial #96*7* to enable the telnetd ( #96*8* to disable ).
Here is some simple code that monitors the phone call manager via telnet on port 1012
package de.eknori.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.Socket;
public class CallMonitor {
public static void main(String[] argv) {
new CallMonitor().getCall("192.168.178.1", 1012);
}
private void getCall(String host, int portNum) {
System.out.println("Host " + host + "; port " + portNum);
try {
Socket s = new Socket(host, portNum);
new Pipe(s.getInputStream(), System.out).start();
new Pipe(System.in, s.getOutputStream()).start();
} catch (IOException e) {
System.out.println(e);
return;
}
System.out.println("Connected OK");
}
/**
* This class handles one half of a full-duplex connection.
*/
class Pipe extends Thread {
BufferedReader is;
PrintStream os;
Pipe(InputStream is, OutputStream os) {
this.is = new BufferedReader(new InputStreamReader(is));
this.os = new PrintStream(os);
}
}
}
When you run the code, you will see something like this as an output
* 14.10.12 10:56:19;CALL;1;10;XXX5670;XXX8506;SIP0;
* 14.10.12 10:56:19;RING;2;02104XXX5670;XXX8506;SIP2;
* 14.10.12 10:56:21;DISCONNECT;2;0;
* 14.10.12 10:56:21;CONNECT;1;10;XXX8506;
* 14.10.12 10:56:24;DISCONNECT;1;4;
* 14.10.12 10:56:21;RING;0;02104XXX5670;XXX8506;SIP2;
* 14.10.12 10:56:21;CONNECT;0;5;02104XXX5670;
* 14.10.12 10:56:24;DISCONNECT;0;4;
I have tested with AVM Fritz!Box 7390
all great, but why don’t you make BufferedReader and the PrintStream in ur Pipe class local variables instead of instance variables?
The constructor of Pipe can be called from multiple Threads. Instance variables are shared among Threads.
By just saying:
Pipe(InputStream is, OutputStream os) {
InputStream is = new BufferedReader(new InputStreamReader(is));
PrintStream os = new PrintStream(os);
}
the code is Threadsafe.
Thanks for the hint, Axel. It’s all because of a lack of all the deep knowledge that you already have on Java. I still have to learn a lot …
Please is it possible to set how the fritz! handels the blocked calls?
when one in blocklist calls me the fritz! stops the ringing but somehow opens the line (pstn). i prefer not to respond till the caller drop the call or give a busy signal to the caller.
thanks for your time