kamailio.cfg: more coherent use of curly braces for blocks
authorDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 18 Feb 2016 14:27:05 +0000 (15:27 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 18 Feb 2016 14:28:54 +0000 (15:28 +0100)
- use them always when execution actions in if-else blocks that are not
  return-exit-drop
- single line blocks with return-exit-drop made single line with the if
  statement

etc/kamailio.cfg

index cd7dd27..86ac524 100644 (file)
@@ -489,8 +489,9 @@ request_route {
        # record routing for dialog forming requests (in case they are routed)
        # - remove preloaded route headers
        remove_hf("Route");
-       if (is_method("INVITE|SUBSCRIBE"))
+       if (is_method("INVITE|SUBSCRIBE")) {
                record_route();
+       }
 
        # account only INVITEs
        if (is_method("INVITE")) {
@@ -594,12 +595,10 @@ route[WITHINDLG] {
                if (is_method("BYE")) {
                        setflag(FLT_ACC); # do accounting ...
                        setflag(FLT_ACCFAILED); # ... even if the transaction fails
-               }
-               else if ( is_method("ACK") ) {
+               } else if ( is_method("ACK") ) {
                        # ACK is forwarded statelessy
                        route(NATMANAGE);
-               }
-               else if ( is_method("NOTIFY") ) {
+               } else if ( is_method("NOTIFY") ) {
                        # Add Record-Route for in-dialog NOTIFY as per RFC 6665.
                        record_route();
                }
@@ -639,8 +638,9 @@ route[REGISTRAR] {
                setbflag(FLB_NATSIPPING);
 #!endif
        }
-       if (!save("location"))
+       if (!save("location")) {
                sl_reply_error();
+       }
        exit;
 }
 
@@ -649,15 +649,18 @@ route[LOCATION] {
 
 #!ifdef WITH_SPEEDDIAL
        # search for short dialing - 2-digit extension
-       if($rU=~"^[0-9][0-9]$")
-               if(sd_lookup("speed_dial"))
+       if($rU=~"^[0-9][0-9]$") {
+               if(sd_lookup("speed_dial")) {
                        route(SIPOUT);
+               }
+       }
 #!endif
 
 #!ifdef WITH_ALIASDB
        # search in DB-based aliases
-       if(alias_db_lookup("dbaliases"))
+       if(alias_db_lookup("dbaliases")) {
                route(SIPOUT);
+       }
 #!endif
 
        $avp(oexten) = $rU;
@@ -687,8 +690,7 @@ route[LOCATION] {
 
 # Presence server processing
 route[PRESENCE] {
-       if(!is_method("PUBLISH|SUBSCRIBE"))
-               return;
+       if(!is_method("PUBLISH|SUBSCRIBE")) return;
 
        if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
                route(TOVOICEMAIL);
@@ -732,8 +734,7 @@ route[AUTH] {
        }
 #!endif
 
-       if (is_method("REGISTER") || from_uri==myself)
-       {
+       if (is_method("REGISTER") || from_uri==myself) {
                # authenticate requests
                if (!auth_check("$fd", "subscriber", "1")) {
                        auth_challenge("$fd", "0");
@@ -762,8 +763,9 @@ route[NATDETECT] {
                if (is_method("REGISTER")) {
                        fix_nated_register();
                } else {
-                       if(is_first_hop())
+                       if(is_first_hop()) {
                                set_contact_alias();
+                       }
                }
                setflag(FLT_NATS);
        }
@@ -781,8 +783,7 @@ route[NATMANAGE] {
                        }
                }
        }
-       if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
-               return;
+       if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
 
        if(nat_uac_test("8")) {
                rtpproxy_manage("co");
@@ -838,8 +839,7 @@ route[PSTN] {
        # route to PSTN dialed numbers starting with '+' or '00'
        #     (international format)
        # - update the condition to match your dialing rules for PSTN routing
-       if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
-               return;
+       if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")) return;
 
        # only local users allowed to call
        if(from_uri!=myself) {
@@ -883,8 +883,7 @@ route[XMLRPC] {
 # Routing to voicemail server
 route[TOVOICEMAIL] {
 #!ifdef WITH_VOICEMAIL
-       if(!is_method("INVITE|SUBSCRIBE"))
-               return;
+       if(!is_method("INVITE|SUBSCRIBE")) return;
 
        # check if VoiceMail server IP is defined
        if (strempty($sel(cfg_get.voicemail.srv_ip))) {
@@ -892,13 +891,13 @@ route[TOVOICEMAIL] {
                return;
        }
        if(is_method("INVITE")) {
-               if($avp(oexten)==$null)
-                       return;
+               if($avp(oexten)==$null) return;
+
                $ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
                                + ":" + $sel(cfg_get.voicemail.srv_port);
        } else {
-               if($rU==$null)
-                       return;
+               if($rU==$null) return;
+
                $ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip)
                                + ":" + $sel(cfg_get.voicemail.srv_port);
        }
@@ -918,17 +917,16 @@ branch_route[MANAGE_BRANCH] {
 # Manage incoming replies
 onreply_route[MANAGE_REPLY] {
        xdbg("incoming reply\n");
-       if(status=~"[12][0-9][0-9]")
+       if(status=~"[12][0-9][0-9]") {
                route(NATMANAGE);
+       }
 }
 
 # Manage failure routing cases
 failure_route[MANAGE_FAILURE] {
        route(NATMANAGE);
 
-       if (t_is_canceled()) {
-               exit;
-       }
+       if (t_is_canceled()) exit;
 
 #!ifdef WITH_BLOCK3XX
        # block call redirect based on 3xx replies.