OpenSIPS Extras!

Two things in this post. Assuming you run the following code:

mpath="/usr/lib/opensips/modules"
loadmodule "statistics.so"
loadmodule "httpd.so"
loadmodule "mi_json.so"

timer_route[log_uptime, 7] {
  xlog("uptime = $stat(timestamp) , startup = $TS , current = $Ts\n");
}

through /usr/sbin/opensips -D -E -f opensips.cfg (doesn’t need to be as root, you can run this under your user id), you will get:

  • An update every 7 seconds.
  • That update shows how to retrieve statistics from within your script.
  • If you go to http://127.0.0.1:8888/json/uptime you will get similar information.
  • And so will you if you go to http://127.0.0.1:8888/json/get_statistics?params=timestamp.
Written on November 29, 2013