[sr-dev] kamcli - kamailio command line control tool

Daniel-Constantin Mierla miconda at gmail.com
Mon May 4 16:16:01 CEST 2015


Hello,

we just published a new command line tool for Kamailio management, named
now kamcli, available at:

  * https://github.com/asipto/kamcli

It is written in Python and adapted from a tool provided originally by a
subcontractor for a specific deployment. While not being Python
developers here, the benefits and flexibility proved extremely good. 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 my reasons of pushing this out was in the perspective of
deprecating MI and working with JSONRPC fifo from command line -- I
couldn't find 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) -- (Just as side note: perhaps here we need to do a
mapping, because name of commands are different, if we want to make a
'ctl transport agnostic' tool.)

Here are few things to decide:
  - does it sound useful and are people finding it worth to develop it
further?
  - what about the name, is it ok? Another one?

If worth developing and deciding on the name, then the plan is to host
the project on kamailio organization on github so each kamailio
developer can code on it (it won't be inside kamailio source code tree,
but a separate project inside same organization).

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)

While cross posted for the sake of getting the info to everyone in the
community, let's have further discussions on sr-dev.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com




More information about the sr-dev mailing list