Added support for cfg framework for some parameters
Updated documentation to reflect the changes
... | ... |
@@ -12,7 +12,7 @@ Henning Westerholt |
12 | 12 |
|
13 | 13 |
1&1 Internet AG |
14 | 14 |
|
15 |
- Copyright � 2007 1&1 Internet AG |
|
15 |
+ Copyright © 2007 1&1 Internet AG |
|
16 | 16 |
Revision History |
17 | 17 |
Revision $Revision$ $Date$ |
18 | 18 |
__________________________________________________________________ |
... | ... |
@@ -273,7 +273,7 @@ Chapter 1. Admin Guide |
273 | 273 |
use the lcr and dispatcher module. |
274 | 274 |
|
275 | 275 |
If you want to use this module in failure routes, then you need to call |
276 |
- "append_branch()" after rewriting the request URI in order to relay the |
|
276 |
+ “append_branch()” after rewriting the request URI in order to relay the |
|
277 | 277 |
message to the new target. Its also supportes the usage of database |
278 | 278 |
derived failure routing descisions with the carrierfailureroute table. |
279 | 279 |
|
... | ... |
@@ -290,7 +290,7 @@ Chapter 1. Admin Guide |
290 | 290 |
needs the capability to issue raw queries. Its not possible to use |
291 | 291 |
the dbtext or db_berkeley module at the moment. |
292 | 292 |
* The tm module, when you want to use the $T_reply_code |
293 |
- pseudo-variable in the "cr_next_domain" function. |
|
293 |
+ pseudo-variable in the “cr_next_domain” function. |
|
294 | 294 |
|
295 | 295 |
2.2. External Libraries or Applications |
296 | 296 |
|
... | ... |
@@ -317,7 +317,7 @@ Chapter 1. Admin Guide |
317 | 317 |
|
318 | 318 |
The name of the table containing the subscribers |
319 | 319 |
|
320 |
- Default value is "subscriber". |
|
320 |
+ Default value is “subscriber”. |
|
321 | 321 |
|
322 | 322 |
Example 1.1. Set subscriber_table parameter |
323 | 323 |
... |
... | ... |
@@ -329,7 +329,7 @@ modparam("carrierroute", "subscriber_table", "subscriber") |
329 | 329 |
The name of the column in the subscriber table containing the |
330 | 330 |
usernames. |
331 | 331 |
|
332 |
- Default value is "username". |
|
332 |
+ Default value is “username”. |
|
333 | 333 |
|
334 | 334 |
Example 1.2. Set subscriber_user_col parameter |
335 | 335 |
... |
... | ... |
@@ -341,7 +341,7 @@ modparam("carrierroute", "subscriber_user_col", "username") |
341 | 341 |
The name of the column in the subscriber table containing the domain of |
342 | 342 |
the subscriber. |
343 | 343 |
|
344 |
- Default value is "domain". |
|
344 |
+ Default value is “domain”. |
|
345 | 345 |
|
346 | 346 |
Example 1.3. Set subscriber_domain_col parameter |
347 | 347 |
... |
... | ... |
@@ -353,7 +353,7 @@ modparam("carrierroute", "subscriber_domain_col", "domain") |
353 | 353 |
The name of the column in the subscriber table containing the carrier |
354 | 354 |
id of the subscriber. |
355 | 355 |
|
356 |
- Default value is "cr_preferred_carrier". |
|
356 |
+ Default value is “cr_preferred_carrier”. |
|
357 | 357 |
|
358 | 358 |
Example 1.4. Set subscriber_carrier_col parameter |
359 | 359 |
... |
... | ... |
@@ -365,7 +365,7 @@ modparam("carrierroute", "subscriber_carrier_col", "cr_preferred_carrier") |
365 | 365 |
Specifies whether the module loads its config data from a file or from |
366 | 366 |
a database. Possible values are file or db. |
367 | 367 |
|
368 |
- Default value is "file". |
|
368 |
+ Default value is “file”. |
|
369 | 369 |
|
370 | 370 |
Example 1.5. Set config_source parameter |
371 | 371 |
... |
... | ... |
@@ -376,7 +376,7 @@ modparam("carrierroute", "config_source", "file") |
376 | 376 |
|
377 | 377 |
Specifies the path to the config file. |
378 | 378 |
|
379 |
- Default value is "/etc/kamailio/carrierroute.conf". |
|
379 |
+ Default value is “/etc/kamailio/carrierroute.conf”. |
|
380 | 380 |
|
381 | 381 |
Example 1.6. Set config_file parameter |
382 | 382 |
... |
... | ... |
@@ -388,7 +388,7 @@ modparam("carrierroute", "config_file", "/etc/kamailio/carrierroute.conf") |
388 | 388 |
The name of the carrier tree used per default (if the current |
389 | 389 |
subscriber has no preferred tree) |
390 | 390 |
|
391 |
- Default value is "default". |
|
391 |
+ Default value is “default”. |
|
392 | 392 |
|
393 | 393 |
Example 1.7. Set default_tree parameter |
394 | 394 |
... |
... | ... |
@@ -398,9 +398,10 @@ modparam("carrierroute", "default_tree", "default") |
398 | 398 |
3.8. use_domain (int) |
399 | 399 |
|
400 | 400 |
When using tree lookup per user, this parameter specifies whether to |
401 |
- use the domain part for user matching or not. |
|
401 |
+ use the domain part for user matching or not. This parameter is tunable |
|
402 |
+ via the ser cfg framework. |
|
402 | 403 |
|
403 |
- Default value is "0". |
|
404 |
+ Default value is “0”. |
|
404 | 405 |
|
405 | 406 |
Example 1.8. Set use_domain parameter |
406 | 407 |
... |
... | ... |
@@ -412,9 +413,9 @@ modparam("carrierroute", "use_domain", 0) |
412 | 413 |
This parameter defines the behaviour when using user-based tree lookup. |
413 | 414 |
If the user has a non-existing tree set and fallback_default is set to |
414 | 415 |
1, the default tree is used. Otherwise, cr_user_rewrite_uri returns an |
415 |
- error. |
|
416 |
+ error. This parameter is tunable via the ser cfg framework. |
|
416 | 417 |
|
417 |
- Default value is "1". |
|
418 |
+ Default value is “1”. |
|
418 | 419 |
|
419 | 420 |
Example 1.9. Set fallback_default parameter |
420 | 421 |
... |
... | ... |
@@ -426,9 +427,10 @@ modparam("carrierroute", "fallback_default", 1) |
426 | 427 |
The number of the rows to be fetched at once from database when loading |
427 | 428 |
the routing data. This value can be used to tune the load time at |
428 | 429 |
startup. For 1MB of private memory (default) it should be below 3750. |
429 |
- The database driver must support the fetch_result() capability. |
|
430 |
+ The database driver must support the fetch_result() capability. This |
|
431 |
+ parameter is tunable via the ser cfg framework. |
|
430 | 432 |
|
431 |
- Default value is "2000". |
|
433 |
+ Default value is “2000”. |
|
432 | 434 |
|
433 | 435 |
Example 1.10. Set fetch_rows parameter |
434 | 436 |
... |
... | ... |
@@ -444,7 +446,7 @@ modparam("carrierroute", "fetch_rows", 3000) |
444 | 446 |
matching. Please be aware that memory requirements for storing the |
445 | 447 |
routing tree in shared memory will also increase by a factor of 12.8. |
446 | 448 |
|
447 |
- Default value is "10". |
|
449 |
+ Default value is “10”. |
|
448 | 450 |
|
449 | 451 |
Example 1.11. Set match_mode parameter |
450 | 452 |
... |
... | ... |
@@ -487,7 +489,7 @@ cr_tree_rewrite_uri(tree, domain) |
487 | 489 |
used in the config file mode, as it needs a mapping of the given user |
488 | 490 |
to a certain carrier. The is derived from a database entry belonging to |
489 | 491 |
the user parameter. This mapping must be available in the table that is |
490 |
- specified in the "subscriber_table" variable. This data is not cached |
|
492 |
+ specified in the “subscriber_table” variable. This data is not cached |
|
491 | 493 |
in memory, that means for every execution of this function a database |
492 | 494 |
query will be done. |
493 | 495 |
|
... | ... |
@@ -517,7 +519,7 @@ descavp) |
517 | 519 |
|
518 | 520 |
If flags and masks values are specified in the routing rule, they will |
519 | 521 |
be compared by this function to the message flags. Specify a flag and |
520 |
- mask value of "0" to match to all possible message flags (this is the |
|
522 |
+ mask value of “0” to match to all possible message flags (this is the |
|
521 | 523 |
default value). If flags and mask are not zero, and no match to the |
522 | 524 |
message flags is possible, no routing will be done. The calculation of |
523 | 525 |
the hash and the load-balancing is done after the flags matching. |
... | ... |
@@ -826,7 +828,7 @@ failure_route[1] { |
826 | 828 |
Don't use a hash index value of zero. If you ommit the hash completly, |
827 | 829 |
the module gives them a autogenerated value, starting from one. |
828 | 830 |
|
829 |
- Use the "NULL" prefix to specify an empty prefix in the config file. |
|
831 |
+ Use the “NULL” prefix to specify an empty prefix in the config file. |
|
830 | 832 |
Please note that the prefix is matched against the request URI (or to |
831 | 833 |
URI), if they did not contain a valid (numerical) URI, no match is |
832 | 834 |
possible. So for loadbalancing purposes e.g. for your registrars, you |
... | ... |
@@ -917,21 +919,21 @@ domain register { |
917 | 919 |
+----+---------+--------+-------------+-------+------+---------------+ |
918 | 920 |
... |
919 | 921 |
|
920 |
- This table contains three routes to two gateways for the "49" prefix, |
|
922 |
+ This table contains three routes to two gateways for the “49” prefix, |
|
921 | 923 |
and a default route for other prefixes over carrier 2 and carrier 1. |
922 | 924 |
The gateways for the default carrier will be used for functions that |
923 | 925 |
don't support the user specific carrier lookup. The routing rules for |
924 |
- carrier 1 and carrier 2 for the "49" prefix contains a additional rule |
|
926 |
+ carrier 1 and carrier 2 for the “49” prefix contains a additional rule |
|
925 | 927 |
with the domain 2, that can be used for example as fallback if the |
926 | 928 |
gateways in domain 1 are not reachable. Two more fallback rules (domain |
927 | 929 |
3 and 4) for carrier 1 are also supplied to support the functionality |
928 | 930 |
of the carrierfailureroute table example that is provided in the next |
929 | 931 |
section. |
930 | 932 |
|
931 |
- This table provides also a "carrier 1" routing rule for the "49" |
|
933 |
+ This table provides also a “carrier 1” routing rule for the “49” |
|
932 | 934 |
prefix, that is only choosen if some message flags are set. If this |
933 |
- flags are not set, the other two rules are used. The "strip", "mask" |
|
934 |
- and "comment" colums are omitted for brevity. |
|
935 |
+ flags are not set, the other two rules are used. The “strip”, “mask” |
|
936 |
+ and “comment” colums are omitted for brevity. |
|
935 | 937 |
|
936 | 938 |
Example 1.21. Example database content - simple carrierfailureroute |
937 | 939 |
table |
... | ... |
@@ -944,10 +946,10 @@ domain register { |
944 | 946 |
+----+---------+--------+---------------+------------+-------------+ |
945 | 947 |
... |
946 | 948 |
|
947 |
- This table contains two failure routes for the "gw.carrier1-1" and "-2" |
|
949 |
+ This table contains two failure routes for the “gw.carrier1-1” and “-2” |
|
948 | 950 |
gateways. For any (failure) reply code the respective next domain is |
949 | 951 |
choosen. After that no more failure routes are available, an error will |
950 |
- be returned from the "cr_next_domain" function. Not all table colums |
|
952 |
+ be returned from the “cr_next_domain” function. Not all table colums |
|
951 | 953 |
are show here for brevity. |
952 | 954 |
|
953 | 955 |
For each failure route domain and carrier that is added to the |
... | ... |
@@ -1008,7 +1010,7 @@ domain register { |
1008 | 1010 |
|
1009 | 1011 |
7.3. User specific routing |
1010 | 1012 |
|
1011 |
- For a functional routing the "cr_preferred_carrier" column must be |
|
1013 |
+ For a functional routing the “cr_preferred_carrier” column must be |
|
1012 | 1014 |
added to the subscriber table (or to the table and column that you |
1013 | 1015 |
specified as modul parameter) to choose the actual carrier for the |
1014 | 1016 |
users. |
... | ... |
@@ -1060,7 +1062,7 @@ Chapter 2. Module parameter for database access. |
1060 | 1062 |
|
1061 | 1063 |
URL to the database containing the data. |
1062 | 1064 |
|
1063 |
- Default value is "mysql://openserro:openserro@localhost/openser". |
|
1065 |
+ Default value is “mysql://openserro:openserro@localhost/openser”. |
|
1064 | 1066 |
|
1065 | 1067 |
Example 2.1. Set db_url parameter |
1066 | 1068 |
... |
... | ... |
@@ -1071,7 +1073,7 @@ modparam("carrierroute", "db_url", "dbdriver://username:password@dbhost/dbname") |
1071 | 1073 |
|
1072 | 1074 |
Name of the carrierroute table for the carrierroute module. |
1073 | 1075 |
|
1074 |
- Default value is "carrierroute". |
|
1076 |
+ Default value is “carrierroute”. |
|
1075 | 1077 |
|
1076 | 1078 |
Example 2.2. Set carrierroute_table parameter |
1077 | 1079 |
... |
... | ... |
@@ -1214,7 +1216,7 @@ modparam("carrierroute", "carrierroute_description_col", "description") |
1214 | 1216 |
|
1215 | 1217 |
Name of the carrierfailureroute table for the carrierroute module. |
1216 | 1218 |
|
1217 |
- Default value is "carrierfailureroute". |
|
1219 |
+ Default value is “carrierfailureroute”. |
|
1218 | 1220 |
|
1219 | 1221 |
Example 2.15. Set carrierfailureroute_table parameter |
1220 | 1222 |
... |
... | ... |
@@ -1325,7 +1327,7 @@ modparam("carrierroute", "carrierfailureroute_description_col", "description") |
1325 | 1327 |
|
1326 | 1328 |
Name of the carrier_name table for the carrierroute module. |
1327 | 1329 |
|
1328 |
- Default value is "carrier_name". |
|
1330 |
+ Default value is “carrier_name”. |
|
1329 | 1331 |
|
1330 | 1332 |
Example 2.26. Set carrier_name_table parameter |
1331 | 1333 |
... |
... | ... |
@@ -1354,7 +1356,7 @@ modparam("carrierroute", "carrier_name_carrier_col", "carrier") |
1354 | 1356 |
|
1355 | 1357 |
Name of the domain_name table for the carrierroute module. |
1356 | 1358 |
|
1357 |
- Default value is "domain_name". |
|
1359 |
+ Default value is “domain_name”. |
|
1358 | 1360 |
|
1359 | 1361 |
Example 2.29. Set domain_name_table parameter |
1360 | 1362 |
... |
... | ... |
@@ -47,6 +47,7 @@ |
47 | 47 |
#include "cr_data.h" |
48 | 48 |
#include "cr_func.h" |
49 | 49 |
#include "db_carrierroute.h" |
50 |
+#include "config.h" |
|
50 | 51 |
#include <sys/stat.h> |
51 | 52 |
|
52 | 53 |
MODULE_VERSION |
... | ... |
@@ -71,9 +72,6 @@ str default_tree = str_init("default"); |
71 | 72 |
const str CR_EMPTY_PREFIX = str_init("null"); |
72 | 73 |
|
73 | 74 |
int mode = 0; |
74 |
-int use_domain = 0; |
|
75 |
-int fallback_default = 1; |
|
76 |
-int cr_fetch_rows = 2000; |
|
77 | 75 |
int cr_match_mode = 10; |
78 | 76 |
|
79 | 77 |
|
... | ... |
@@ -112,9 +110,9 @@ static param_export_t params[]= { |
112 | 110 |
{"config_source", STR_PARAM, &config_source }, |
113 | 111 |
{"default_tree", STR_PARAM, &default_tree.s }, |
114 | 112 |
{"config_file", STR_PARAM, &config_file }, |
115 |
- {"use_domain", INT_PARAM, &use_domain }, |
|
116 |
- {"fallback_default", INT_PARAM, &fallback_default }, |
|
117 |
- {"fetch_rows", INT_PARAM, &cr_fetch_rows }, |
|
113 |
+ {"use_domain", INT_PARAM, &default_carrierroute_cfg.use_domain }, |
|
114 |
+ {"fallback_default", INT_PARAM, &default_carrierroute_cfg.fallback_default }, |
|
115 |
+ {"fetch_rows", INT_PARAM, &default_carrierroute_cfg.fetch_rows }, |
|
118 | 116 |
{"match_mode", INT_PARAM, &cr_match_mode }, |
119 | 117 |
{0,0,0} |
120 | 118 |
}; |
... | ... |
@@ -211,6 +209,11 @@ static int mod_init(void) { |
211 | 209 |
return -1; |
212 | 210 |
} |
213 | 211 |
|
212 |
+ if(cfg_declare("carrierroute", carrierroute_cfg_def, &default_carrierroute_cfg, cfg_sizeof(carrierroute), &carrierroute_cfg)){ |
|
213 |
+ LM_ERR("Fail to declare the configuration\n"); |
|
214 |
+ return -1; |
|
215 |
+ } |
|
216 |
+ |
|
214 | 217 |
if (init_route_data() < 0) { |
215 | 218 |
LM_ERR("could not init route data\n"); |
216 | 219 |
return -1; |
60 | 57 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,53 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * This file is part of SIP-router, a free SIP server. |
|
4 |
+ * |
|
5 |
+ * SIP-router is free software; you can redistribute it and/or modify |
|
6 |
+ * it under the terms of the GNU General Public License as published by |
|
7 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
8 |
+ * (at your option) any later version |
|
9 |
+ * |
|
10 |
+ * SIP-router is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
+ * GNU General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU General Public License |
|
16 |
+ * along with this program; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 |
+ * |
|
19 |
+ * History |
|
20 |
+ * ------- |
|
21 |
+ * 2008-02-05 adapting tm module for the configuration framework (Miklos) |
|
22 |
+ */ |
|
23 |
+ |
|
24 |
+/*! |
|
25 |
+ * \file |
|
26 |
+ * \brief Siputils :: Configuration |
|
27 |
+ * \ingroup Siputils |
|
28 |
+ */ |
|
29 |
+ |
|
30 |
+ |
|
31 |
+#include "../../cfg/cfg.h" |
|
32 |
+#include "../../parser/msg_parser.h" /* method types */ |
|
33 |
+ |
|
34 |
+#include "config.h" |
|
35 |
+ |
|
36 |
+struct cfg_group_carrierroute default_carrierroute_cfg = { |
|
37 |
+ 0, /* use_domain */ |
|
38 |
+ 1, /* fallback_default */ |
|
39 |
+ 2000 /* fetch_rows*/ |
|
40 |
+ }; |
|
41 |
+ |
|
42 |
+void *carrierroute_cfg = &default_carrierroute_cfg; |
|
43 |
+ |
|
44 |
+cfg_def_t carrierroute_cfg_def[] = { |
|
45 |
+ {"use_domain", CFG_VAR_INT , 0, 1, 0, 0, |
|
46 |
+ "When using tree lookup per user, this parameter specifies whether to use the domain part for user matching or not." }, |
|
47 |
+ {"fallback_default", CFG_VAR_INT , 0, 1, 0, 0, |
|
48 |
+ "If the user has a non-existing tree set and fallback_default is set to 1, the default tree is used. Else error is returned" }, |
|
49 |
+ {"fetch_rows", CFG_VAR_INT , 0, 0, 0, 0, |
|
50 |
+ "The number of the rows to be fetched at once from database when loading the routing data."}, |
|
51 |
+ {0, 0, 0, 0, 0, 0} |
|
52 |
+}; |
|
53 |
+ |
0 | 54 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,39 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * SIP-router is distributed in the hope that it will be useful, |
|
5 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
6 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
7 |
+ * GNU General Public License for more details. |
|
8 |
+ * |
|
9 |
+ * You should have received a copy of the GNU General Public License |
|
10 |
+ * along with this program; if not, write to the Free Software |
|
11 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
12 |
+ */ |
|
13 |
+ |
|
14 |
+/*! |
|
15 |
+ * \file |
|
16 |
+ * \brief Carrierroute :: Configuration |
|
17 |
+ * \ingroup carrierroute |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+ |
|
21 |
+#ifndef _CARRIERROUTE_CONFIG_H |
|
22 |
+#define _CARRIERROUTE_CONFIG_H |
|
23 |
+ |
|
24 |
+ |
|
25 |
+#include "../../cfg/cfg.h" |
|
26 |
+#include "../../str.h" |
|
27 |
+ |
|
28 |
+struct cfg_group_carrierroute { |
|
29 |
+ unsigned int use_domain; |
|
30 |
+ unsigned int fallback_default; |
|
31 |
+ unsigned int fetch_rows; |
|
32 |
+}; |
|
33 |
+ |
|
34 |
+extern struct cfg_group_carrierroute default_carrierroute_cfg; |
|
35 |
+extern void *carrierroute_cfg; |
|
36 |
+extern cfg_def_t carrierroute_cfg_def[]; |
|
37 |
+ |
|
38 |
+ |
|
39 |
+#endif |
... | ... |
@@ -33,6 +33,7 @@ |
33 | 33 |
#include "carrierroute.h" |
34 | 34 |
#include "cr_db.h" |
35 | 35 |
#include "cr_carrier.h" |
36 |
+#include "config.h" |
|
36 | 37 |
#include <stdio.h> |
37 | 38 |
#include <stdlib.h> |
38 | 39 |
|
... | ... |
@@ -196,7 +197,8 @@ int load_user_carrier(str * user, str * domain) { |
196 | 197 |
db_val_t vals[2]; |
197 | 198 |
db_op_t op[2]; |
198 | 199 |
int id; |
199 |
- if (!user || (use_domain && !domain)) { |
|
200 |
+ int use_domain = cfg_get(carrierroute, carrierroute_cfg, use_domain); |
|
201 |
+ if (!user || (use_domain && !domain)) { |
|
200 | 202 |
LM_ERR("NULL pointer in parameter\n"); |
201 | 203 |
return -1; |
202 | 204 |
} |
... | ... |
@@ -327,7 +329,7 @@ int load_route_data_db(struct route_data_t * rd) { |
327 | 329 |
LM_ERR("Failed to query database to prepare fetch row.\n"); |
328 | 330 |
return -1; |
329 | 331 |
} |
330 |
- if(carrierroute_dbf.fetch_result(carrierroute_dbh, &res, cr_fetch_rows) < 0) { |
|
332 |
+ if(carrierroute_dbf.fetch_result(carrierroute_dbh, &res, cfg_get(carrierroute, carrierroute_cfg, fetch_rows)) < 0) { |
|
331 | 333 |
LM_ERR("Fetching rows failed\n"); |
332 | 334 |
return -1; |
333 | 335 |
} |
... | ... |
@@ -379,7 +381,7 @@ int load_route_data_db(struct route_data_t * rd) { |
379 | 381 |
} |
380 | 382 |
} |
381 | 383 |
if (DB_CAPABILITY(carrierroute_dbf, DB_CAP_FETCH)) { |
382 |
- if(carrierroute_dbf.fetch_result(carrierroute_dbh, &res, cr_fetch_rows) < 0) { |
|
384 |
+ if(carrierroute_dbf.fetch_result(carrierroute_dbh, &res, cfg_get(carrierroute, carrierroute_cfg, fetch_rows)) < 0) { |
|
383 | 385 |
LM_ERR("fetching rows failed\n"); |
384 | 386 |
carrierroute_dbf.free_result(carrierroute_dbh, res); |
385 | 387 |
return -1; |
... | ... |
@@ -47,7 +47,7 @@ |
47 | 47 |
#include "cr_domain.h" |
48 | 48 |
#include "cr_carrier.h" |
49 | 49 |
#include "carrierroute.h" |
50 |
- |
|
50 |
+#include "config.h" |
|
51 | 51 |
|
52 | 52 |
enum hash_algorithm { |
53 | 53 |
alg_crc32 = 1, /*!< hashing algorithm is CRC32 */ |
... | ... |
@@ -546,7 +546,7 @@ int cr_do_route(struct sip_msg * _msg, gparam_t *_carrier, |
546 | 546 |
|
547 | 547 |
carrier_data=NULL; |
548 | 548 |
if (carrier_id < 0) { |
549 |
- if (fallback_default) { |
|
549 |
+ if (cfg_get(carrierroute, carrierroute_cfg, fallback_default)) { |
|
550 | 550 |
LM_NOTICE("invalid tree id %i specified, using default tree\n", carrier_id); |
551 | 551 |
carrier_data = get_carrier_data(rd, rd->default_carrier_id); |
552 | 552 |
} |
... | ... |
@@ -555,7 +555,7 @@ int cr_do_route(struct sip_msg * _msg, gparam_t *_carrier, |
555 | 555 |
} else { |
556 | 556 |
carrier_data = get_carrier_data(rd, carrier_id); |
557 | 557 |
if (carrier_data == NULL) { |
558 |
- if (fallback_default) { |
|
558 |
+ if (cfg_get(carrierroute, carrierroute_cfg, fallback_default)) { |
|
559 | 559 |
LM_NOTICE("invalid tree id %i specified, using default tree\n", carrier_id); |
560 | 560 |
carrier_data = get_carrier_data(rd, rd->default_carrier_id); |
561 | 561 |
} |
... | ... |
@@ -622,7 +622,6 @@ int cr_load_user_carrier(struct sip_msg * _msg, gparam_t *_user, gparam_t *_doma |
622 | 622 |
LM_ERR("cannot print the domain\n"); |
623 | 623 |
return -1; |
624 | 624 |
} |
625 |
- |
|
626 | 625 |
/* get carrier id */ |
627 | 626 |
if ((avp_val.n = load_user_carrier(&user, &domain)) < 0) { |
628 | 627 |
LM_ERR("error in load user carrier"); |
... | ... |
@@ -764,7 +763,7 @@ int cr_load_next_domain(struct sip_msg * _msg, gparam_t *_carrier, |
764 | 763 |
|
765 | 764 |
carrier_data=NULL; |
766 | 765 |
if (carrier_id < 0) { |
767 |
- if (fallback_default) { |
|
766 |
+ if (cfg_get(carrierroute, carrierroute_cfg, fallback_default)) { |
|
768 | 767 |
LM_NOTICE("invalid tree id %i specified, using default tree\n", carrier_id); |
769 | 768 |
carrier_data = get_carrier_data(rd, rd->default_carrier_id); |
770 | 769 |
} |
... | ... |
@@ -773,7 +772,7 @@ int cr_load_next_domain(struct sip_msg * _msg, gparam_t *_carrier, |
773 | 772 |
} else { |
774 | 773 |
carrier_data = get_carrier_data(rd, carrier_id); |
775 | 774 |
if (carrier_data == NULL) { |
776 |
- if (fallback_default) { |
|
775 |
+ if (cfg_get(carrierroute, carrierroute_cfg, fallback_default)) { |
|
777 | 776 |
LM_NOTICE("invalid tree id %i specified, using default tree\n", carrier_id); |
778 | 777 |
carrier_data = get_carrier_data(rd, rd->default_carrier_id); |
779 | 778 |
} |
... | ... |
@@ -262,7 +262,8 @@ modparam("carrierroute", "default_tree", "default") |
262 | 262 |
<title><varname>use_domain</varname> (int)</title> |
263 | 263 |
<para> |
264 | 264 |
When using tree lookup per user, this parameter specifies whether |
265 |
- to use the domain part for user matching or not. |
|
265 |
+ to use the domain part for user matching or not. This parameter |
|
266 |
+ is tunable via the ser cfg framework. |
|
266 | 267 |
</para> |
267 | 268 |
<para> |
268 | 269 |
<emphasis> |
... | ... |
@@ -285,7 +286,7 @@ modparam("carrierroute", "use_domain", 0) |
285 | 286 |
This parameter defines the behaviour when using user-based tree |
286 | 287 |
lookup. If the user has a non-existing tree set and fallback_default |
287 | 288 |
is set to 1, the default tree is used. Otherwise, cr_user_rewrite_uri |
288 |
- returns an error. |
|
289 |
+ returns an error. This parameter is tunable via the ser cfg framework. |
|
289 | 290 |
</para> |
290 | 291 |
<para> |
291 | 292 |
<emphasis> |
... | ... |
@@ -308,7 +309,8 @@ modparam("carrierroute", "fallback_default", 1) |
308 | 309 |
when loading the routing data. This value can be used to tune |
309 | 310 |
the load time at startup. For 1MB of private memory (default) |
310 | 311 |
it should be below 3750. The database driver must support the |
311 |
- fetch_result() capability. |
|
312 |
+ fetch_result() capability. This parameter is tunable via the ser |
|
313 |
+ cfg framework. |
|
312 | 314 |
</para> |
313 | 315 |
<para> |
314 | 316 |
<emphasis> |