SipX ConfigServer Remote Debugging
From SIPfoundry sipx, The Open Source SIP PBX for Linux - Calivia
Remote debugging of sipXconfig
In most cases you can debug sipXconfig by running it directly from the debugger. However, it is also possible to connect to sipXconfig launched by the sipxpbx service.
Here we describe how to configure sipXconfig Java applications for remote debugging (JDWP). "Remote" in this context means that the Java debugger attaches to the process started by the sipX watchdog, and not by the debugger. The debugger can actually run on the same machine as sipX services.
While it's not strictly required, the first step should be building Java code with debug information:
mkdir debug cd debug JAVAC_DEBUG=on JAVAC_OPTIMIZED=off ../configure make make install
To launch the program in debug mode you need to set debug options, including the communication port for the debugger. Each server's startup script lets you pass the necessary information through environment variables.
export SIPXCONFIG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5498"
In the example above we use port 5498. You can use other ports as long as the number you pass to the Java application is the same as the number you pass to the debugger.
Once the process is running you can attach your favorite debugger. If you use jdb, your command line should look like this:
$JAVA_HOME/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=5498
Other debuggers and IDEs are also supported. Information on how to configure your favorite IDE can usually be found under Remote Java Debugging in the user manual.
You can configure Eclipse for remote debugging:
- open Run->Debug... window
- select Java Remote Application
- click new
- select sipXconfig project, enter host (localhost if you are using it on the same machine) and port number configured in SIPXCONFIG_OPTS
- choose a name for your configuration and save it
- start sipXconfig (by starting sipxpbx) and connect to it by selecting the newly created debug configuration from the Debug window - you'll be placed in DEBUG mode when the application hits one of your breakpoints
