Module: sip-router
Branch: master
Commit: 9227fc8228064b789eaf66e939b8009333be1be0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9227fc8…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed May 6 17:57:25 2009 +0200
doc: config migration
Added a config migration guide for ser 2.1 to sip-router.
The kamailio part is empty for now.
---
NEWS | 3 +
doc/config_migration.txt | 115 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 118 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index 460d70c..b831a2f 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,9 @@ core:
strempty(expr) - returns true if expr evaluates to the empty
string (equivalent to expr=="").
e.g.: if (defined $v && !strempty($v)) $len=strlen($v);
+ - msg:len max_len comparison obsoleted and removed (it did not make any
+ sense, msg:len > max_len was always false, use something like
+ 4096 or 16384 in its place).
- module search path support: loadpath takes now a list of directories
separated by ':'. The list is searched in-order. For each directory d
$d/${module_name}.so and $d/${module_name}/${module_name}.so are tried.
diff --git a/doc/config_migration.txt b/doc/config_migration.txt
new file mode 100644
index 0000000..d55510c
--- /dev/null
+++ b/doc/config_migration.txt
@@ -0,0 +1,115 @@
+# $Id$
+#
+# History:
+# --------
+# 2009-05-06 created by andrei
+
+=============================================================
+= Config migration guide from ser or kamailio to sip-router =
+=============================================================
+
+
+ser 2.1 config migration
+========================
+
+1. Avps, selects and strings in if or other expressions
+
+The most important change is the different way in which avp and select are
+evaluated in boolean expressions (if ()).
+In ser "if ($v){}" or "if (@select){}" were true if the avp or select were
+"defined" and if their value was non-empty (!= "").
+In sip-router this changed: the ifs will be true if the avp or select are
+non-empty and they evaluate to a non-zero number. The catch is that a
+non-numeric string evaluates to 0 (e.g. "abc" evaluates to 0, "123" evaluates
+to 123, "" to 0, "0" to 0).
+Something like "if($v)" should be used only if $v is supposed to have a numeric
+value. "if (@select)" should not be used in general (it's probably not what you
+want).
+
+The equivalent sip-router checks are:
+
+instead of if ($v) use if ($v != "")
+instead of if (!$v) use if ($v == "") or if (strempty($v)).
+instead of if (@select) use if (@select != "")
+instead of if (!@select) use if (@select == "") or if (strempty(@select)).
+
+If the test is for value existence, then if ($v) can be replaced with
+ if (defined $v).
+
+E.g.:
+replace
+ if (! $f.did)
+with
+ if (strempty($f.did))
+
+replace
+ if (method=="INVITE" && !(a)to.tag)
+with
+ if (method=="INVITE" && strempty((a)to.tag))
+
+replace
+ if ($f.did && ! $t.did)
+with
+ if ($f.did != "" && $t.did == "")
+
+replace
+ if (@to.tag)
+with
+ if (@to.tag != "")
+
+
+2. Module path
+
+While in ser there was only a single directory holding the modules, now there
+are 3: modules (for common modules), modules_s (for ser modules) and modules_k
+(for kamailio modules).
+The easiest way to migrate a ser config is to add:
+
+ loadpath "/usr/lib/ser/modules:/usr/lib/ser/modules_s"
+
+at the beginning (before any loadmodule command).
+This will set the module search path to first look into the common modules and
+if not found in the ser modules.
+
+Make sure that all the loadmodule commands do not include the path to the
+module or the .so extension (or else they won't make use of the loadpath).
+E.g.:
+replace
+ loadmodule "/usr/lib/ser/modules/tm.so"
+with
+ loadmodule "tm"
+
+
+3. Module names
+
+Some of the modules changed their name (usually after being merged with the
+kamailio ones).
+The most common changes are mysql -> db_mysql and postgres -> db_postgres.
+
+E.g.:
+replace
+ loadmodule "mysql"
+with
+ loadmodule "db_mysql"
+
+
+4. msg:len and max_len
+
+max_len was removed. All the comparisons of msg:len with max_len must be
+changed to use a number (e.g. 4096 or 16384) instead of max_len.
+Comparing with max_len didn't make sense anyway since max_len was the size of
+the internal receive buffer on UDP. You could never exceed it, unless you were
+using TCP configured in a non-standard way.
+
+E.g.:
+replace
+ if (msg:len >= max_len)
+with
+ if (msg:len >= 4096)
+
+
+
+kamailio config migration
+=========================
+
+[TODO: probably most of the things from the ser section apply too]
Module: sip-router
Branch: master
Commit: 47945782e1459935b1f327abb92fbc1a3ffcd86f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4794578…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Wed May 6 14:47:14 2009 +0200
core: Consolidate append_str macro usage
The definition of append_str macro was scattered across the source tree,
there were multiple definition of the macro, some of them with different
parameters.
This patch brings the definition of append_str macro into ut.h header
file and removes all other definitions from core and modules.
We chose the version with three parameters where the pointer and the
length of the source string are passed separately to the macro. This is
more flexible than passing both of them within one parameter as str
structure.
All references to append_mem_block have been removed because the same
operation can now be achieved with append_str. In addition to that we
updated parameters passed to append_str where needed, converting one
str parameter to <pointer,len> pair of parameters.
Some modules had yet another version of append_str defined, there we
renamed the macro to some other name to make sure that the local
definition does not conflict with the definition on ut.h
---
lib/kcore/km_ut.h | 11 ----
modules/tm/t_fifo.c | 8 ++--
modules/tm/t_funcs.h | 16 ------
modules/tm/t_msgbuilder.c | 96 ++++++++++++++++++------------------
modules/tm/t_serial.c | 8 ++--
modules_s/acc_syslog/acc_syslog.c | 8 ++--
modules_s/sms/sms_funcs.c | 4 --
msg_translator.c | 6 --
ut.h | 12 +++++
9 files changed, 72 insertions(+), 97 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=479…
Module: sip-router
Branch: master
Commit: 00f54c06f2f6d4e4c8a5a004eb07367c93b82329
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=00f54c0…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Wed May 6 11:17:17 2009 +0200
Serial forking functions.
This patch adds two new functions to tm module, t_load_contacts and
t_next_contacts which can be used to implement serial forking.
There are also two new parameters, fr_inv_timer_next and contacts_avp.
Parameter fr_inv_timer_next is similar to fr_inv_timer, the value
of this parameter is used for subsequent branches during serial forking.
The value of contacts_avp is the identifier of the AVP which contains
the list of contacts to be used for serial forking.
The serial forking functions originate from Kamailio where they were
implemented by Juha Heinanen.
---
modules/tm/README | 636 +++++++++++++++++++++--------------------
modules/tm/config.c | 3 +
modules/tm/config.h | 5 +
modules/tm/doc/functions.xml | 79 ++++++
modules/tm/doc/params.xml | 51 ++++
modules/tm/doc/tm.xml | 9 +
modules/tm/t_fifo.c | 22 +--
modules/tm/t_funcs.c | 25 ++-
modules/tm/t_funcs.h | 24 ++-
modules/tm/t_msgbuilder.c | 14 +-
modules/tm/t_serial.c | 519 ++++++++++++++++++++++++++++++++++
modules/tm/t_serial.h | 35 +++
modules/tm/tm.c | 15 +-
13 files changed, 1090 insertions(+), 347 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=00f…