Thursday, June 4, 2015

Kamcli – command line control tool

Recently a new command line tool for Kamailio management was published by Asipto, named kamcli, available at:
It is written in Python and at this stage it is more an attempt to see if the community finds it useful and worth to get it developed further as part of Kamailio project.
  • Short about the benefits/flexibility:
  • python is by default installed on OSes (including Mac OS X) (as opposite to Lua, for example)
  • became rather fast since Google invested in it
  • lot more knowledge base and developers out there (as opposite to Lua or Perl), along with tons of extensions
  • implementation is based on a CLI framework (Click) that makes it extremely easy to add new commands in a plugin-like fashion, therefore is easy to have custom commands when having specific needs (e.g., managing a custom database table used in kamailio.cfg via sqlops => add a new cmd_xyz.py in commands subfolder, without touching other files, not even the config)
  • help message is embedded in the command code file, making it easier to document commands
  • easy to validate parameters as well as format the output
  • handling kamcli configuration file options is also easy (ini format)
One of the reasons of pushing this out was in the perspective of deprecating MI and working with JSONRPC fifo from command line — there is not an easy ways to manage json docs with shell and common tools (e.g., cat, echo, grep, awk) only. Kamcli has implemented the JSONRPC over fifo command (see also jsonrpc-s kamailio module). Still, given the old initial implementation, at this moment, kamcli is relying on MI via fifo (mi_fifo) for some of the commands (e.g., dumping usrloc records from memory).
So far, couple of commands were implemented when comparing with kamctl:
  • subscriber management (kamctl add/rm/passwd…)
  • user location management (kamctl ul …)
  • database querying (kamctl db …)
  • statistics (kamctl stats …)
  • mi commands (kamctl mi …)
  • jsonrpc commands (not in kamctl)
If there is enough interest in developing this tool further, it can be migrated to Kamailio organization on Github to have all developers able to work on it.
For further discussions about this tool, email to development mailing list .

No comments:

Post a Comment