This is an old revision of the document!


Tips for Kamailio migration

The page collects tips to migrate Kamailio to SIP-Router and get same behaviour. There are Kamailio functions that do not exist in SIP Router, but alternatives are available to get more or less same behaviour.

TCP Connection Lifetime

  • registrar module in Kamailio has support to set automatically the lifetime of the TCP connection for current processed SIP REGISTER message.
  • in sip-router similar functionality can be achieved by setting tcp_connection_lifetime config parameters just a bit higher than max registration expire. The lifetime for a TCP connection is automatically extended when a message is going through. In case of hard/soft phones, the connection is closed by client side when they shut down.

Log levels

  • the logging in sip-router uses different values for each level. You can get the corresponding level by simple subtracting "1" from the value you used in kamailio. For example the INFO level in kamailio (3) is "2" in sip-router.

Module loading

  • The mpath statement is also available in sip-router, being an alias to loadpath parameter. In addition, you can omit the ".so" from each loadmodule statement, as this is automatically appended from the sip-router.

http://sip-router.org/wiki/cookbooks/core-cookbook/devel#loadpath

Branch Flags Operations

  • functions are implemented now by kex module. The parameters must be enclosed in double quotes and they can be pseudo-variables with integer values:

http://sip-router.org/docbook/sip-router/branch/master/modules_k/kex/kex.html

Script Flags Operations

  • functions are implemented now by kex module. The parameters must be enclosed in double quotes and they can be pseudo-variables with integer values:

http://sip-router.org/docbook/sip-router/branch/master/modules_k/kex/kex.html

Dst URI Operations

  • functions setdsturi(uri), resetdsturi() and isdsturiset() are implemented now by kex module. The syntax is the same:

http://sip-router.org/docbook/sip-router/branch/master/modules_k/kex/kex.html

TM Extensions

Core parameters

  • avp_aliases is a parameter of PV module

http://sip-router.org/docbook/sip-router/branch/master/modules_k/pv/pv.html

  • disable_dns_blacklist is replaced by dns_cache_negative_ttl

http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_cache_negative_ttl

Script syntax

Test operator [...]

  • test operator […] is does not exist. Same operation is supported directly in conditional expressions.

Bit tests must be written in conditions without brackets [ and ], for example,

    if ($var(a) & 4)
        log("var a has third bit set\n");

Operator :=

  • := used in Kamailio for AVPs - delete all then add - is not available in SIP Router. Same functionality is given by assignment when providing index 'all' to the right AVP. See example:
   # Kamailio: $avp(abc) := 'xyz';
   $(avp(abc)[*]) = 'xyz';
 
   # Kamailio: $avp(abc) := null;
   $(avp(abc)[*]) = $null;

Module parameters

  • tm onreply_avp_mode does not exist

In SIP Router, AVPs that are set in request route are always visible in branch and failure routes. Not confirmed yet if they are visible in onreply_route - the behaviour controlled by this Kamailio parameter.

Module functions

  • t_relay() does not accept flag parameter

Module parameter "auto_inv_100" can be used to globally turn off gneration of provisional replies (default is 1 == "on"). It is also possible to dynamically control generation of provisional replies using function t_set_auto_inv_100().

Core parameter "use_dns_failover" can be used to globally turn off DNS failover (default is "off").

  • t_relay() does not generate internally a negative reply. Negative reply is can always be generated explicitly from script. If not done, it is generated implicitly at the end of the script.

Route blocks

  • error_route is not supported

Check request sanity at the beginning of script (see sanity module).

null keyword

null keyword is not present in SIP Router. Use pseudo-variable $null instead.

In addition, the operator defined can be used to check if a value is null or not.

if( ! defined $avp(x) ) {
   # the avp is null
   ...
}

Navigation

Wiki

Other

QR Code
QR Code migration:kamailio-tips (generated for current page)