Thursday, January 14, 2010

Best of New in Kamailio 3.0.0 - #17: xmlrpc

Kamailio (OpenSER) 3.0.0 was released on Jan 11, 2010. I updated the release notes and what is new in 3.0.0 wiki pages a lot inspired from this series - I deserve myself sending thanks to me.

However, there will be two three more posts here and that's it, devel for next major release has started, no more time for old versions...

So, now XMLRPC. Kamailio (OpenSER) includes for quite some time the mi_xmlrpc module, the XMLRPC bearer for MI commands. The dependence of libxmlrpc-c3 set several limitations and created many problems over the time which are underlined by the benefits of the new one.

The version 3.0.0 brings an XMLRPC connector for RPC control interface, module named xmlrpc. Note that you can run any MI command via RPC interface. The new module has several features that makes it irresistible when needing such communication channel:
  • no external library, it reuses the transport layer from the core
  • that means scalable tcp and tls support at a glance
  • you can process xmlrpc requests at the same rate of SIP requests (hmm, 10 000 xmlrpc's/second, that's quite some traffic)
  • execute a config route block for each xmlrpc request
  • practically you can check in config the content of xmlrpc packet and do lot of operations with it
  • test the source IP, port, transport protocol - easy implementation of authorization (previously possible only by using firewalls)
  • reply to xmlrpc command from config file
Here is an example of usage:
#...
modparam("xmlrpc", "route", "XMLRPC");
#...
route[XMLRPC]{
# allow XMLRPC requests only on TLS and only if the client
# certificate is valid
if (proto!=TLS){
xmlrpc_reply("400", "xmlrpc allowed only over TLS");
return;
}
if (@tls.peer.verified!=""){
xmlrpc_reply("400", "Unauthorized");
return;
}
if (search("^User-Agent:.*xmlrpclib"))
set_reply_close();
set_reply_no_connect(); # optional
dispatch_rpc();
}

Next: transaction management improvements.

Best of New in Kamailio 3.0.0 - Table of Content.

No comments:

Post a Comment