– Kamailio SIP Server –

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
install:1.5.x-to-3.0.0 [2011/09/01 08:42]
109.254.49.8
install:1.5.x-to-3.0.0 [2011/09/07 16:32] (current)
212.227.35.137 deleted spam link
Line 1: Line 1:
 +====== Migrating Kamailio v1.5.x to Kamailio v3.0.0 ======
 +
 +Note: This is not a full list. There are much more changes than stated in this document.
 +E.g. haven'​t found the change for memlog=0 yet ...
 + ... http://​www.kamailio.org/​dokuwiki/​doku.php/​core-cookbook:​3.1.x?​s[]=memlog#​memlog
 +
 +
 +===== Changes in core =====
 +
 +* Kamailio 3.0.0 is first release that uses the core of http://​sip-router.org project
 +
 +* **IMPORTANT** put next line first in your config file
 +<code c>
 +#!KAMAILIO
 +</​code>​
 +  * run in Kamailio config compatibility mode
 +    * auto-correct TM parameter timer values: in 3.0 they are in mili-seconds,​ in 1.5 they are seconds, therefore if the value is too low (< = 120), then use T * 1000
 +    * accept TM avp parameters in K-style: $avp(name)
 +
 +===== Changes in modules =====
 +
 +* Kamailio 3.0.0 is first release that uses the TM module of http://​sip-router.org project
 +* **kex** and **tmx** modules must be loaded -- they provide functionalities existing in core or tm of Kamailio 1.5.x
 +
 +===== Changes in database schema =====
 +
 +==== LCR ====
 +
 +  * table **lcr** has one new column (table version is 3):
 +    * lcr_id SMALLINT UNSIGNED NOT NULL
 +
 +  * table **gw** has two new columns and one column removed (table version is 10):
 +    * lcr_id SMALLINT UNSIGNED NOT NULL
 +    * defunct INT UNSIGNED DEFAULT NULL
 +    * ping column has been removed
 +
 +==== Dialog ====
 +
 +  * table **dialog** has one new column (table version is 4):
 +    * req_uri VARCHAR(128) NOT NULL
 +
 +==== Permissions ====
 +
 +  * table **trusted** has one column definition updated (table version is 5):
 +     * tag VARCHAR(64)
 +
 +====== Tips for migration to Kamailio 3.0.0 ======
 +
 +The section collects tips to migrate Kamailio 1.5.x to 3.0.0 in order to get as much compatibility and functionality as possible. There are Kamailio 1.5.x functions that do not exist in Kamailio 3.0.0, but alternatives are available to get more or less same behaviour.
 +
 +===== TCP Connection Lifetime =====
 +
 +  * **registrar** module in Kamailio 1.5.x has support to set automatically the lifetime of the TCP connection for current processed SIP REGISTER message.
 +  * in **3.0.0** 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 kamailio 3.0.0 uses different values for each level. You can get the corresponding level by simple subtracting "​1"​ from the value you used in kamailio 1.5.x. For example the INFO level in kamailio 1.5.x (3) is "​2"​ in 3.0.0.
 +
 +===== Module loading =====
 +
 +  * The mpath statement is also available in kamailio 3.0.0, being an alias to loadpath parameter. In addition, you can omit the "​.so"​ from each loadmodule statement, as this is automatically appended.
 +
 +http://​www.kamailio.org/​dokuwiki/​doku.php/​core-cookbook:​3.0.x#​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://​kamailio.org/​docs/​modules/​3.0.x/​modules_k/​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://​kamailio.org/​docs/​modules/​3.0.x/​modules_k/​kex.html
 +
 +===== Dst URI Operations =====
 +
 +  * functions **setdsturi(uri),​ resetdsturi() and isdsturiset()** are implemented now by kex module. The syntax is the same:
 +
 +http://​kamailio.org/​docs/​modules/​3.0.x/​modules_k/​kex.html
 +
 +===== TM Extensions =====
 +
 +  * several TM extensions are now part of TMX module
 +
 +http://​kamailio.org/​docs/​modules/​3.0.x/​modules_k/​tmx.html
 +
 +===== Core parameters =====
 +
 +  * [b]avp_aliases[/​b] is a parameter of PV module
 +
 +http://​kamailio.org/​docs/​modules/​3.0.x/​modules_k/​pv.html
 +
 +  * [b]disable_dns_blacklist[/​b] is replaced by [b]dns_cache_negative_ttl[/​b]
 +
 +http://​www.kamailio.org/​dokuwiki/​doku.php/​core-cookbook:​3.0.x#​dns_cache_negative_ttl
 +
 +  * [b]disable_dns_failover[/​b] is replaced by [b]use_dns_failover[/​b]
 +
 +By default, [b]use_dns_failover[/​b] is currently "​off"​. ​
 +
 +===== Core Functions =====
 +
 +  * [b]append_branch()[/​b] - fully Kamailio 1.5.x append_branch() function is now implemented by [b]kex[/b] module and it is named [b]km_append_branch()[/​b]. See:
 +    * http://​kamailio.org/​docs/​modules/​3.0.x/​modules_k/​kex.html
 +    * note: there is still a core function still called [b]append_branch()[/​b],​ but it is SIP Express Router (SER) compatible.
 +    * [b]km_append_branch()[/​b] - as new feature, it accepts now the URI parameter to contain pseudo-variables
 +
 +===== Script syntax =====
 +
 +==== Test operator [...] ====
 +
 +  * [b]test operator [...][/b] is does not exist. Same operation is supported directly in conditional expressions.
 +
 +Bit tests must be written in conditions without brackets [ and ], for example,
 +
 +<code c>
 +    if ($var(a) & 4)
 +        log("​var a has third bit set\n"​);​
 +</​code>​
 +
 +==== Operator := ====
 +
 +  * [b]:=[/b] used in Kamailio 1.5.x for AVPs - delete all then add - is not available in Kamailio 3.0.0. Same functionality is given by assignment when providing index '​all'​ to the right AVP. See example:
 +
 +<code c>
 +   # Kamailio 1.5.x: $avp(abc) := '​xyz';​
 +   ​$(avp(abc)[*]) = '​xyz';​
 +
 +   # Kamailio 1.5.x: $avp(abc) := null;
 +   ​$(avp(abc)[*]) = $null;
 +</​code>​
 +
 +==== Modulo % ====
 +
 +  * [b]%[/b] must be replaced wit [b]mod[/b] ([b]%[/b] conflicted with [b]selects[/​b] marker)
 +
 +
 +<code c>
 +$var(x) = $var(y) mod 5;
 +</​code>​
 +===== Module parameters =====
 +
 +  * [b]tm onreply_avp_mode[/​b] does not exist
 +
 +In Kamailio 3.0.0, AVPs that are set in request route are always visible in branch, TM-reply and failure routes. If you set AVPS in an onreply_route,​ they are also visible after execution of this onreply_route.
 +
 +
 +
 +  * [b]tm fr_timer, fr_inv_timer,​ wt_timer, delete_timer,​ and unix_tx_timeout[/​b] units
 +
 +In Kamailio 3.0.0, time value of the above parameters is given in milliseconds,​ whereas in Kamailio 1.5.x they are given in seconds (see [[ref_manual:​timers|tm timers]] for more details).
 +
 +  * [b]sl_send_reply[/​b]
 +
 +In Kamailio 3.x, if you use an AVP for the code parameter (first one), make sure to assign it an integer value.
 +Example:
 +old versions would accept these statements
 +<code c>
 +$avp(s:​example) = "​404";​
 +sl_send_reply("​$avp(s:​example)",​ "Some Reason"​);​
 +</​code>​
 +But after 3.x Kamailio will tell you "Could not convert PV to int" in this case. Some possible workarounds are:
 +<code c>
 +$avp(s:​example) = 404;
 +</​code>​
 +or:
 +<code c>
 +$avp(s:​example) = (int) $avp(s:​example);​
 +</​code>​
 +
 +===== Module functions =====
 +
 +==== t_relay ====
 +
 +  * [b]t_relay()[/​b] parameters have different meanings in 3.0.0. For parameter compatibility with 1.5.x you can use [b]t_relay_to()[/​b] instead. If no parameter is given, then you can keep using [b]t_relay()[/​b]
 +
 +Translations:​
 +
 +^ 1.5.x ^ 3.0.0 ^
 +| t_relay() | t_relay() |
 +| t_relay(proxy) | t_relay_to(proxy) |
 +| t_relay(flags) | t_relay_to(flags) |
 +| t_relay(proxy,​ flags) | t_relay_to(proxy,​ flags) |
 +
 +Examples:
 +
 +^ 1.5.x ^ 3.0.0 ^
 +| t_relay() | t_relay() |
 +| t_relay("​udp:​1.2.3.4"​) | t_relay_to("​udp:​1.2.3.4"​) |
 +| t_relay("​0x01"​) | t_relay_to("​0x01"​) |
 +| t_relay("​udp:​1.2.3.4",​ "​0x01"​) | t_relay_to("​udp:​1.2.3.4",​ "​0x01"​) |
 +
 +
 +
 +  * [b]t_relay()[/​b] tunings in 3.0.0
 +
 +Module parameter "​auto_inv_100"​ can be used to globally turn off generation 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"​).
 +
 +  * [b]t_relay()[/​b] 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.
 +
 +==== t_was_cancelled ====
 +
 +  * [b]t_was_cancelled()[/​b] is replaced by [b]t_is_canceled()[/​b]. Watch out for the single "​l"​!
 +
 +==== t_check_trans ====
 +
 +  * [b]t_check_trans()[/​b] isn't true anymore on loose-routed e2e ACK. 
 +
 +See http://​sip-router.org/​docbook/​sip-router/​branch/​3.1/​modules/​tm/​tm.html#​t_check_trans
 +
 +----
 +
 +Note that the e2e ACK matching is more of a hint then a certainty. A delayed e2e ACK might arrive after the transaction wait time elapses, when the INVITE transaction no longer exists and thus would not match anything. There are also cases when tm would not keep all the information needed for e2e ACK matching (since this is not needed for a statefull proxy and it requires additional memory, tm will not keep this information unless needed by some other module or callbacks).
 +
 +----
 +
 +===== Route blocks =====
 +
 +  * [b]error_route[/​b] is not supported
 +
 +Check request sanity at the beginning of script (see sanity module).
 +
 +===== null keyword =====
 +
 +**null** keyword is not present in Kamailio 3.0.0. Use pseudo-variable **$null** instead.
 +
 +In addition, the operator **defined** can be used to check if a value is null or not.
 +
 +<code c>
 +if( ! defined $avp(x) ) {
 +   # the avp is null
 +   ...
 +}
 +</​code>​
 +
 +===== not operator in if() =====
 +
 +if (!$fd=~"​regexp"​) must now be written as if (!($fd=~"​regexp"​)) for what reason ever.
 +
 +
 +Notice: the operator [b]!~[/b] seems not to be working for some reason as well.
 +e.g.: ($fd !~ 'not this') must be replaced with !($fd =~ 'not this')
 +
 +===== empty tree =====
 +
 +Some empty { } section are not possible anymore. E.g.
 +<​code>​
 +if (expr) {
 +   ​setflag(1);​
 +} else if (expr) {
 +   # do nothing in this case
 +} else if (expr) {
 +   ​setflag(2);​
 +} else {
 +   ​setflag(3);​
 +}
 +</​code>​
 +
 +gives a syntax error in the line behind the comment for whatever reason.
 +
 +