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