Tuesday, October 12, 2010

Apt Deb Repositories for v3.1.0

Courtesy of Jon Bonilla, Kamailio's Debian APT repository is offering now the packages for version 3.1.0 as well as nightly builds from stable branch 3.1.

So, if you want to get the latest version of branch 3.1, set your apt sources to:

deb http://deb.kamailio.org/kamailio31-nightly lenny main 

Supported OSes are Debian Lenny, Squeeze and Ubuntu Lucid.

Check for more details the wiki page:

Monday, October 11, 2010

Best of New in Kamailio 3.1.0 - #9: Load Balancer



SIP load balancer extension - dispatcher module - comes in Kamailio v3.1.0 with a bunch of new features:
  • weight-based load balancing - you can assign weights to addresses in a destination group and Kamailio will take care to distribute calls accordingly. For example, if you want to distribute 80% of calls to one server and the rest to another one, just set weight=80 to first address and weight=20 to second one
2 sip:192.168.178.20:5080 0 0 weight=80
2 sip:192.168.178.28:5082 0 0 weight=20
  • call-load-based dispatching - the module can track active calls and select least loaded destination to distribute the traffic. Note that the module includes a light-weight call tracing system which works even in transaction stateless mode. There is no dependency on heavy modules such as dialog, making it suitable for embedded systems as well.
  • configurable list of valid codes for SIP ping replies - the module has the ability to send OPTIONS requests to addresses in destination sets in order to discover whether they are active or not. In some particular cases, the reply code could be different than 200 (for example the system is asking for authentication), but still the system should be able to handle new calls. With module parameter ds_ping_reply_codes you can define a list of reply codes or reply code classes that are valid to consider that destination is active. For example - all 2XX and 3XX replies, together with 403 and 488:
modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=403;code=488;class=3")

The value of this parameter can be changed at runtime without restartion Kamailio.

Summarizing, with the new weight and call load dispatching, the module offers now a large range of algorithms to select destination, from old ones I would mention: round-robin, priority level, random, hashing of SIP message attributes. you can hardly find a competitor to beat the performances and features of dispatcher module for SIP load balancing.

You can browse module's documentation online at:

Thursday, October 7, 2010

Best of New in Kamailio 3.1.0 - #8: Configuration File

Kamailio v3.1.0 is shipped with a refurbished configuration file. It has a new structure to reflect better SIP server functionalities such as:
  • SIP location server
  • SIP registrar server
  • SIP presence server
  • NAT traversal management
  • PSTN routing
  • SIP message format sanity checks
  • routing within-dialog SIP requests
Several values were replaced by defines making easier to maintain and understand the logic of configuration file:
  • value of db_url parameters is set by DBURL define - if you change the access to database server you have to update a single value
  • multi-domain parameter value
  • used flags (for accounting, missed calls or NAT traversal) are also defined values, using more meaningful ID name
Couple of new features are included in the configuration file and can be easily enabled or disabled by defining or un-defining specific IDs:
  • TLS support - controlled by #!define WITH_TLS
  • multi-domain support - controlled by #!define WITH_MULTIDOMAIN
  • flood detection and protection - controlled by #!define WITH_ANTIFLOOD
  • database aliases lookup - controlled by #!define WITH_ALIASDB
  • source IP authentication - controlled by #!define WITH_IPAUTH
  • XMLRPC control interface -controlled by #!define WITH_XMLRPC
Have a look at configuration file (located in /etc/kamailio/kamailio.cfg or /usr/local/etc/kamailio/kamailio.cfg) and you will be surprised to discover how easy is now to manage it and turn on/off features. Also, you can browse it online on our GIT repository.

Wednesday, October 6, 2010

Kamailio v3.1.0 Released

Kamailio (OpenSER) v3.1.0 is out – major release with impressing number of new features and improvements.

On October 06, 2010, Kamailio (OpenSER) 3.1.0 has been released – this release is a result of more than 8 months of development from the teams of Kamailio (OpenSER) and SIP Express Router (SER) projects. Backed up by a solid development group, we are proud to announce that this release brings a large set of features, many for first time on the SIP server market, such as asynchronous TLS, UDP raw sockets, embedded HTTP and XCAP servers, embedded Lua, configuration file debugger. All together, there are over 15 new modules and countless improvements to old components.

Since last major release (version 3.0.0, which was out in January 10, 2010), the two SIP servers, Kamailio and SER, are practically the same application, the name making the difference regarding the database structure and the extensions used for certain features, such as user database based authentication or location service. Therefore another development direction was towards smooth integration of Kamailio and SER extensions, previously duplicated modules such as auth, sl, ratelimit or sms were merged during this development cycle.

Continue reading the release notes at:

Tuesday, October 5, 2010

Best of New in Kamailio 3.1.0 - ToC

Kamailio 3.1.0 - a new major release of the open source SIP server - is scheduled for October 6, 2010. The amount of new feature is astonishing, it is the outcome of 7 months development made by Kamailio and SER teams.

With blog series named "Best of New in Kamailio 3.1.0 ..." I try to detail some of most relevant new additions this release brings to light.

Here is the table of content:
Chapters will be added over the time and this page will be updated with the links to specific posts. Check it from time to time to see its new content...

Monday, October 4, 2010

Best of New in Kamailio 3.1.0 - #7: Pre-processor Directives

Previous major version, 3.0.0, introduced for first time configuration file pre-processor directives that allowed to include files, define IDs and test their definition.

It was one of the most appreciated additions in 3.0.0, allowing to structure better the configuration file, to enable or disable features with one single line change.

Kamailio v3.1.0 added new features to these pre-processor directives:
  • defined IDs can take values, being either strings, integer or even statements
  • defined IDs with values are replaced across configuration file
  • new subst directive that does perl-like substitutions inside string values within configuration file
For example, the default configuration file for v3.1.0 defines DBURL token to be used for db_url parameters:
#!define DBURL "mysql://openser:openserrw@localhost/openser"
...
modparam("auth_db", "db_url", DBURL)
Changing access to database requires now to update a single place, the define of DBURL.

If you have pieces of config that repeat, you can define them and reuse:
#!define MYLOG xlog("[$Tf]: message $rm from $fu to $ru\n")
...
route {
...
MYLOG;
...
MYLOG;
...
}
...
The new subst allow replacement inside string values - example: replace DBPASSWD token with 123qaz in all strings inside configuration file:
#!subst "/DBPASSWD/123qaz/"
modparam("acc", "db_url", "mysql://user:DBPASSWD@localhost/db")
Note that defines and subst apply to all parts of configuration file, not matter are global parameters, module settings or routing blocks.

Another useful features related to config pre-processor directives is the ability to define IDs from command line using -A parameter:
kamailio -A MYVALUE=abc
You can see as well the core cookbook section for pre-processor directives:

Sunday, October 3, 2010

Best of New in Kamailio 3.1.0 - #6: Asynchronous TLS

Demand for secure communication increased lately. Caused or not by more and more attacks on VoIP systems lately, as well as better penetration of Instant Messaging and Presence in SIP networks, IP telephony providers look now seriously to offer full content protection as a service.

Kamailio 3.1.0 is the first version that can be truly used for large scale full encrypted SIP communication engine. OpenSER (up to Kamailio 1.5.x) had more like a beta implementation, it was added for prototyping purposes and never improved, maybe also a result of missing TLS clients at that time.

Previous version, Kamailio 3.0.x, had a completely re-architectured TLS implementation, inherited from SIP Express Router (SER) v2.1.0, which was designed for massive scalability. Still, the missing piece in 3.0.x was asynchronous support. This was added in 3.1.0.

Asynchronous TLS support in v3.1.0 stands out through its simplicity to configure. It is on by default, transparent to configuration file. You can disable it via TCP connection control parameter:

tcp_async=no

The tls module has a comprehensive documentation:
TLS being a layer on top of TCP, many tunings can be done via global TCP parameters:

Friday, October 1, 2010

Best of New in Kamailio 3.1.0 - #5: GeoIP API

When providing services world wilde, with a centralized signaling platform and distributed media relays for optimizing voice path, one of the most important decisions to make is which media relay to use for best quality.

One criterion is geographic location of caller and callee - discovering that at runtime is much better than static mapping considering the mobility of users.
Kamailio 3.1.0's new module named geoip provides to configuration file an easy way to discover the location of caller or callee based on IP address. You can query a Max Mind GeoIP database and receive location details such as country code, time zone, a.s.o.

Here is an example of how to detect if the caller and callee are located in same country:
if(lookup("location")) {
# callee is online
geoip_match("$si", "src");
geoip_match("$nh(d)", "dst");
if($gip(src=>cc)==$gip(dst=>cc)) {
xlog("caller and callee located in same country - code: $gip(src=>cc)\n");
}
}
Another beneficial result is to be able to drop traffic coming from specific countries that tried to attack your service or you don't have customers. This is very useful these days, in a time where spit and scanning attacks against VoIP server increases.

Of course, this is an alternative to firewall method, giving you the opportunity to monitor (e.g., write in SIP server logs) if there are attempts of sending calls from such countries. Also, you can count attempts from a specific country and block the country for a while, everything done dynamically in your configuration file.

Blocking all traffic from Canada would be like:
geoip_match("$si", "src");
if($gip(src=>cc)=="CA") {
xlog("SIP message from Canada (ip: $si) - drop it\n");
send_reply("403", "Forbidden");
exit;
}
GeoIP API is very easy to use, the module has one parameter to set the path to GeoIP database, then you can match any IP address (e.g., source IP, next hop IP, IP from Via, Contact or any other header) and store the results in as many containers as you want, then they can be used to compare any attribute between them or against config values.

The documentation of geoip module is available at: