|
@@ -254,10 +254,11 @@ rtp_proxy.enabled = "detect" desc "indicates whether the RTP Proxy is enabled or
|
|
|
|
|
|
# ------------------ Module Loading -----------------------------------------
|
|
|
|
|
|
-loadpath "/usr/lib/ser/modules"
|
|
|
+#loadpath "modules:modules_s"
|
|
|
+loadpath "/usr/lib/ser/modules:/usr/lib/ser/modules_s"
|
|
|
|
|
|
# load a SQL database for authentication, domains, user AVPs etc.
|
|
|
-loadmodule "mysql"
|
|
|
+loadmodule "db_mysql"
|
|
|
#loadmodule "postgres"
|
|
|
|
|
|
loadmodule "sl"
|
|
@@ -601,7 +602,7 @@ route[FORWARD]
|
|
|
# If this is an initial INVITE (without a To-tag) we might try
|
|
|
# another target (call forwarding or voicemail) after receiving
|
|
|
# an error.
|
|
|
- if (method=="INVITE" && [email protected]) {
|
|
|
+ if (method=="INVITE" && strempty(@to.tag)) {
|
|
|
t_on_failure("FAILURE_ROUTE");
|
|
|
}
|
|
|
|
|
@@ -652,7 +653,7 @@ route[INIT]
|
|
|
}
|
|
|
|
|
|
# Set flag for use in the onsend route
|
|
|
- if (@to.tag) {
|
|
|
+ if (@to.tag != "") {
|
|
|
setflag(FLAG_TOTAG);
|
|
|
}
|
|
|
|
|
@@ -661,7 +662,7 @@ route[INIT]
|
|
|
|
|
|
# Activate accounting for all initial INVITEs. In-dialog requests
|
|
|
# are accounted by a RR cookie (see below).
|
|
|
- if (method == "INVITE" && [email protected]) {
|
|
|
+ if (method == "INVITE" && strempty(@to.tag)) {
|
|
|
setflag(FLAG_ACC);
|
|
|
}
|
|
|
|
|
@@ -679,7 +680,8 @@ route[OPTIONS_REPLY]
|
|
|
# OPTIONS requests without a username in the Request-URI but one
|
|
|
# of our domains or IPs are addressed to the proxy itself and
|
|
|
# can be answered statelessly.
|
|
|
- if (method == "OPTIONS" && [email protected] && (uri == myself || $t.did))
|
|
|
+ if (method == "OPTIONS" && strempty(@ruri.user) &&
|
|
|
+ (uri == myself || $t.did != ""))
|
|
|
{
|
|
|
options_reply();
|
|
|
drop;
|
|
@@ -711,7 +713,7 @@ route[NAT_DETECTION]
|
|
|
# would be to store the original information as a contact parameter
|
|
|
# and restore it on its way back.
|
|
|
if (nat_uac_test("19")
|
|
|
- || (@hf_value["contact"] && @contact.uri.params.maddr))
|
|
|
+ || (@hf_value["contact"] != "" && @contact.uri.params.maddr != ""))
|
|
|
{
|
|
|
setflag(FLAG_NAT);
|
|
|
$uac_nat = 1;
|
|
@@ -756,7 +758,7 @@ route[RTPPROXY]
|
|
|
}
|
|
|
|
|
|
# Turn the RTP proxy on for INVITEs and UPDATEs.
|
|
|
- if (((method=="INVITE" || method == "UPDATE") && @msg.body)
|
|
|
+ if (((method=="INVITE" || method == "UPDATE") && @msg.body != "")
|
|
|
&& !isflagset(FLAG_RTP_PROXY))
|
|
|
{
|
|
|
force_rtp_proxy('r');
|
|
@@ -795,7 +797,7 @@ route[LOOSE_ROUTE]
|
|
|
}
|
|
|
|
|
|
# Restore Session Timer flag and headers.
|
|
|
- if ($stimer && ($stimer != "0")) {
|
|
|
+ if ( defined $stimer && ($stimer != "0")) {
|
|
|
route(SESSION_TIMER);
|
|
|
}
|
|
|
|
|
@@ -871,7 +873,7 @@ route[DOMAIN_POLICY]
|
|
|
# destination (a@A calls b@B who forwards to c@C. A BYE by c@C is
|
|
|
# then From b@B and To a@A. There is no mentioning of c@C despite
|
|
|
# legitimate behaviour of c@C).
|
|
|
- if (!isflagset(FLAG_TOTAG) && !$t.did && !$f.did) {
|
|
|
+ if (!isflagset(FLAG_TOTAG) && strempty($t.did) && strempty($f.did)) {
|
|
|
sl_reply("403", "Relaying Forbidden");
|
|
|
drop;
|
|
|
}
|
|
@@ -926,7 +928,7 @@ route[REGISTRAR]
|
|
|
}
|
|
|
|
|
|
# Check if the REGISTER if for one of our local domains.
|
|
|
- if (!$t.did) {
|
|
|
+ if (strempty($t.did)) {
|
|
|
sl_reply("403", "Register Forwarding Forbidden");
|
|
|
drop;
|
|
|
}
|
|
@@ -951,7 +953,7 @@ route[REGISTRAR]
|
|
|
sl_reply("400", "Bad Request");
|
|
|
}
|
|
|
else {
|
|
|
- if ($digest_challenge) {
|
|
|
+ if ($digest_challenge != "") {
|
|
|
append_to_reply("%$digest_challenge");
|
|
|
}
|
|
|
sl_reply("401", "Unauthorized");
|
|
@@ -1034,7 +1036,7 @@ route[AUTHENTICATION]
|
|
|
|
|
|
# Requests from non-local to local domains should be permitted.
|
|
|
# Remove this if you want a walled garden.
|
|
|
- if (!$f.did) {
|
|
|
+ if (strempty($f.did)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -1086,7 +1088,7 @@ route[OUTBOUND]
|
|
|
# If a local user calls to a foreign domain we play outbound
|
|
|
# proxy for them.
|
|
|
# Comment this out if you want a walled garden.
|
|
|
- if ($f.did && !$t.did) {
|
|
|
+ if ($f.did != "" && strempty($t.did)) {
|
|
|
append_hf("P-hint: outbound\r\n");
|
|
|
route(FORWARD);
|
|
|
}
|
|
@@ -1099,7 +1101,7 @@ route[SPEEDDIAL]
|
|
|
{
|
|
|
# If the caller is local and uses two digits only, we redirect the
|
|
|
# UA to the real target.
|
|
|
- if ($fd.did && uri =~ "sip:[0-9][0-9]@") {
|
|
|
+ if ($fd.did != "" && uri =~ "sip:[0-9][0-9]@") {
|
|
|
if (sd_lookup("speed_dial")) {
|
|
|
sl_reply("302", "Speed Dial Redirect");
|
|
|
}
|
|
@@ -1133,7 +1135,7 @@ route[INBOUND]
|
|
|
# Check for call forwarding of the callee.
|
|
|
# Note: The forwarding target has to be full routable URI
|
|
|
# in this example.
|
|
|
- if ($tu.fwd_always_target) {
|
|
|
+ if ($tu.fwd_always_target != "") {
|
|
|
attr2uri("$tu.fwd_always_target");
|
|
|
|
|
|
# If we are forwarding to ourselves, don't remove
|
|
@@ -1143,7 +1145,7 @@ route[INBOUND]
|
|
|
# still be problematic -- credentials are already
|
|
|
# removed when we forward. Consider using a 3xx.
|
|
|
lookup_domain("$td", "@ruri.host");
|
|
|
- if ($t.did) {
|
|
|
+ if ($t.did != "") {
|
|
|
setflag(FLAG_DONT_RM_CRED);
|
|
|
}
|
|
|
route(FORWARD);
|
|
@@ -1193,13 +1195,13 @@ route[PSTN]
|
|
|
{
|
|
|
# Check some conditions first:
|
|
|
# PSTN is available for our own users only.
|
|
|
- if (!$f.did) {
|
|
|
+ if (strempty($f.did)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
# If the attribute $gw_ip isn't set, there is no PSTN service
|
|
|
# active.
|
|
|
- if (!$gw_ip) {
|
|
|
+ if (!defined $gw_ip) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -1213,8 +1215,8 @@ route[PSTN]
|
|
|
# format that is accepted by your gateway here.
|
|
|
|
|
|
# Check permissions of the caller for initial INVITEs.
|
|
|
- if (method == "INVITE" && [email protected]) {
|
|
|
- if (!$f.gw_acl == "1") {
|
|
|
+ if (method == "INVITE" && strempty(@to.tag)) {
|
|
|
+ if ($f.gw_acl != "1") {
|
|
|
sl_reply("403", "PSTN Not Permitted");
|
|
|
drop;
|
|
|
}
|
|
@@ -1224,7 +1226,7 @@ route[PSTN]
|
|
|
# Remote-Party-ID header.
|
|
|
# Depending on your gateway, you may have to add a
|
|
|
# P-Asserted-Identity header here instead.
|
|
|
- if ($asserted_id) {
|
|
|
+ if (defined $asserted_id) {
|
|
|
xlset_attr("$rpidheader",
|
|
|
"<sip:%$asserted_id@%@ruri.host>;screen=yes");
|
|
|
replace_attr_hf("Remote-Party-ID", "$rpidheader");
|
|
@@ -1267,7 +1269,7 @@ route[CATCH_CANCEL]
|
|
|
route[SITE_SPECIFIC]
|
|
|
{
|
|
|
# This is only relevant for requests for one of our domains.
|
|
|
- if (!$t.did) {
|
|
|
+ if (strempty($t.did)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -1291,7 +1293,7 @@ route[SESSION_TIMER]
|
|
|
}
|
|
|
|
|
|
# Let's check if the Session-Expires header is already present.
|
|
|
- if (@hf_value.session_expires) {
|
|
|
+ if (@hf_value.session_expires != "") {
|
|
|
# Compare the Session-Expires header value with the
|
|
|
# configured Min-SE.
|
|
|
eval_push("x:%@hf_value.session_expires.uri");
|
|
@@ -1377,7 +1379,7 @@ failure_route[FAILURE_ROUTE]
|
|
|
# credentials (if we consumed them, they may be missing in
|
|
|
# a loop, if we don't consume them, messages are bigger and
|
|
|
# more vulnerable)
|
|
|
- if ($tu.fwd_busy_target) {
|
|
|
+ if ($tu.fwd_busy_target != "") {
|
|
|
#attr2uri("$tu.fwd_busy_target");
|
|
|
#route(FORWARD);
|
|
|
attr_destination("$tu.fwd_busy_target");
|
|
@@ -1390,7 +1392,7 @@ failure_route[FAILURE_ROUTE]
|
|
|
# If we received no answer and the noanswer target is set,
|
|
|
# forward it there.
|
|
|
# Note: See above.
|
|
|
- if ($tu.fwd_noanswer_target) {
|
|
|
+ if ($tu.fwd_noanswer_target != "") {
|
|
|
#attr2uri("$tu.fwd_noanswer_target");
|
|
|
#route(FORWARD);
|
|
|
attr_destination("$tu.fwd_noanswer_target");
|
|
@@ -1409,7 +1411,7 @@ onreply_route[REPLY_ROUTE]
|
|
|
# Do the same if the contact is maddred. See the notes in route
|
|
|
# [NAT_DETECTION] for more information.
|
|
|
if (nat_uac_test("1") ||
|
|
|
- (@hf_value["contact"] && @contact.uri.params.maddr))
|
|
|
+ (@hf_value["contact"] != "" && @contact.uri.params.maddr != ""))
|
|
|
{
|
|
|
fix_nated_contact();
|
|
|
}
|
|
@@ -1418,7 +1420,7 @@ onreply_route[REPLY_ROUTE]
|
|
|
# body, inform RTP proxy.
|
|
|
if (isflagset(FLAG_RTP_PROXY)
|
|
|
&& status=~"(18[03])|(2[0-9][0-9])"
|
|
|
- && @msg.body)
|
|
|
+ && @msg.body != "")
|
|
|
{
|
|
|
force_rtp_proxy('r');
|
|
|
}
|
|
@@ -1426,7 +1428,7 @@ onreply_route[REPLY_ROUTE]
|
|
|
# Let's check for session timer support.
|
|
|
if (isflagset(FLAG_SESSIONTIMER) && status =~ "2[0-9][0-9]") {
|
|
|
# The UAC wanted to have a session timer.
|
|
|
- if (!@hf_value.session_expires) {
|
|
|
+ if (strempty(@hf_value.session_expires)) {
|
|
|
# But the UAS does not support it, so we will try
|
|
|
# to convince the UAC to do it.
|
|
|
append_hf_value("Session-Expires",
|