Browse code

kamailio.cfg: more coherent use of curly braces for blocks

- 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

Daniel-Constantin Mierla authored on 18/02/2016 14:27:05
Showing 1 changed files
... ...
@@ -489,8 +489,9 @@ request_route {
489 489
 	# record routing for dialog forming requests (in case they are routed)
490 490
 	# - remove preloaded route headers
491 491
 	remove_hf("Route");
492
-	if (is_method("INVITE|SUBSCRIBE"))
492
+	if (is_method("INVITE|SUBSCRIBE")) {
493 493
 		record_route();
494
+	}
494 495
 
495 496
 	# account only INVITEs
496 497
 	if (is_method("INVITE")) {
... ...
@@ -594,12 +595,10 @@ route[WITHINDLG] {
594 594
 		if (is_method("BYE")) {
595 595
 			setflag(FLT_ACC); # do accounting ...
596 596
 			setflag(FLT_ACCFAILED); # ... even if the transaction fails
597
-		}
598
-		else if ( is_method("ACK") ) {
597
+		} else if ( is_method("ACK") ) {
599 598
 			# ACK is forwarded statelessy
600 599
 			route(NATMANAGE);
601
-		}
602
-		else if ( is_method("NOTIFY") ) {
600
+		} else if ( is_method("NOTIFY") ) {
603 601
 			# Add Record-Route for in-dialog NOTIFY as per RFC 6665.
604 602
 			record_route();
605 603
 		}
... ...
@@ -639,8 +638,9 @@ route[REGISTRAR] {
639 639
 		setbflag(FLB_NATSIPPING);
640 640
 #!endif
641 641
 	}
642
-	if (!save("location"))
642
+	if (!save("location")) {
643 643
 		sl_reply_error();
644
+	}
644 645
 	exit;
645 646
 }
646 647
 
... ...
@@ -649,15 +649,18 @@ route[LOCATION] {
649 649
 
650 650
 #!ifdef WITH_SPEEDDIAL
651 651
 	# search for short dialing - 2-digit extension
652
-	if($rU=~"^[0-9][0-9]$")
653
-		if(sd_lookup("speed_dial"))
652
+	if($rU=~"^[0-9][0-9]$") {
653
+		if(sd_lookup("speed_dial")) {
654 654
 			route(SIPOUT);
655
+		}
656
+	}
655 657
 #!endif
656 658
 
657 659
 #!ifdef WITH_ALIASDB
658 660
 	# search in DB-based aliases
659
-	if(alias_db_lookup("dbaliases"))
661
+	if(alias_db_lookup("dbaliases")) {
660 662
 		route(SIPOUT);
663
+	}
661 664
 #!endif
662 665
 
663 666
 	$avp(oexten) = $rU;
... ...
@@ -687,8 +690,7 @@ route[LOCATION] {
687 687
 
688 688
 # Presence server processing
689 689
 route[PRESENCE] {
690
-	if(!is_method("PUBLISH|SUBSCRIBE"))
691
-		return;
690
+	if(!is_method("PUBLISH|SUBSCRIBE")) return;
692 691
 
693 692
 	if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
694 693
 		route(TOVOICEMAIL);
... ...
@@ -732,8 +734,7 @@ route[AUTH] {
732 732
 	}
733 733
 #!endif
734 734
 
735
-	if (is_method("REGISTER") || from_uri==myself)
736
-	{
735
+	if (is_method("REGISTER") || from_uri==myself) {
737 736
 		# authenticate requests
738 737
 		if (!auth_check("$fd", "subscriber", "1")) {
739 738
 			auth_challenge("$fd", "0");
... ...
@@ -762,8 +763,9 @@ route[NATDETECT] {
762 762
 		if (is_method("REGISTER")) {
763 763
 			fix_nated_register();
764 764
 		} else {
765
-			if(is_first_hop())
765
+			if(is_first_hop()) {
766 766
 				set_contact_alias();
767
+			}
767 768
 		}
768 769
 		setflag(FLT_NATS);
769 770
 	}
... ...
@@ -781,8 +783,7 @@ route[NATMANAGE] {
781 781
 			}
782 782
 		}
783 783
 	}
784
-	if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
785
-		return;
784
+	if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) return;
786 785
 
787 786
 	if(nat_uac_test("8")) {
788 787
 		rtpproxy_manage("co");
... ...
@@ -838,8 +839,7 @@ route[PSTN] {
838 838
 	# route to PSTN dialed numbers starting with '+' or '00'
839 839
 	#     (international format)
840 840
 	# - update the condition to match your dialing rules for PSTN routing
841
-	if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
842
-		return;
841
+	if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")) return;
843 842
 
844 843
 	# only local users allowed to call
845 844
 	if(from_uri!=myself) {
... ...
@@ -883,8 +883,7 @@ route[XMLRPC] {
883 883
 # Routing to voicemail server
884 884
 route[TOVOICEMAIL] {
885 885
 #!ifdef WITH_VOICEMAIL
886
-	if(!is_method("INVITE|SUBSCRIBE"))
887
-		return;
886
+	if(!is_method("INVITE|SUBSCRIBE")) return;
888 887
 
889 888
 	# check if VoiceMail server IP is defined
890 889
 	if (strempty($sel(cfg_get.voicemail.srv_ip))) {
... ...
@@ -892,13 +891,13 @@ route[TOVOICEMAIL] {
892 892
 		return;
893 893
 	}
894 894
 	if(is_method("INVITE")) {
895
-		if($avp(oexten)==$null)
896
-			return;
895
+		if($avp(oexten)==$null) return;
896
+
897 897
 		$ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
898 898
 				+ ":" + $sel(cfg_get.voicemail.srv_port);
899 899
 	} else {
900
-		if($rU==$null)
901
-			return;
900
+		if($rU==$null) return;
901
+
902 902
 		$ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip)
903 903
 				+ ":" + $sel(cfg_get.voicemail.srv_port);
904 904
 	}
... ...
@@ -918,17 +917,16 @@ branch_route[MANAGE_BRANCH] {
918 918
 # Manage incoming replies
919 919
 onreply_route[MANAGE_REPLY] {
920 920
 	xdbg("incoming reply\n");
921
-	if(status=~"[12][0-9][0-9]")
921
+	if(status=~"[12][0-9][0-9]") {
922 922
 		route(NATMANAGE);
923
+	}
923 924
 }
924 925
 
925 926
 # Manage failure routing cases
926 927
 failure_route[MANAGE_FAILURE] {
927 928
 	route(NATMANAGE);
928 929
 
929
-	if (t_is_canceled()) {
930
-		exit;
931
-	}
930
+	if (t_is_canceled()) exit;
932 931
 
933 932
 #!ifdef WITH_BLOCK3XX
934 933
 	# block call redirect based on 3xx replies.