Browse code

test/unit: updates to unit tests 10..19

Daniel-Constantin Mierla authored on 03/10/2014 20:25:48
Showing 14 changed files
... ...
@@ -26,8 +26,8 @@ cd $CTL_DIR
26 26
 # setup config file
27 27
 cp $CTLRC $CTLRC.bak
28 28
 cp $CTL $CTL.bak
29
-sed -i "s/# DBENGINE=MYSQL/DBENGINE=DBTEXT/g" $CTLRC
30
-sed -i "s/TEST=\"false\"/TEST=\"true\"/g" $CTL
29
+sed -i'' -e "s/# DBENGINE=MYSQL/DBENGINE=DBTEXT/g" $CTLRC
30
+sed -i'' -e "s/TEST=\"false\"/TEST=\"true\"/g" $CTL
31 31
 
32 32
 ./$CTL avp list > /dev/null
33 33
 
... ...
@@ -39,7 +39,7 @@ if [ "$ret" -eq 0 ] ; then
39 39
 fi ;
40 40
 
41 41
 if [ "$ret" -eq 0 ] ; then
42
-	./$CTL lcr show > /dev/null
42
+	./$CTL dispatcher show > /dev/null
43 43
 	ret=$?
44 44
 fi ;
45 45
 
... ...
@@ -47,4 +47,4 @@ fi ;
47 47
 mv $CTLRC.bak $CTLRC
48 48
 mv $CTL.bak $CTL
49 49
 
50
-exit $ret
51 50
\ No newline at end of file
51
+exit $ret
... ...
@@ -5,8 +5,11 @@ log_stderror=no
5 5
 children=1
6 6
 disable_tcp=yes
7 7
 
8
+alias=localhost
9
+
8 10
 # ------------------ module loading ----------------------------------
9
-loadpath "../../modules/:../../modules_k/"
11
+loadpath "../../modules/"
12
+loadmodule "db_mysql"
10 13
 loadmodule "tm"
11 14
 loadmodule "sl"
12 15
 loadmodule "rr"
... ...
@@ -22,21 +25,16 @@ modparam("usrloc", "db_mode", 1)
22 25
 
23 26
 loadmodule "registrar"
24 27
 modparam("registrar", "min_expires", 5)
25
-modparam("usrloc", "timer_interval", 2)
28
+modparam("usrloc", "timer_interval", 1)
26 29
 
27 30
 #-------------------------  request routing logic -------------------
28
-route{
31
+request_route {
29 32
 
30 33
 	if (!mf_process_maxfwd_header("10")) {
31 34
 		sl_send_reply("483","Too Many Hops");
32 35
 		exit;
33 36
 	}
34 37
 
35
-	if (msg:len >=  2048 ) {
36
-		sl_send_reply("513", "Message Too Large");
37
-		exit;
38
-	}
39
-
40 38
 	if (!method=="REGISTER")
41 39
 		record_route();
42 40
 
... ...
@@ -29,22 +29,22 @@ if ! (check_sipsak && check_kamailio && check_module "db_mysql" && check_mysql);
29 29
 	exit 0
30 30
 fi ;
31 31
 
32
-cp $CFG $CFG.bak
32
+SIPDOMAIN=127.0.0.1
33 33
 
34
-echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG
34
+cp $CFG $CFG.bak
35 35
 
36
-$BIN -w . -f $CFG > /dev/null
36
+$BIN -w . -f $CFG -a no > /dev/null
37 37
 ret=$?
38 38
 
39 39
 sleep 1
40 40
 
41 41
 # register two contacts
42
-sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
43
-sipsak -U -C sip:foobar1@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
42
+sipsak -U -C sip:foobar@127.0.0.1 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN > /dev/null 2>&1
43
+sipsak -U -C sip:foobar1@127.0.0.1 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN > /dev/null 2>&1
44 44
 ret=$?
45 45
 
46 46
 if [ "$ret" -eq 0 ]; then
47
-	$CTL ul show | grep "AOR:: 49721123456789" &> /dev/null
47
+	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
48 48
 	ret=$?
49 49
 fi;
50 50
 
... ...
@@ -57,53 +57,55 @@ fi;
57 57
 
58 58
 if [ "$ret" -eq 0 ]; then
59 59
 	# check if the contact is registered
60
-	sipsak -U -C empty -s sip:49721123456789@127.0.0.1 -H localhost -q "Contact: <sip:foobar@localhost>" &> /dev/null
60
+	sipsak -U -C empty -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -q "Contact: <sip:foobar@127.0.0.1>" > /dev/null 2>&1
61 61
 	ret=$?
62 62
 fi;
63 63
 
64 64
 if [ "$ret" -eq 0 ]; then
65 65
 	# update the registration
66
-	sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
66
+	sipsak -U -C sip:foobar@127.0.0.1 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN > /dev/null 2>&1
67 67
 	ret=$?
68 68
 fi;
69 69
 
70 70
 if [ "$ret" -eq 0 ]; then
71 71
 	# check if we get a hint when we try to unregister a non-existent conctact
72
-	sipsak -U -C "sip:foobar2@localhost" -s sip:49721123456789@127.0.0.1 -H localhost -x 0 -q "Contact: <sip:foobar@localhost>" &> /dev/null
72
+	sipsak -U -C "sip:foobar2@127.0.0.1" -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -x 0 -q "Contact: <sip:foobar@127.0.0.1>" > /dev/null 2>&1
73 73
 	ret=$?
74 74
 fi;
75 75
 
76 76
 if [ "$ret" -eq 0 ]; then
77 77
 	# unregister the contact
78
-	sipsak -U -C "sip:foobar@localhost" -s sip:49721123456789@127.0.0.1 -H localhost -x 0 &> /dev/null
78
+	sipsak -U -C "sip:foobar@127.0.0.1" -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -x 0 > /dev/null 2>&1
79 79
 	ret=$?
80 80
 fi;
81 81
 
82 82
 if [ "$ret" -eq 0 ]; then
83 83
 	# unregister the user again should not fail
84
-	sipsak -U -C "sip:foobar@localhost" -s sip:49721123456789@127.0.0.1 -H localhost -x 0 &> /dev/null
84
+	sipsak -U -C "sip:foobar@127.0.0.1" -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -x 0 > /dev/null 2>&1
85 85
 	ret=$?
86 86
 fi;
87 87
 
88 88
 if [ "$ret" -eq 0 ]; then
89 89
 	# check if the other contact is still registered
90
-	sipsak -U -C empty -s sip:49721123456789@127.0.0.1 -H localhost -q "Contact: <sip:foobar1@localhost>" &> /dev/null
90
+	sipsak -U -C empty -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -q "Contact: <sip:foobar1@127.0.0.1>" > /dev/null 2>&1
91 91
 	ret=$?
92 92
 fi;
93 93
 
94 94
 if [ "$ret" -eq 0 ]; then
95 95
 	# register the other again
96
-	sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
96
+	sipsak -U -C sip:foobar@127.0.0.1 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN > /dev/null 2>&1
97 97
 	ret=$?
98 98
 fi;
99 99
 
100 100
 if [ "$ret" -eq 0 ]; then
101 101
 	# unregister all contacts
102
-	sipsak -U -C "*" -s sip:49721123456789@127.0.0.1 -H localhost -x 0 &> /dev/null
102
+	sipsak -U -C "*" -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -x 0 > /dev/null 2>&1
103 103
 	ret=$?
104 104
 fi;
105 105
 
106 106
 if [ "$ret" -eq 0 ]; then
107
+	# let the timer cleanup the previous registrations
108
+	sleep 2
107 109
 	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
108 110
 	ret=$?
109 111
 	if [ "$ret" -eq 0 ]; then
... ...
@@ -119,20 +121,20 @@ fi;
119 121
 
120 122
 if [ "$ret" -eq 0 ]; then
121 123
 	# test min_expires functionality
122
-	sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost -x 2 &> /dev/null
124
+	sipsak -U -C sip:foobar@127.0.0.1 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -x 2 > /dev/null 2>&1
123 125
 	ret=$?
124 126
 fi;
125 127
 
126 128
 if [ "$ret" -eq 0 ]; then
127 129
 	sleep 3
128 130
 	# check if the contact is still registered
129
-	sipsak -U -C empty -s sip:49721123456789@127.0.0.1 -H localhost -q "Contact: <sip:foobar@localhost>" &> /dev/null
131
+	sipsak -U -C empty -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -q "Contact: <sip:foobar@127.0.0.1>" > /dev/null 2>&1
130 132
 	ret=$?
131 133
 fi;
132 134
 
133 135
 if [ "$ret" -eq 0 ]; then
134 136
 	# register a few more contacts
135
-	sipsak -U -e 9 -s sip:49721123456789@localhost -H localhost &> /dev/null
137
+	sipsak -U -e 9 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN > /dev/null 2>&1
136 138
 fi;
137 139
 
138 140
 if [ "$ret" -eq 0 ]; then
... ...
@@ -151,27 +153,27 @@ $MYSQL "delete from location where username like '49721123456789%';"
151 153
 
152 154
 if [ "$ret" -eq 0 ]; then
153 155
 	# register again
154
-	sipsak -U -C sip:foobar@localhost -s sip:49721123456789@localhost -H localhost &> /dev/null
156
+	sipsak -U -C sip:foobar@127.0.0.1 -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN > /dev/null 2>&1
155 157
 	ret=$?
156 158
 fi;
157 159
 
158 160
 $KILL
159 161
 
160 162
 # restart to test preload_udomain functionality
161
-$BIN -w . -f $CFG > /dev/null
163
+$BIN -w . -f $CFG -a no> /dev/null
162 164
 ret=$?
163 165
 
164 166
 sleep 1
165 167
 
166 168
 if [ "$ret" -eq 0 ]; then
167 169
 	# check if the contact is still registered
168
-	sipsak -U -C empty -s sip:49721123456789@127.0.0.1 -H localhost -q "Contact: <sip:foobar@localhost>" &> /dev/null
170
+	sipsak -U -C empty -s sip:49721123456789@$SIPDOMAIN -H $SIPDOMAIN -q "Contact: <sip:foobar@127.0.0.1>" > /dev/null 2>&1
169 171
 	ret=$?
170 172
 fi;
171 173
 
172 174
 # check if the methods value is correct
173 175
 if [ "$ret" -eq 0 ]; then
174
-	$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
176
+	$CTL ul show | grep "Methods:: 4294967295" > /dev/null
175 177
 	ret=$?
176 178
 fi;
177 179
 
... ...
@@ -182,4 +184,4 @@ $KILL
182 184
 
183 185
 mv $CFG.bak $CFG
184 186
 
185
-exit $ret
186 187
\ No newline at end of file
188
+exit $ret
... ...
@@ -1,6 +1,6 @@
1 1
 log_stderror=yes
2 2
 listen=127.0.0.1
3
-loadpath "../../modules/:../../modules_k/"
3
+loadpath "../../modules/"
4 4
 loadmodule "../../modules/db_mysql/db_mysql.so"
5 5
 loadmodule "../../modules/tm/tm.so"
6 6
 loadmodule "sl"
... ...
@@ -14,7 +14,7 @@ loadmodule "pv"
14 14
 loadmodule "mi_fifo"
15 15
 modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
16 16
 
17
-route{
17
+request_route {
18 18
 	xlog("received by kamailio[$pp] at '$Tf' from $si:$sp, method: $(rm{s.tolower}), transport: $rP:$Ri:$rp, user agent: $ua\n");
19 19
 
20 20
 	if !(route(39)) {
... ...
@@ -32,12 +32,12 @@ route{
32 32
 		# mark routing logic in request
33 33
 		append_hf("P-hint: rr-enforced\r\n");
34 34
 		route(1);
35
-	};
35
+	}
36 36
 
37 37
 	if (!uri==myself) {
38 38
 		append_hf("P-hint: outbound\r\n");
39 39
 		route(1);
40
-	};
40
+	}
41 41
 	xlog("From header tag: $(hdr(From){param.value,tag})\n");
42 42
 	
43 43
 	if(is_method("REGISTER")) {
... ...
@@ -63,8 +63,8 @@ route{
63 63
 
64 64
 	if (uri==myself) {
65 65
 		if (method=="REGISTER") {
66
-		save("location");
67
-		exit;
66
+			save("location");
67
+			exit;
68 68
 		}
69 69
 		if (!lookup("location")) {
70 70
 			sl_send_reply("404", "Not Found");
... ...
@@ -1,7 +1,9 @@
1 1
 debug=2
2
-loadpath "../../modules/:../../modules_k/"
3
-loadmodule "sl"
2
+loadpath "../../modules/"
3
+loadmodule "db_mysql"
4
+loadmodule "corex"
4 5
 loadmodule "tm"
6
+loadmodule "sl"
5 7
 loadmodule "xlog"
6 8
 loadmodule "maxfwd"
7 9
 loadmodule "carrierroute"
... ...
@@ -9,9 +11,11 @@ loadmodule "pv"
9 11
 loadmodule "tmx"
10 12
 loadmodule "mi_fifo"
11 13
 
14
+modparam("carrierroute", "config_source", "db")
15
+
12 16
 modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
13 17
 
14
-route{
18
+request_route {
15 19
 	# initial sanity checks
16 20
 	if (!mf_process_maxfwd_header("10")) {
17 21
 		sl_send_reply("483","Too Many Hops");
... ...
@@ -24,17 +28,17 @@ route{
24 28
 		exit;
25 29
 	}
26 30
 	t_on_failure("1");
27
-		if (!t_relay()) {
31
+	if (!t_relay()) {
28 32
 		sl_reply_error();
29
-	};
33
+	}
30 34
 }
31 35
 
32 36
 failure_route[1] {
33 37
 	revert_uri();
34
-		if (!cr_next_domain("$avp(s:11)", "$avp(s:10)", "$rU", "$avp(s:12)", "$T_reply_code", "$avp(s:10)")) {
35
-			xlog("L_ERR", "cr_next_domain failed\n");
36
-			exit;
37
-		}
38
+	if (!cr_next_domain("$avp(s:11)", "$avp(s:10)", "$rU", "$avp(s:12)", "$T_reply_code", "$avp(s:10)")) {
39
+		xlog("L_ERR", "cr_next_domain failed\n");
40
+		exit;
41
+	}
38 42
 	if (!cr_route("$avp(s:11)", "$avp(s:10)", "$rU", "$rU", "call_id", "$avp(s:12)")) {
39 43
 		xlog("L_ERR", "cr_route failed\n");
40 44
 		exit;
... ...
@@ -44,5 +48,5 @@ failure_route[1] {
44 48
 	if (!t_relay()) {
45 49
 		xlog("L_ERR", "t_relay failed\n");
46 50
 		exit;
47
-	};
51
+	}
48 52
 }
... ...
@@ -31,10 +31,6 @@ fi ;
31 31
 
32 32
 cp $CFG $CFG.bak
33 33
 
34
-# setup config
35
-echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG
36
-echo "modparam(\"carrierroute\", \"config_source\", \"db\")" >> $CFG
37
-
38 34
 # setup database
39 35
 $MYSQL "insert into carrier_name (id, carrier) values ('1', 'carrier1');"
40 36
 $MYSQL "insert into carrier_name (id, carrier) values ('2', 'default');"
... ...
@@ -65,7 +61,7 @@ mask, next_domain) values ('3', '2', '1', '49', 'host1.local', '503', '0', '0',
65 61
 $MYSQL "insert into carrierfailureroute(id, carrier, domain, scan_prefix, host_name, reply_code, flags,
66 62
 mask, next_domain) values ('4', '2', '2', '49', 'host1.local', '5..', '0', '0', '3');"
67 63
 
68
-$BIN -w . -f $CFG > /dev/null
64
+$BIN -w . -f $CFG -a no > /dev/null
69 65
 
70 66
 ret=$?
71 67
 
... ...
@@ -75,6 +71,7 @@ TMPFILE=`mktemp -t kamailio-test.XXXXXXXXXX`
75 71
 
76 72
 if [ "$ret" -eq 0 ] ; then
77 73
 	$CTL fifo cr_dump_routes > $TMPFILE
74
+	# cat $TMPFILE
78 75
 	ret=$?
79 76
 fi ;
80 77
 
... ...
@@ -86,14 +83,16 @@ Printing tree for domain 'domain2' (1)
86 83
 Printing tree for domain 'domain3' (2)
87 84
       NULL: 100.000 %, 'host5.local': ON, '0', '', '', ''
88 85
 Printing tree for domain 'domain1' (10)
89
-        42: 70.140 %, 'host4.local': ON, '0', '', '', ''
90
-        42: 30.060 %, 'host3.local': ON, '0', '', '', ''
86
+        42: 70.000 %, 'host4.local': ON, '0', '', '', ''
87
+        42: 30.000 %, 'host3.local': ON, '0', '', '', ''
91 88
         49: 50.000 %, 'host2.local': ON, '0', '', '', ''
92 89
         49: 50.000 %, 'host1.local': ON, '0', '', '', ''
93 90
       NULL: 100.000 %, 'host5.local': ON, '0', '', '', ''
94 91
 Printing tree for carrier 'default' (2)
95 92
 Printing tree for domain 'domain2' (1)
96 93
       NULL: 100.000 %, 'host6.local': ON, '0', '', '', ''
94
+Printing tree for domain 'domain3' (2)
95
+      NULL: 100.000 %, 'host6.local': ON, '0', '', '', ''
97 96
 Printing tree for domain 'domain1' (10)
98 97
       NULL: 100.000 %, 'host6.local': ON, '0', '', '', ''
99 98
 Printing tree for carrier 'carrier2' (3)
... ...
@@ -1,4 +1,4 @@
1
-loadpath "../../modules/:../../modules_k/"
1
+loadpath "../../modules/"
2 2
 loadmodule "sl"
3 3
 loadmodule "xlog"
4 4
 loadmodule "maxfwd"
... ...
@@ -8,7 +8,9 @@ loadmodule "mi_fifo"
8 8
 
9 9
 modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
10 10
 
11
-route{
11
+modparam("carrierroute", "config_file", "carrierroute.cfg")
12
+
13
+request_route {
12 14
 	# initial sanity checks
13 15
 	if (!mf_process_maxfwd_header("10")) {
14 16
 		sl_send_reply("483","Too Many Hops");
... ...
@@ -30,10 +30,7 @@ fi ;
30 30
 
31 31
 cp $CFG $CFG.bak
32 32
 
33
-# setup config
34
-echo "modparam(\"carrierroute\", \"config_file\", \"carrierroute.cfg\")" >> $CFG
35
-
36
-$BIN -w . -f $CFG > /dev/null
33
+$BIN -w . -f $CFG -a no > /dev/null
37 34
 ret=$?
38 35
 
39 36
 sleep 1
... ...
@@ -79,4 +76,4 @@ $KILL
79 76
 mv $CFG.bak $CFG
80 77
 rm -f $TMPFILE
81 78
 
82
-exit $ret
83 79
\ No newline at end of file
80
+exit $ret
... ...
@@ -28,11 +28,12 @@ if ! (check_kamailio); then
28 28
 	exit 0
29 29
 fi ;
30 30
 
31
-echo "loadmodule \"../../modules/db_text/db_text.so\"" >> $CFG
31
+echo "loadmodule \"../../modules/db_text/db_text.so\"" > $CFG
32 32
 cat 2.cfg >> $CFG
33 33
 echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"text://`pwd`/../../utils/kamctl/dbtext/kamailio\")" >> $CFG
34
+echo -e "\nrequest_route {\n ;\n}" >> $CFG
34 35
 
35
-$BIN -w . -f $CFG > /dev/null
36
+$BIN -w . -f $CFG -a no > /dev/null
36 37
 ret=$?
37 38
 
38 39
 sleep 1
... ...
@@ -40,4 +41,4 @@ $KILL
40 41
 
41 42
 rm $CFG
42 43
 
43
-exit $ret
44 44
\ No newline at end of file
45
+exit $ret
... ...
@@ -28,11 +28,12 @@ if ! (check_kamailio && check_module "db_postgres" ); then
28 28
 	exit 0
29 29
 fi ;
30 30
 
31
-CFG=2.cfg
32
-cp $CFG $CFG.bak
31
+CFG=16.cfg
33 32
 
33
+cp 2.cfg $CFG
34 34
 echo "loadmodule \"../../modules/db_postgres/db_postgres.so\"" >> $CFG
35 35
 echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"postgres://kamailioro:kamailioro@localhost/kamailio\")" >> $CFG
36
+echo -e "\nrequest_route {\n ;\n}" >> $CFG
36 37
 
37 38
 # start
38 39
 $BIN -w . -f $CFG > /dev/null
... ...
@@ -41,7 +42,6 @@ ret=$?
41 42
 sleep 1
42 43
 $KILL
43 44
 
44
-mv $CFG.bak $CFG
45
-rm -f dispatcher.list
45
+rm $CFG
46 46
 
47
-exit $ret
48 47
\ No newline at end of file
48
+exit $ret
... ...
@@ -30,19 +30,21 @@ CFG=17.cfg
30 30
 
31 31
 tmp_name=""$RANDOM"_kamailiodb_tmp"
32 32
 
33
-echo "loadmodule \"../../modules/db_berkeley/db_berkeley.so\"" >> $CFG
33
+echo "loadmodule \"../../modules/db_berkeley/db_berkeley.so\"" > $CFG
34 34
 cat 2.cfg >> $CFG
35 35
 echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"berkeley://`pwd`/$CTL_DIR/$tmp_name\")" >> $CFG
36
+echo -e "\nrequest_route {\n ;\n}" >> $CFG
36 37
 
37 38
 # setup config file
38 39
 cp $CTLRC $CTLRC.bak
39 40
 
40
-sed -i "s/# DBENGINE=MYSQL/DBENGINE=DB_BERKELEY/g" $CTLRC
41
-sed -i "s/# INSTALL_EXTRA_TABLES=ask/INSTALL_EXTRA_TABLES=yes/g" $CTLRC
42
-sed -i "s/# INSTALL_PRESENCE_TABLES=ask/INSTALL_PRESENCE_TABLES=yes/g" $CTLRC
41
+sed -i'' -e "s/# DBENGINE=MYSQL/DBENGINE=DB_BERKELEY/g" $CTLRC
42
+sed -i'' -e "s/# INSTALL_EXTRA_TABLES=ask/INSTALL_EXTRA_TABLES=yes/g" $CTLRC
43
+sed -i'' -e "s/# INSTALL_PRESENCE_TABLES=ask/INSTALL_PRESENCE_TABLES=yes/g" $CTLRC
44
+sed -i'' -e "s/# INSTALL_DBUID_TABLES=ask/INSTALL_DBUID_TABLES=yes/g" $CTLRC
43 45
 
44 46
 cp $DBCTL $DBCTL.bak
45
-sed -i "s/TEST=\"false\"/TEST=\"true\"/g" $DBCTL
47
+sed -i'' -e "s/TEST=\"false\"/TEST=\"true\"/g" $DBCTL
46 48
 
47 49
 $DBCTL create $tmp_name > /dev/null
48 50
 ret=$?
... ...
@@ -62,4 +64,4 @@ mv $DBCTL.bak $DBCTL
62 64
 
63 65
 rm $CFG
64 66
 
65
-exit $ret
66 67
\ No newline at end of file
68
+exit $ret
... ...
@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 # runs ../kamailio with all command line arguments.
3
-# ommited options are -h -v -C -c -D
3
+# ommited options are -h -v -I -c -D -V
4 4
 
5 5
 # Copyright (C) 2007 1&1 Internet AG
6 6
 #
... ...
@@ -31,10 +31,10 @@ fi ;
31 31
 CFG=18.cfg
32 32
 
33 33
 # setup config
34
-echo -e "debug=3" > $CFG
34
+echo -e "debug=3\nrequest_route {\n ;\n}" > $CFG
35 35
 
36 36
 # start:
37
-$BIN -f ./$CFG -l 127.0.0.1 -n 0 -rR -v  -E -d -T -N 0 -b 23 -m 42 -w ./  -u $(id -u)  -g $(id -g) -P ./pid.out -G ./pgid.out  > /dev/null 2>&1
37
+$BIN -f ./$CFG -l 127.0.0.1 -n 0 -r -R -E -d -e -K -T -N 0 -b 23 -m 42 -w . -u $(id -u) -g $(id -g) -P ./pid.out -G ./pgid.out -a no -A TESTDEF > /dev/null 2>&1
38 38
 
39 39
 ret=$?
40 40
 
... ...
@@ -29,7 +29,7 @@ modparam("usrloc", "db_mode", 3)
29 29
 modparam("usrloc", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
30 30
 
31 31
 #-----------------------Routing configuration---------------------------------#
32
-route{
32
+request_route{
33 33
 	if (!mf_process_maxfwd_header("10")) {
34 34
 		sl_send_reply("483","Too Many Hops");
35 35
 		exit();
... ...
@@ -42,6 +42,7 @@ route{
42 42
 
43 43
 	if(!lookup ("location")){
44 44
 		sl_send_reply("404", "Not Found");
45
+		exit;
45 46
 	}
46 47
 
47 48
 	if (!t_relay()) {
... ...
@@ -1,5 +1,5 @@
1 1
 #!/bin/bash
2
-# check user lockup for proxy functionality with usrloc and registrar for mysql
2
+# check user lookup for proxy functionality with usrloc and registrar for mysql
3 3
 
4 4
 # Copyright (C) 2007 1&1 Internet AG
5 5
 #
... ...
@@ -34,9 +34,9 @@ UAC=5080
34 34
 
35 35
 
36 36
 # add an registrar entry to the db;
37
-$MYSQL "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);"
37
+$MYSQL "INSERT INTO location (ruid,username,contact,socket,user_agent,cseq,q) VALUES (\"kamailio-unit-uid\", \"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"kamailio_test\",1,-1);"
38 38
 
39
-$BIN -w . -f $CFG &> /dev/null
39
+$BIN -w . -f $CFG > /dev/null
40 40
 sipp -sn uas -bg -i localhost -m 10 -f 2 -p $UAS &> /dev/null
41 41
 sipp -sn uac -s foo 127.0.0.1:$SRV -i localhost -m 10 -f 2 -p $UAC &> /dev/null
42 42
 
... ...
@@ -46,5 +46,5 @@ ret=$?
46 46
 killall -9 sipp > /dev/null 2>&1
47 47
 $KILL > /dev/null 2>&1
48 48
 
49
-$MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
49
+$MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"kamailio_test\"));"
50 50
 exit $ret;