Wednesday, February 20, 2008

My development environment for Kamailio (OpenSER)

During meetings, when it comes to devel stuff, the not-missing question that pops up is “what do you use when hacking for Kamailio (OpenSER)?”.

Well, it is very simple, in two (+1) words: vim and ctags. vim fits nice with me, and gvim (the GTK flavour) is perfect for my Fluxbox X manager.

ctags helps in browsing the sources from vim. Kamailio (OpenSER) has a built in command to generate the tags, just issue: “make TAGS”. Once you open a file, jump to definition and back with CTRL+] and CTRL+t.

This environment works perfect when working on my computer and on a remote host via ssh, and no plan to move to something else. However, I do check from time to time what new cool stuff Linux adds in this area and even try

Thursday, February 7, 2008

Shared variables in configuration script

OpenSER is a multiprocess application. Sometimes, as an VoIP administrator of an OpenSER based platform, you feel the need to have a variable whose value is visible in all OpenSER processes.

Few days ago, the cfgutils module introduced this feature. A shared variable is specified via $shv(name), name can be any string of alpha-numeric characters. The shared variables can be initialized via a parameter of the cfgutils module. Also, they can be set via MI commands, giving the possibility to control routing logic in a nice way, without restarting OpenSER.

xlog was enhanced to take the log lever from any pseudo-variable, including shared variables. Now you can enable/disable printing of the log messages via MI.

Example of usage:

---
debug=3
...
loadmodule "cfgutils.so"
...
modparam("cfgutils", "shvset", "debug=i:4")
...
xlog("$shv(debug)", "request [$rm] from [$fu] to [$ru]\n");
---

To get your xlog message printed, issue the command:

# openserct fifo shv_set debug int 3


More details at:

http://www.openser.org/docs/modules/devel/cfgutils.html
http://www.openser.org/docs/modules/devel/xlog.html