Browse code

doc: config migration

Added a config migration guide for ser 2.1 to sip-router.
The kamailio part is empty for now.

Andrei Pelinescu-Onciul authored on 06/05/2009 15:57:25
Showing 2 changed files
... ...
@@ -42,6 +42,9 @@ core:
42 42
       strempty(expr) - returns true if expr evaluates to the empty
43 43
                        string (equivalent to expr=="").
44 44
     e.g.: if (defined $v && !strempty($v)) $len=strlen($v);
45
+  - msg:len max_len comparison obsoleted and removed (it did not make any
46
+    sense, msg:len > max_len was always false, use something like 
47
+    4096 or 16384 in its place).
45 48
   - module search path support: loadpath takes now a list of directories
46 49
     separated by ':'. The list is searched in-order. For each directory d
47 50
     $d/${module_name}.so and $d/${module_name}/${module_name}.so are tried.
48 51
new file mode 100644
... ...
@@ -0,0 +1,115 @@
0
+# $Id$
1
+#
2
+# History:
3
+# --------
4
+# 2009-05-06  created by andrei
5
+
6
+=============================================================
7
+= Config migration guide from ser or kamailio to sip-router =
8
+=============================================================
9
+
10
+
11
+ser 2.1 config migration
12
+========================
13
+
14
+1. Avps, selects and strings in if or other expressions
15
+
16
+The most important change is the different way in which avp and select are
17
+evaluated in boolean expressions (if ()).
18
+In ser "if ($v){}" or "if (@select){}" were true if the avp or select were
19
+"defined" and if their value was non-empty (!= "").
20
+In sip-router this changed: the ifs will be true if the avp or select are
21
+non-empty and they evaluate to a non-zero number. The catch is that a
22
+non-numeric string evaluates to 0 (e.g. "abc" evaluates to 0, "123" evaluates
23
+to 123, "" to 0, "0" to 0).
24
+Something like "if($v)" should be used only if $v is supposed to have a numeric
25
+value. "if (@select)" should not be used in general (it's probably not what you
26
+want).
27
+
28
+The equivalent sip-router checks are:
29
+
30
+instead of if ($v) use if ($v != "")
31
+instead of if (!$v) use if ($v == "") or if (strempty($v)).
32
+instead of if (@select) use if (@select != "")
33
+instead of if (!@select) use if (@select == "") or if (strempty(@select)).
34
+
35
+If the test is for value existence, then if ($v) can be replaced with
36
+ if (defined $v).
37
+
38
+E.g.:
39
+replace
40
+	if (! $f.did)
41
+with
42
+	if (strempty($f.did))
43
+
44
+replace
45
+	if (method=="INVITE" && !@to.tag)
46
+with
47
+	if (method=="INVITE" && strempty(@to.tag))
48
+
49
+replace
50
+	if ($f.did && ! $t.did)
51
+with
52
+	if ($f.did != ""  && $t.did == "")
53
+
54
+replace
55
+	if (@to.tag)
56
+with
57
+	if (@to.tag != "")
58
+
59
+
60
+2. Module path
61
+
62
+While in ser there was only a single directory holding the modules, now there
63
+are 3: modules (for common modules), modules_s (for ser modules) and modules_k
64
+(for kamailio modules).
65
+The easiest way to migrate a ser config is to add:
66
+
67
+	loadpath "/usr/lib/ser/modules:/usr/lib/ser/modules_s"
68
+
69
+at the beginning (before any loadmodule command).
70
+This will set the module search path to first look into the common modules and
71
+if not found in the ser modules.
72
+
73
+Make sure that all the loadmodule commands do not include the path to the
74
+module or the .so extension (or else they won't make use of the loadpath).
75
+E.g.:
76
+replace
77
+	loadmodule "/usr/lib/ser/modules/tm.so"
78
+with
79
+	loadmodule "tm"
80
+
81
+
82
+3. Module names
83
+
84
+Some of the modules changed their name (usually after being merged with the
85
+kamailio ones).
86
+The most common changes are mysql -> db_mysql and postgres -> db_postgres.
87
+
88
+E.g.:
89
+replace
90
+	loadmodule "mysql"
91
+with
92
+	loadmodule "db_mysql"
93
+
94
+
95
+4. msg:len and max_len
96
+
97
+max_len was removed. All the comparisons of msg:len with max_len must be
98
+changed to use a number (e.g. 4096 or 16384) instead of max_len.
99
+Comparing with max_len didn't make sense anyway since max_len was the size of
100
+the internal receive buffer on UDP. You could never exceed it, unless you were
101
+using TCP configured in a non-standard way.
102
+
103
+E.g.:
104
+replace
105
+	if (msg:len >= max_len)
106
+with
107
+	if (msg:len >= 4096)
108
+
109
+
110
+
111
+kamailio config migration
112
+=========================
113
+
114
+[TODO: probably most of the things from the ser section apply too]