Ported ser example configs to sip-router:
- updated module path (now using loadpath)
- changed mysql module name to db_mysql
- replaced max_len in msg:len comparisons with 4096
- updated avp and selects non-empty checks:
if($v) -> if ($v!="")
if(!$v) -> if (strempty($v)) or if ($v=="")
... | ... |
@@ -8,7 +8,7 @@ |
8 | 8 |
|
9 | 9 |
# ----------- global configuration parameters ------------------------ |
10 | 10 |
|
11 |
-debug=3 # debug level (cmd line: -dddddddddd) |
|
11 |
+debug=2 # debug level (cmd line: -dddddddddd) |
|
12 | 12 |
#memdbg=10 # memory debug message level |
13 | 13 |
#memlog=10 # memory statistics log level |
14 | 14 |
#log_facility=LOG_LOCAL0 # sets the facility used for logging (see syslog(3)) |
... | ... |
@@ -35,14 +35,18 @@ rev_dns=no # (cmd. line: -R) |
35 | 35 |
|
36 | 36 |
# ------------------ module loading ---------------------------------- |
37 | 37 |
|
38 |
-loadmodule "/usr/local/lib/ser/modules/sl.so" |
|
39 |
-loadmodule "/usr/local/lib/ser/modules/tm.so" |
|
40 |
-loadmodule "/usr/local/lib/ser/modules/rr.so" |
|
41 |
-loadmodule "/usr/local/lib/ser/modules/textops.so" |
|
42 |
-loadmodule "/usr/local/lib/ser/modules/maxfwd.so" |
|
43 |
-loadmodule "/usr/local/lib/ser/modules/usrloc.so" |
|
44 |
-loadmodule "/usr/local/lib/ser/modules/registrar.so" |
|
45 |
-loadmodule "/usr/local/lib/ser/modules/ctl.so" |
|
38 |
+#loadpath "modules:modules_s" |
|
39 |
+loadpath "/usr/lib/ser/modules:/usr/lib/ser/modules_s" |
|
40 |
+ |
|
41 |
+loadmodule "sl" |
|
42 |
+loadmodule "tm" |
|
43 |
+loadmodule "rr" |
|
44 |
+loadmodule "textops" |
|
45 |
+loadmodule "maxfwd" |
|
46 |
+loadmodule "usrloc" |
|
47 |
+loadmodule "registrar" |
|
48 |
+loadmodule "ctl" |
|
49 |
+loadmodule "cfg_rpc" |
|
46 | 50 |
|
47 | 51 |
# ----------------- setting module-specific parameters --------------- |
48 | 52 |
|
... | ... |
@@ -75,7 +79,7 @@ route{ |
75 | 79 |
sl_reply("483","Too Many Hops"); |
76 | 80 |
break; |
77 | 81 |
} |
78 |
- if (msg:len >= max_len ) { |
|
82 |
+ if (msg:len >= 4096 ) { |
|
79 | 83 |
sl_reply("513", "Message too big"); |
80 | 84 |
break; |
81 | 85 |
} |
... | ... |
@@ -254,10 +254,11 @@ rtp_proxy.enabled = "detect" desc "indicates whether the RTP Proxy is enabled or |
254 | 254 |
|
255 | 255 |
# ------------------ Module Loading ----------------------------------------- |
256 | 256 |
|
257 |
-loadpath "/usr/lib/ser/modules" |
|
257 |
+#loadpath "modules:modules_s" |
|
258 |
+loadpath "/usr/lib/ser/modules:/usr/lib/ser/modules_s" |
|
258 | 259 |
|
259 | 260 |
# load a SQL database for authentication, domains, user AVPs etc. |
260 |
-loadmodule "mysql" |
|
261 |
+loadmodule "db_mysql" |
|
261 | 262 |
#loadmodule "postgres" |
262 | 263 |
|
263 | 264 |
loadmodule "sl" |
... | ... |
@@ -601,7 +602,7 @@ route[FORWARD] |
601 | 602 |
# If this is an initial INVITE (without a To-tag) we might try |
602 | 603 |
# another target (call forwarding or voicemail) after receiving |
603 | 604 |
# an error. |
604 |
- if (method=="INVITE" && !@to.tag) { |
|
605 |
+ if (method=="INVITE" && strempty(@to.tag)) { |
|
605 | 606 |
t_on_failure("FAILURE_ROUTE"); |
606 | 607 |
} |
607 | 608 |
|
... | ... |
@@ -652,7 +653,7 @@ route[INIT] |
652 | 653 |
} |
653 | 654 |
|
654 | 655 |
# Set flag for use in the onsend route |
655 |
- if (@to.tag) { |
|
656 |
+ if (@to.tag != "") { |
|
656 | 657 |
setflag(FLAG_TOTAG); |
657 | 658 |
} |
658 | 659 |
|
... | ... |
@@ -661,7 +662,7 @@ route[INIT] |
661 | 662 |
|
662 | 663 |
# Activate accounting for all initial INVITEs. In-dialog requests |
663 | 664 |
# are accounted by a RR cookie (see below). |
664 |
- if (method == "INVITE" && !@to.tag) { |
|
665 |
+ if (method == "INVITE" && strempty(@to.tag)) { |
|
665 | 666 |
setflag(FLAG_ACC); |
666 | 667 |
} |
667 | 668 |
|
... | ... |
@@ -679,7 +680,8 @@ route[OPTIONS_REPLY] |
679 | 680 |
# OPTIONS requests without a username in the Request-URI but one |
680 | 681 |
# of our domains or IPs are addressed to the proxy itself and |
681 | 682 |
# can be answered statelessly. |
682 |
- if (method == "OPTIONS" && !@ruri.user && (uri == myself || $t.did)) |
|
683 |
+ if (method == "OPTIONS" && strempty(@ruri.user) && |
|
684 |
+ (uri == myself || $t.did != "")) |
|
683 | 685 |
{ |
684 | 686 |
options_reply(); |
685 | 687 |
drop; |
... | ... |
@@ -711,7 +713,7 @@ route[NAT_DETECTION] |
711 | 713 |
# would be to store the original information as a contact parameter |
712 | 714 |
# and restore it on its way back. |
713 | 715 |
if (nat_uac_test("19") |
714 |
- || (@hf_value["contact"] && @contact.uri.params.maddr)) |
|
716 |
+ || (@hf_value["contact"] != "" && @contact.uri.params.maddr != "")) |
|
715 | 717 |
{ |
716 | 718 |
setflag(FLAG_NAT); |
717 | 719 |
$uac_nat = 1; |
... | ... |
@@ -756,7 +758,7 @@ route[RTPPROXY] |
756 | 758 |
} |
757 | 759 |
|
758 | 760 |
# Turn the RTP proxy on for INVITEs and UPDATEs. |
759 |
- if (((method=="INVITE" || method == "UPDATE") && @msg.body) |
|
761 |
+ if (((method=="INVITE" || method == "UPDATE") && @msg.body != "") |
|
760 | 762 |
&& !isflagset(FLAG_RTP_PROXY)) |
761 | 763 |
{ |
762 | 764 |
force_rtp_proxy('r'); |
... | ... |
@@ -795,7 +797,7 @@ route[LOOSE_ROUTE] |
795 | 797 |
} |
796 | 798 |
|
797 | 799 |
# Restore Session Timer flag and headers. |
798 |
- if ($stimer && ($stimer != "0")) { |
|
800 |
+ if ( defined $stimer && ($stimer != "0")) { |
|
799 | 801 |
route(SESSION_TIMER); |
800 | 802 |
} |
801 | 803 |
|
... | ... |
@@ -871,7 +873,7 @@ route[DOMAIN_POLICY] |
871 | 873 |
# destination (a@A calls b@B who forwards to c@C. A BYE by c@C is |
872 | 874 |
# then From b@B and To a@A. There is no mentioning of c@C despite |
873 | 875 |
# legitimate behaviour of c@C). |
874 |
- if (!isflagset(FLAG_TOTAG) && !$t.did && !$f.did) { |
|
876 |
+ if (!isflagset(FLAG_TOTAG) && strempty($t.did) && strempty($f.did)) { |
|
875 | 877 |
sl_reply("403", "Relaying Forbidden"); |
876 | 878 |
drop; |
877 | 879 |
} |
... | ... |
@@ -926,7 +928,7 @@ route[REGISTRAR] |
926 | 928 |
} |
927 | 929 |
|
928 | 930 |
# Check if the REGISTER if for one of our local domains. |
929 |
- if (!$t.did) { |
|
931 |
+ if (strempty($t.did)) { |
|
930 | 932 |
sl_reply("403", "Register Forwarding Forbidden"); |
931 | 933 |
drop; |
932 | 934 |
} |
... | ... |
@@ -951,7 +953,7 @@ route[REGISTRAR] |
951 | 953 |
sl_reply("400", "Bad Request"); |
952 | 954 |
} |
953 | 955 |
else { |
954 |
- if ($digest_challenge) { |
|
956 |
+ if ($digest_challenge != "") { |
|
955 | 957 |
append_to_reply("%$digest_challenge"); |
956 | 958 |
} |
957 | 959 |
sl_reply("401", "Unauthorized"); |
... | ... |
@@ -1034,7 +1036,7 @@ route[AUTHENTICATION] |
1034 | 1036 |
|
1035 | 1037 |
# Requests from non-local to local domains should be permitted. |
1036 | 1038 |
# Remove this if you want a walled garden. |
1037 |
- if (!$f.did) { |
|
1039 |
+ if (strempty($f.did)) { |
|
1038 | 1040 |
break; |
1039 | 1041 |
} |
1040 | 1042 |
|
... | ... |
@@ -1086,7 +1088,7 @@ route[OUTBOUND] |
1086 | 1088 |
# If a local user calls to a foreign domain we play outbound |
1087 | 1089 |
# proxy for them. |
1088 | 1090 |
# Comment this out if you want a walled garden. |
1089 |
- if ($f.did && !$t.did) { |
|
1091 |
+ if ($f.did != "" && strempty($t.did)) { |
|
1090 | 1092 |
append_hf("P-hint: outbound\r\n"); |
1091 | 1093 |
route(FORWARD); |
1092 | 1094 |
} |
... | ... |
@@ -1099,7 +1101,7 @@ route[SPEEDDIAL] |
1099 | 1101 |
{ |
1100 | 1102 |
# If the caller is local and uses two digits only, we redirect the |
1101 | 1103 |
# UA to the real target. |
1102 |
- if ($fd.did && uri =~ "sip:[0-9][0-9]@") { |
|
1104 |
+ if ($fd.did != "" && uri =~ "sip:[0-9][0-9]@") { |
|
1103 | 1105 |
if (sd_lookup("speed_dial")) { |
1104 | 1106 |
sl_reply("302", "Speed Dial Redirect"); |
1105 | 1107 |
} |
... | ... |
@@ -1133,7 +1135,7 @@ route[INBOUND] |
1133 | 1135 |
# Check for call forwarding of the callee. |
1134 | 1136 |
# Note: The forwarding target has to be full routable URI |
1135 | 1137 |
# in this example. |
1136 |
- if ($tu.fwd_always_target) { |
|
1138 |
+ if ($tu.fwd_always_target != "") { |
|
1137 | 1139 |
attr2uri("$tu.fwd_always_target"); |
1138 | 1140 |
|
1139 | 1141 |
# If we are forwarding to ourselves, don't remove |
... | ... |
@@ -1143,7 +1145,7 @@ route[INBOUND] |
1143 | 1145 |
# still be problematic -- credentials are already |
1144 | 1146 |
# removed when we forward. Consider using a 3xx. |
1145 | 1147 |
lookup_domain("$td", "@ruri.host"); |
1146 |
- if ($t.did) { |
|
1148 |
+ if ($t.did != "") { |
|
1147 | 1149 |
setflag(FLAG_DONT_RM_CRED); |
1148 | 1150 |
} |
1149 | 1151 |
route(FORWARD); |
... | ... |
@@ -1193,13 +1195,13 @@ route[PSTN] |
1193 | 1195 |
{ |
1194 | 1196 |
# Check some conditions first: |
1195 | 1197 |
# PSTN is available for our own users only. |
1196 |
- if (!$f.did) { |
|
1198 |
+ if (strempty($f.did)) { |
|
1197 | 1199 |
break; |
1198 | 1200 |
} |
1199 | 1201 |
|
1200 | 1202 |
# If the attribute $gw_ip isn't set, there is no PSTN service |
1201 | 1203 |
# active. |
1202 |
- if (!$gw_ip) { |
|
1204 |
+ if (!defined $gw_ip) { |
|
1203 | 1205 |
break; |
1204 | 1206 |
} |
1205 | 1207 |
|
... | ... |
@@ -1213,8 +1215,8 @@ route[PSTN] |
1213 | 1215 |
# format that is accepted by your gateway here. |
1214 | 1216 |
|
1215 | 1217 |
# Check permissions of the caller for initial INVITEs. |
1216 |
- if (method == "INVITE" && !@to.tag) { |
|
1217 |
- if (!$f.gw_acl == "1") { |
|
1218 |
+ if (method == "INVITE" && strempty(@to.tag)) { |
|
1219 |
+ if ($f.gw_acl != "1") { |
|
1218 | 1220 |
sl_reply("403", "PSTN Not Permitted"); |
1219 | 1221 |
drop; |
1220 | 1222 |
} |
... | ... |
@@ -1224,7 +1226,7 @@ route[PSTN] |
1224 | 1226 |
# Remote-Party-ID header. |
1225 | 1227 |
# Depending on your gateway, you may have to add a |
1226 | 1228 |
# P-Asserted-Identity header here instead. |
1227 |
- if ($asserted_id) { |
|
1229 |
+ if (defined $asserted_id) { |
|
1228 | 1230 |
xlset_attr("$rpidheader", |
1229 | 1231 |
"<sip:%$asserted_id@%@ruri.host>;screen=yes"); |
1230 | 1232 |
replace_attr_hf("Remote-Party-ID", "$rpidheader"); |
... | ... |
@@ -1267,7 +1269,7 @@ route[CATCH_CANCEL] |
1267 | 1269 |
route[SITE_SPECIFIC] |
1268 | 1270 |
{ |
1269 | 1271 |
# This is only relevant for requests for one of our domains. |
1270 |
- if (!$t.did) { |
|
1272 |
+ if (strempty($t.did)) { |
|
1271 | 1273 |
break; |
1272 | 1274 |
} |
1273 | 1275 |
|
... | ... |
@@ -1291,7 +1293,7 @@ route[SESSION_TIMER] |
1291 | 1293 |
} |
1292 | 1294 |
|
1293 | 1295 |
# Let's check if the Session-Expires header is already present. |
1294 |
- if (@hf_value.session_expires) { |
|
1296 |
+ if (@hf_value.session_expires != "") { |
|
1295 | 1297 |
# Compare the Session-Expires header value with the |
1296 | 1298 |
# configured Min-SE. |
1297 | 1299 |
eval_push("x:%@hf_value.session_expires.uri"); |
... | ... |
@@ -1377,7 +1379,7 @@ failure_route[FAILURE_ROUTE] |
1377 | 1379 |
# credentials (if we consumed them, they may be missing in |
1378 | 1380 |
# a loop, if we don't consume them, messages are bigger and |
1379 | 1381 |
# more vulnerable) |
1380 |
- if ($tu.fwd_busy_target) { |
|
1382 |
+ if ($tu.fwd_busy_target != "") { |
|
1381 | 1383 |
#attr2uri("$tu.fwd_busy_target"); |
1382 | 1384 |
#route(FORWARD); |
1383 | 1385 |
attr_destination("$tu.fwd_busy_target"); |
... | ... |
@@ -1390,7 +1392,7 @@ failure_route[FAILURE_ROUTE] |
1390 | 1392 |
# If we received no answer and the noanswer target is set, |
1391 | 1393 |
# forward it there. |
1392 | 1394 |
# Note: See above. |
1393 |
- if ($tu.fwd_noanswer_target) { |
|
1395 |
+ if ($tu.fwd_noanswer_target != "") { |
|
1394 | 1396 |
#attr2uri("$tu.fwd_noanswer_target"); |
1395 | 1397 |
#route(FORWARD); |
1396 | 1398 |
attr_destination("$tu.fwd_noanswer_target"); |
... | ... |
@@ -1409,7 +1411,7 @@ onreply_route[REPLY_ROUTE] |
1409 | 1411 |
# Do the same if the contact is maddred. See the notes in route |
1410 | 1412 |
# [NAT_DETECTION] for more information. |
1411 | 1413 |
if (nat_uac_test("1") || |
1412 |
- (@hf_value["contact"] && @contact.uri.params.maddr)) |
|
1414 |
+ (@hf_value["contact"] != "" && @contact.uri.params.maddr != "")) |
|
1413 | 1415 |
{ |
1414 | 1416 |
fix_nated_contact(); |
1415 | 1417 |
} |
... | ... |
@@ -1418,7 +1420,7 @@ onreply_route[REPLY_ROUTE] |
1418 | 1420 |
# body, inform RTP proxy. |
1419 | 1421 |
if (isflagset(FLAG_RTP_PROXY) |
1420 | 1422 |
&& status=~"(18[03])|(2[0-9][0-9])" |
1421 |
- && @msg.body) |
|
1423 |
+ && @msg.body != "") |
|
1422 | 1424 |
{ |
1423 | 1425 |
force_rtp_proxy('r'); |
1424 | 1426 |
} |
... | ... |
@@ -1426,7 +1428,7 @@ onreply_route[REPLY_ROUTE] |
1426 | 1428 |
# Let's check for session timer support. |
1427 | 1429 |
if (isflagset(FLAG_SESSIONTIMER) && status =~ "2[0-9][0-9]") { |
1428 | 1430 |
# The UAC wanted to have a session timer. |
1429 |
- if (!@hf_value.session_expires) { |
|
1431 |
+ if (strempty(@hf_value.session_expires)) { |
|
1430 | 1432 |
# But the UAS does not support it, so we will try |
1431 | 1433 |
# to convince the UAC to do it. |
1432 | 1434 |
append_hf_value("Session-Expires", |
... | ... |
@@ -24,7 +24,7 @@ |
24 | 24 |
|
25 | 25 |
# ----------- global configuration parameters ------------------------ |
26 | 26 |
|
27 |
-debug=3 # debug level (cmd line: -dddddddddd) |
|
27 |
+debug=2 # debug level (cmd line: -dddddddddd) |
|
28 | 28 |
#memdbg=10 # memory debug log level |
29 | 29 |
#memlog=10 # memory statistics log level |
30 | 30 |
#log_facility=LOG_LOCAL0 # sets the facility used for logging (see syslog(3)) |
... | ... |
@@ -52,29 +52,32 @@ enable_tls=yes |
52 | 52 |
|
53 | 53 |
# ------------------ module loading ---------------------------------- |
54 | 54 |
|
55 |
+#loadpath "modules:modules_s" |
|
56 |
+loadpath "/usr/lib/ser/modules:/usr/lib/ser/modules_s" |
|
57 |
+ |
|
55 | 58 |
# load a SQL database for authentication, domains, user AVPs etc. |
56 |
-loadmodule "/usr/local/lib/ser/modules/mysql.so" |
|
57 |
- |
|
58 |
-loadmodule "/usr/local/lib/ser/modules/sl.so" |
|
59 |
-loadmodule "/usr/local/lib/ser/modules/tm.so" |
|
60 |
-loadmodule "/usr/local/lib/ser/modules/rr.so" |
|
61 |
-loadmodule "/usr/local/lib/ser/modules/maxfwd.so" |
|
62 |
-loadmodule "/usr/local/lib/ser/modules/usrloc.so" |
|
63 |
-loadmodule "/usr/local/lib/ser/modules/registrar.so" |
|
64 |
-loadmodule "/usr/local/lib/ser/modules/xlog.so" |
|
65 |
-loadmodule "/usr/local/lib/ser/modules/textops.so" |
|
66 |
-loadmodule "/usr/local/lib/ser/modules/ctl.so" |
|
67 |
-loadmodule "/usr/local/lib/ser/modules/fifo.so" |
|
68 |
-loadmodule "/usr/local/lib/ser/modules/auth.so" |
|
69 |
-loadmodule "/usr/local/lib/ser/modules/auth_db.so" |
|
70 |
-loadmodule "/usr/local/lib/ser/modules/gflags.so" |
|
71 |
-loadmodule "/usr/local/lib/ser/modules/domain.so" |
|
72 |
-loadmodule "/usr/local/lib/ser/modules/uri_db.so" |
|
73 |
-loadmodule "/usr/local/lib/ser/modules/avp.so" |
|
74 |
-loadmodule "/usr/local/lib/ser/modules/avp_db.so" |
|
75 |
-loadmodule "/usr/local/lib/ser/modules/acc_db.so" |
|
76 |
-loadmodule "/usr/local/lib/ser/modules/xmlrpc.so" |
|
77 |
-#loadmodule "/usr/local/lib/ser/modules/tls.so" |
|
59 |
+loadmodule "db_mysql" |
|
60 |
+ |
|
61 |
+loadmodule "sl" |
|
62 |
+loadmodule "tm" |
|
63 |
+loadmodule "rr" |
|
64 |
+loadmodule "maxfwd" |
|
65 |
+loadmodule "usrloc" |
|
66 |
+loadmodule "registrar" |
|
67 |
+loadmodule "xlog" |
|
68 |
+loadmodule "textops" |
|
69 |
+loadmodule "ctl" |
|
70 |
+loadmodule "cfg_rpc" |
|
71 |
+loadmodule "auth" |
|
72 |
+loadmodule "auth_db" |
|
73 |
+loadmodule "gflags" |
|
74 |
+loadmodule "domain" |
|
75 |
+loadmodule "uri_db" |
|
76 |
+loadmodule "avp" |
|
77 |
+loadmodule "avp_db" |
|
78 |
+loadmodule "acc_db" |
|
79 |
+loadmodule "xmlrpc" |
|
80 |
+#loadmodule "tls" |
|
78 | 81 |
|
79 | 82 |
# ----------------- setting script FLAGS ----------------------------- |
80 | 83 |
flags |
... | ... |
@@ -200,7 +203,7 @@ route[FORWARD] |
200 | 203 |
|
201 | 204 |
# if this is an initial INVITE (without a To-tag) we might try another |
202 | 205 |
# (forwarding or voicemail) target after receiving an error |
203 |
- if (method=="INVITE" && !@to.tag) { |
|
206 |
+ if (method=="INVITE" && strempty(@to.tag)) { |
|
204 | 207 |
t_on_failure("FAILURE_ROUTE"); |
205 | 208 |
} |
206 | 209 |
|
... | ... |
@@ -221,7 +224,7 @@ route[INIT] |
221 | 224 |
drop; |
222 | 225 |
} |
223 | 226 |
|
224 |
- if (msg:len >= max_len ) { |
|
227 |
+ if (msg:len >= 4096 ) { |
|
225 | 228 |
sl_reply("513", "Message too big"); |
226 | 229 |
drop; |
227 | 230 |
} |
... | ... |
@@ -232,7 +235,7 @@ route[INIT] |
232 | 235 |
|
233 | 236 |
# lets account all initial INVITEs |
234 | 237 |
# further in-dialog requests are accounted by a RR cookie (see below) |
235 |
- if (method=="INVITE" && !@to.tag) { |
|
238 |
+ if (method=="INVITE" && strempty(@to.tag)) { |
|
236 | 239 |
setflag(FLAG_ACC); |
237 | 240 |
} |
238 | 241 |
} |
... | ... |
@@ -308,7 +311,7 @@ route[DOMAIN] |
308 | 311 |
# we dont know the domain of the caller and also not |
309 | 312 |
# the domain of the callee -> somone uses our proxy as |
310 | 313 |
# a relay |
311 |
- if (!$t.did && !$f.did) { |
|
314 |
+ if (strempty($t.did) && strempty($f.did)) { |
|
312 | 315 |
sl_reply("403", "Relaying Forbidden"); |
313 | 316 |
drop; |
314 | 317 |
} |
... | ... |
@@ -319,7 +322,7 @@ route[REGISTRAR] |
319 | 322 |
# if the request is a REGISTER lets take care of it |
320 | 323 |
if (method=="REGISTER") { |
321 | 324 |
# check if the REGISTER if for one of our local domains |
322 |
- if (!$t.did) { |
|
325 |
+ if (strempty($t.did)) { |
|
323 | 326 |
sl_reply("403", "Register forwarding forbidden"); |
324 | 327 |
drop; |
325 | 328 |
} |
... | ... |
@@ -331,7 +334,7 @@ route[REGISTRAR] |
331 | 334 |
} else if ($? == -3) { |
332 | 335 |
sl_reply("400", "Bad Request"); |
333 | 336 |
} else { |
334 |
- if ($digest_challenge) { |
|
337 |
+ if ($digest_challenge != "") { |
|
335 | 338 |
append_to_reply("%$digest_challenge"); |
336 | 339 |
} |
337 | 340 |
sl_reply("401", "Unauthorized"); |
... | ... |
@@ -379,7 +382,7 @@ route[AUTHENTICATION] |
379 | 382 |
|
380 | 383 |
# requests from non-local to local domains should be permitted |
381 | 384 |
# remove this if you want a walled garden |
382 |
- if (! $f.did) { |
|
385 |
+ if (strempty($f.did)) { |
|
383 | 386 |
break; |
384 | 387 |
} |
385 | 388 |
|
... | ... |
@@ -397,7 +400,7 @@ route[AUTHENTICATION] |
397 | 400 |
} else if ($? == -3) { |
398 | 401 |
sl_reply("400", "Bad Request"); |
399 | 402 |
} else { |
400 |
- if ($digest_challenge) { |
|
403 |
+ if ($digest_challenge != "") { |
|
401 | 404 |
append_to_reply("%$digest_challenge"); |
402 | 405 |
} |
403 | 406 |
sl_reply("407", "Proxy Authentication Required"); |
... | ... |
@@ -422,7 +425,7 @@ route[OUTBOUND] |
422 | 425 |
{ |
423 | 426 |
# if a local user calls to a foreign domain we play outbound proxy for him |
424 | 427 |
# comment this out if you want a walled garden |
425 |
- if ($f.did && ! $t.did) { |
|
428 |
+ if ($f.did != "" && $t.did == "") { |
|
426 | 429 |
append_hf("P-hint: outbound\r\n"); |
427 | 430 |
route(FORWARD); |
428 | 431 |
} |
... | ... |
@@ -438,7 +441,7 @@ route[INBOUND] |
438 | 441 |
|
439 | 442 |
# if you want to know if the callee username was an alias |
440 | 443 |
# check it like this |
441 |
- #if (! $tu.uri_canonical) { |
|
444 |
+ #if (strempty($tu.uri_canonical)) { |
|
442 | 445 |
# if the alias URI has different AVPs/preferences |
443 | 446 |
# you can load them into the URI track like this |
444 | 447 |
#load_attrs("$tr", "@ruri"); |
... | ... |
@@ -447,7 +450,7 @@ route[INBOUND] |
447 | 450 |
# check for call forwarding of the callee |
448 | 451 |
# Note: the forwarding target has to be full routable URI |
449 | 452 |
# in this example |
450 |
- if ($tu.fwd_always_target) { |
|
453 |
+ if ($tu.fwd_always_target != "") { |
|
451 | 454 |
attr2uri("$tu.fwd_always_target"); |
452 | 455 |
route(FORWARD); |
453 | 456 |
} |
... | ... |
@@ -461,8 +464,8 @@ route[INBOUND] |
461 | 464 |
# Note1: timer values have to be in ms now! |
462 | 465 |
# Note2: this makes even more sense if you switch to a voicemail |
463 | 466 |
# from the FAILURE_ROUTE below |
464 |
- if ($t.fr_inv_timer) { |
|
465 |
- if ($t.fr_timer) { |
|
467 |
+ if ($t.fr_inv_timer != 0) { |
|
468 |
+ if ($t.fr_timer != 0) { |
|
466 | 469 |
t_set_fr("$t.fr_inv_timer", "$t.fr_timer"); |
467 | 470 |
} else { |
468 | 471 |
t_set_fr("$t.fr_inv_timer"); |
... | ... |
@@ -484,13 +487,13 @@ route[PSTN] |
484 | 487 |
# Only users from a local domain are permitted to make calls. |
485 | 488 |
# Additionally you might want to check the acl AVP to verify |
486 | 489 |
# that the user is allowed to make such expensives calls. |
487 |
- if ($f.did && $gw_ip && |
|
490 |
+ if ($f.did != "" && $gw_ip != "" && |
|
488 | 491 |
uri=~"sips?:\+?[0-9]{3,18}@.*") { |
489 | 492 |
# probably you need to convert the number in the request |
490 | 493 |
# URI according to the requirements of your gateway here |
491 | 494 |
|
492 | 495 |
# if an AVP 'asserted_id' is set we insert an RPID header |
493 |
- if ($asserted_id) { |
|
496 |
+ if ($asserted_id != "") { |
|
494 | 497 |
xlset_attr("$rpidheader", "<sip:%$asserted_id@%@ruri.host>;screen=yes"); |
495 | 498 |
replace_attr_hf("Remote-Party-ID", "$rpidheader"); |
496 | 499 |
} |
... | ... |
@@ -527,7 +530,7 @@ failure_route[FAILURE_ROUTE] |
527 | 530 |
if (t_check_status("486|600")) { |
528 | 531 |
# if we received a busy and a busy target is set, forward it there |
529 | 532 |
# Note: again the forwarding target has to be a routeable URI |
530 |
- if ($tu.fwd_busy_target) { |
|
533 |
+ if ($tu.fwd_busy_target != "") { |
|
531 | 534 |
attr2uri("$tu.fwd_busy_target"); |
532 | 535 |
route(FORWARD); |
533 | 536 |
} |
... | ... |
@@ -537,7 +540,7 @@ failure_route[FAILURE_ROUTE] |
537 | 540 |
# if we received no answer and the noanswer target is set, |
538 | 541 |
# forward it there |
539 | 542 |
# Note: again the target has to be a routeable URI |
540 |
- if ($tu.fwd_noanswer_target) { |
|
543 |
+ if ($tu.fwd_noanswer_target != "") { |
|
541 | 544 |
attr2uri("$tu.fwd_noanswer_target"); |
542 | 545 |
route(FORWARD); |
543 | 546 |
} |