Lines 1-37
Link Here
|
1 |
# |
1 |
# |
2 |
# $Id$ |
|
|
3 |
# |
4 |
# OpenSIPS residential configuration script |
2 |
# OpenSIPS residential configuration script |
5 |
# by OpenSIPS Solutions <team@opensips-solutions.com> |
|
|
6 |
# |
3 |
# |
7 |
# This script was generated via "make menuconfig", from |
4 |
# This script was originally generated via |
8 |
# the "Residential" scenario. |
5 |
# 'CC=gcc6 gmake menuconfig', from the "Residential" scenario. |
9 |
# You can enable / disable more features / functionalities by |
6 |
# You can enable / disable more features / functionalities by |
10 |
# re-generating the scenario with different options.# |
7 |
# re-generating the scenario with different options. |
|
|
8 |
# |
9 |
# To generate an opensips script in FreeBSD, run the following commands, |
10 |
# after installing the port / package. |
11 |
# $ cd /usr/ports/net/opensips |
12 |
# $ make patch |
13 |
# $ cd work/opensips-*/ |
14 |
# $ CC=gcc6 gmake menuconfig |
15 |
# $ ls tmp/ |
16 |
# |
17 |
# As the FreeBSD port maintainer, I have tailored it a little |
18 |
# to resemble the (hopefully) sane set of defaults for a residential |
19 |
# SIP router running on FreeBSD and using PostgreSQL as backend database. |
20 |
# For other supported databases, it should be as simple as changing all |
21 |
# the db_url variables throughout this script. |
11 |
# |
22 |
# |
12 |
# Please refer to the Core CookBook at: |
23 |
# Please refer to the Core CookBook at: |
13 |
# http://www.opensips.org/Resources/DocsCookbooks |
24 |
# http://www.opensips.org/Resources/DocsCookbooks |
14 |
# for a explanation of possible statements, functions and parameters. |
25 |
# for an explanation of possible statements, functions and parameters. |
15 |
# |
26 |
# |
16 |
|
27 |
|
17 |
|
28 |
|
18 |
####### Global Parameters ######### |
29 |
####### Global Parameters ######### |
19 |
|
30 |
|
20 |
debug=3 |
31 |
log_level=3 |
21 |
log_stderror=no |
32 |
log_stderror=no |
22 |
log_facility=LOG_LOCAL0 |
33 |
log_facility=LOG_LOCAL0 |
23 |
|
34 |
|
24 |
fork=yes |
|
|
25 |
children=4 |
35 |
children=4 |
26 |
|
36 |
|
27 |
/* uncomment the following lines to enable debugging */ |
37 |
/* uncomment the following lines to enable debugging */ |
28 |
#debug=6 |
38 |
#debug_mode=yes |
29 |
#fork=no |
|
|
30 |
#log_stderror=yes |
31 |
|
39 |
|
32 |
/* uncomment the next line to enable the auto temporary blacklisting of |
40 |
/* uncomment the next line to enable the auto temporary blacklisting of |
33 |
not available destinations (default disabled) */ |
41 |
not available destinations (default disabled) */ |
34 |
disable_dns_blacklist=yes |
42 |
#disable_dns_blacklist=no |
35 |
|
43 |
|
36 |
/* uncomment the next line to enable IPv6 lookup after IPv4 dns |
44 |
/* uncomment the next line to enable IPv6 lookup after IPv4 dns |
37 |
lookup failures (default disabled) */ |
45 |
lookup failures (default disabled) */ |
Lines 42-58
Link Here
|
42 |
auto_aliases=no |
50 |
auto_aliases=no |
43 |
|
51 |
|
44 |
|
52 |
|
45 |
listen=udp:127.0.0.1:5060 # CUSTOMIZE ME |
53 |
listen=udp:192.168.10.12:5060 # CUSTOMIZE ME |
46 |
|
54 |
listen=tcp:192.168.10.12:5060 # CUSTOMIZE ME |
47 |
#listen=tcp:127.0.0.1:5060 # CUSTOMIZE ME |
55 |
listen=tls:192.168.10.12:5061 # CUSTOMIZE ME |
48 |
#listen=tls:127.0.0.1:5061 # CUSTOMIZE ME |
56 |
#advertised_address=12.34.56.78 # CUSTOMIZE ME (for running behind a NAT router) |
49 |
|
57 |
#alias=12.34.56.78 # CUSTOMIZE ME |
50 |
#advertised_address=111.222.333.444 # CUSTOMIZE ME |
58 |
alias="domain1.net" # CUSTOMIZE ME |
|
|
59 |
#alias="domain2.com" # CUSTOMIZE ME |
51 |
|
60 |
|
52 |
#alias=111.222.333.444 # CUSTOMIZE ME |
61 |
db_default_url="postgres://dbuser:dbpass@dbhostname/dbname" |
53 |
#alias=example.org # CUSTOMIZE ME |
|
|
54 |
|
55 |
db_default_url="postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
56 |
|
62 |
|
57 |
####### Modules Section ######## |
63 |
####### Modules Section ######## |
58 |
|
64 |
|
Lines 92-97
Link Here
|
92 |
#### URI module |
98 |
#### URI module |
93 |
loadmodule "uri.so" |
99 |
loadmodule "uri.so" |
94 |
modparam("uri", "use_uri_table", 0) |
100 |
modparam("uri", "use_uri_table", 0) |
|
|
101 |
|
95 |
|
102 |
|
96 |
|
103 |
|
97 |
|
104 |
|
Lines 101-107
Link Here
|
101 |
#### MYSQL module |
108 |
#### MYSQL module |
102 |
#loadmodule "db_mysql.so" |
109 |
#loadmodule "db_mysql.so" |
103 |
|
110 |
|
104 |
|
|
|
105 |
#### HTTPD module |
111 |
#### HTTPD module |
106 |
#loadmodule "httpd.so" |
112 |
#loadmodule "httpd.so" |
107 |
#modparam("httpd", "port", 8888) |
113 |
#modparam("httpd", "port", 8888) |
Lines 110-124
Link Here
|
110 |
loadmodule "usrloc.so" |
116 |
loadmodule "usrloc.so" |
111 |
modparam("usrloc", "nat_bflag", "NAT") |
117 |
modparam("usrloc", "nat_bflag", "NAT") |
112 |
modparam("usrloc", "db_mode", 2) |
118 |
modparam("usrloc", "db_mode", 2) |
113 |
modparam("usrloc", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
119 |
modparam("usrloc", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
114 |
modparam("usrloc", "hash_size", 11) |
120 |
#modparam("usrloc", "hash_size", 11) # increases size of userloc hash table |
115 |
|
121 |
|
116 |
|
122 |
|
117 |
#### REGISTRAR module |
123 |
#### REGISTRAR module |
118 |
loadmodule "registrar.so" |
124 |
loadmodule "registrar.so" |
119 |
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT") |
125 |
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT") |
120 |
modparam("registrar", "received_avp", "$avp(received_nh)") |
126 |
modparam("registrar", "received_avp", "$avp(received_nh)") |
121 |
modparam("registrar", "max_contacts", 10) |
127 |
/* uncomment the next line not to allow more than 10 contacts per AOR */ |
|
|
128 |
#modparam("registrar", "max_contacts", 10) |
122 |
|
129 |
|
123 |
#### ACCounting module |
130 |
#### ACCounting module |
124 |
loadmodule "acc.so" |
131 |
loadmodule "acc.so" |
Lines 129-139
Link Here
|
129 |
if you enable this parameter, be sure the enable "append_fromtag" |
136 |
if you enable this parameter, be sure the enable "append_fromtag" |
130 |
in "rr" module */ |
137 |
in "rr" module */ |
131 |
modparam("acc", "detect_direction", 0) |
138 |
modparam("acc", "detect_direction", 0) |
132 |
modparam("acc", "failed_transaction_flag", "ACC_FAILED") |
139 |
modparam("acc", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
133 |
/* account triggers (flags) */ |
140 |
|
134 |
modparam("acc", "db_flag", "ACC_DO") |
|
|
135 |
modparam("acc", "db_missed_flag", "ACC_MISSED") |
136 |
modparam("acc", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
137 |
|
141 |
|
138 |
|
142 |
|
139 |
#### AUTHentication modules |
143 |
#### AUTHentication modules |
Lines 141-171
Link Here
|
141 |
loadmodule "auth_db.so" |
145 |
loadmodule "auth_db.so" |
142 |
modparam("auth_db", "calculate_ha1", yes) |
146 |
modparam("auth_db", "calculate_ha1", yes) |
143 |
modparam("auth_db", "password_column", "password") |
147 |
modparam("auth_db", "password_column", "password") |
144 |
modparam("auth_db", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
148 |
modparam("auth_db", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
145 |
modparam("auth_db", "load_credentials", "") |
149 |
modparam("auth_db", "load_credentials", "") |
146 |
|
150 |
|
147 |
|
151 |
|
|
|
152 |
|
148 |
#### ALIAS module |
153 |
#### ALIAS module |
149 |
loadmodule "alias_db.so" |
154 |
loadmodule "alias_db.so" |
150 |
modparam("alias_db", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
155 |
modparam("alias_db", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
|
|
156 |
|
151 |
|
157 |
|
152 |
|
158 |
|
153 |
#### DOMAIN module |
159 |
#### DOMAIN module |
154 |
loadmodule "domain.so" |
160 |
loadmodule "domain.so" |
155 |
modparam("domain", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
161 |
modparam("domain", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
156 |
modparam("domain", "db_mode", 1) # Use caching |
162 |
modparam("domain", "db_mode", 1) # Use caching |
157 |
modparam("auth_db|usrloc|uri", "use_domain", 1) |
163 |
modparam("auth_db|usrloc|uri", "use_domain", 1) |
158 |
|
164 |
|
159 |
|
165 |
|
|
|
166 |
|
160 |
#### PRESENCE modules |
167 |
#### PRESENCE modules |
161 |
loadmodule "xcap.so" |
168 |
loadmodule "xcap.so" |
162 |
loadmodule "presence.so" |
169 |
loadmodule "presence.so" |
163 |
loadmodule "presence_xml.so" |
170 |
loadmodule "presence_xml.so" |
164 |
modparam("xcap|presence", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
171 |
modparam("xcap|presence", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
165 |
modparam("presence_xml", "force_active", 1) |
172 |
modparam("presence_xml", "force_active", 1) |
166 |
modparam("presence", "server_address", "sip:127.0.0.1:5060") # CUSTOMIZE ME |
173 |
modparam("presence", "server_address", "sip:127.0.0.1:5060") # CUSTOMIZE ME |
167 |
modparam("presence", "subs_htable_size", 11) |
174 |
#modparam("presence", "subs_htable_size", 11) # increases size of presence subs hash table |
168 |
modparam("presence", "pres_htable_size", 11) |
175 |
#modparam("presence", "pres_htable_size", 11) # increases size of presence pres hash table |
169 |
#modparam("presence", "max_expires_subscribe", 600) |
176 |
#modparam("presence", "max_expires_subscribe", 600) |
170 |
#modparam("presence", "max_expires_publish", 600) |
177 |
#modparam("presence", "max_expires_publish", 600) |
171 |
|
178 |
|
Lines 175-217
Link Here
|
175 |
modparam("dialog", "dlg_match_mode", 1) |
182 |
modparam("dialog", "dlg_match_mode", 1) |
176 |
modparam("dialog", "default_timeout", 21600) # 6 hours timeout |
183 |
modparam("dialog", "default_timeout", 21600) # 6 hours timeout |
177 |
modparam("dialog", "db_mode", 2) |
184 |
modparam("dialog", "db_mode", 2) |
178 |
modparam("dialog", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
185 |
modparam("dialog", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
|
|
186 |
|
179 |
|
187 |
|
180 |
|
188 |
|
181 |
#### NAT modules |
189 |
#### NAT modules |
182 |
loadmodule "nathelper.so" |
190 |
loadmodule "nathelper.so" |
183 |
modparam("nathelper", "natping_interval", 10) |
191 |
modparam("nathelper", "natping_interval", 10) |
184 |
modparam("nathelper", "ping_nated_only", 1) |
192 |
modparam("nathelper", "ping_nated_only", 1) |
|
|
193 |
modparam("nathelper", "sipping_bflag", "SIP_PING_FLAG") |
194 |
modparam("nathelper", "sipping_from", "sip:pinger@127.0.0.1") #CUSTOMIZE ME |
185 |
modparam("nathelper", "received_avp", "$avp(received_nh)") |
195 |
modparam("nathelper", "received_avp", "$avp(received_nh)") |
186 |
|
196 |
|
187 |
loadmodule "rtpproxy.so" |
197 |
loadmodule "rtpproxy.so" |
188 |
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222") # CUSTOMIZE ME |
198 |
modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:12221") # CUSTOMIZE ME (make sure rtpproxy port matches server) |
189 |
|
199 |
|
190 |
|
200 |
|
191 |
#### DIALPLAN module |
201 |
#### DIALPLAN module |
192 |
loadmodule "dialplan.so" |
202 |
loadmodule "dialplan.so" |
193 |
modparam("dialplan", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME |
203 |
modparam("dialplan", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
|
|
204 |
|
194 |
|
205 |
|
195 |
|
206 |
|
|
|
207 |
#### DYNAMMIC ROUTING module |
208 |
loadmodule "drouting.so" |
209 |
modparam("drouting", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME |
210 |
|
196 |
|
211 |
|
197 |
|
212 |
|
198 |
#### MI_HTTP module |
213 |
#### MI_HTTP module |
199 |
#loadmodule "mi_http.so" |
214 |
#loadmodule "mi_http.so" |
200 |
|
215 |
|
201 |
|
216 |
|
|
|
217 |
#### UDP module |
202 |
loadmodule "proto_udp.so" |
218 |
loadmodule "proto_udp.so" |
203 |
|
219 |
|
204 |
#loadmodule "proto_tcp.so" |
|
|
205 |
#loadmodule "proto_tls.so" |
206 |
#modparam("proto_tls","verify_cert", "1") |
207 |
#modparam("proto_tls","require_cert", "0") |
208 |
#modparam("proto_tls","tls_method", "TLSv1") |
209 |
#modparam("proto_tls","certificate", "/usr/local/etc/opensips/tls/user/user-cert.pem") |
210 |
#modparam("proto_tls","private_key", "/usr/local/etc/opensips/tls/user/user-privkey.pem") |
211 |
#modparam("proto_tls","ca_list", "/usr/local/etc/opensips/tls/user/user-calist.pem") |
212 |
|
220 |
|
|
|
221 |
#### TCP module |
222 |
loadmodule "proto_tcp.so" |
223 |
#modparam("proto_tcp", "tcp_send_timeout", 200) |
224 |
#modparam("proto_tcp", "tcp_max_msg_chunks", 8) |
225 |
|
226 |
|
227 |
#### TLS modules |
228 |
loadmodule "proto_tls.so" |
229 |
loadmodule "tls_mgm.so" |
230 |
modparam("tls_mgm","verify_cert", "1") |
231 |
modparam("tls_mgm","require_cert", "0") |
232 |
modparam("tls_mgm","tls_method", "TLSv1") |
233 |
#modparam("tls_mgm","ca_dir", "/usr/local/etc/opensips/tls/user/") |
234 |
modparam("tls_mgm","certificate", "/usr/local/etc/opensips/tls/user/user-cert.pem") |
235 |
modparam("tls_mgm","private_key", "/usr/local/etc/opensips/tls/user/user-privkey.pem") |
236 |
modparam("tls_mgm","ca_list", "/usr/local/etc/opensips/tls/user/user-calist.pem") |
237 |
#modparam("tls_mgm", "tls_send_timeout", 200) |
238 |
#modparam("tls_mgm", "tls_handshake_timeout", 119) |
239 |
#modparam("proto_tls", "tls_max_msg_chunks", 8) |
213 |
|
240 |
|
214 |
|
241 |
|
|
|
242 |
|
215 |
####### Routing Logic ######## |
243 |
####### Routing Logic ######## |
216 |
|
244 |
|
217 |
# main request routing logic |
245 |
# main request routing logic |
Lines 246-253
Link Here
|
246 |
} |
274 |
} |
247 |
|
275 |
|
248 |
if (is_method("BYE")) { |
276 |
if (is_method("BYE")) { |
249 |
setflag(ACC_DO); # do accounting ... |
277 |
# do accounting even if the transaction fails |
250 |
setflag(ACC_FAILED); # ... even if the transaction fails |
278 |
do_accounting("db","failed"); |
|
|
279 |
|
251 |
} else if (is_method("INVITE")) { |
280 |
} else if (is_method("INVITE")) { |
252 |
# even if in most of the cases is useless, do RR for |
281 |
# even if in most of the cases is useless, do RR for |
253 |
# re-INVITEs alos, as some buggy clients do change route set |
282 |
# re-INVITEs alos, as some buggy clients do change route set |
Lines 294-300
Link Here
|
294 |
|
323 |
|
295 |
t_check_trans(); |
324 |
t_check_trans(); |
296 |
|
325 |
|
297 |
if ( !(is_method("REGISTER") ) ) { |
326 |
if ( !(is_method("REGISTER") || is_from_gw() ) ) { |
298 |
|
327 |
|
299 |
if (is_from_local()) |
328 |
if (is_from_local()) |
300 |
{ |
329 |
{ |
Lines 347-353
Link Here
|
347 |
exit; |
376 |
exit; |
348 |
} |
377 |
} |
349 |
|
378 |
|
350 |
setflag(ACC_DO); # do accounting |
379 |
do_accounting("db"); |
|
|
380 |
|
351 |
} |
381 |
} |
352 |
|
382 |
|
353 |
|
383 |
|
Lines 372-378
Link Here
|
372 |
|
402 |
|
373 |
if (is_method("REGISTER")) |
403 |
if (is_method("REGISTER")) |
374 |
{ |
404 |
{ |
375 |
|
|
|
376 |
# authenticate the REGISTER requests |
405 |
# authenticate the REGISTER requests |
377 |
if (!www_authorize("", "subscriber")) |
406 |
if (!www_authorize("", "subscriber")) |
378 |
{ |
407 |
{ |
Lines 388-393
Link Here
|
388 |
|
417 |
|
389 |
if ( proto==TCP || proto==TLS || 0 ) setflag(TCP_PERSISTENT); |
418 |
if ( proto==TCP || proto==TLS || 0 ) setflag(TCP_PERSISTENT); |
390 |
|
419 |
|
|
|
420 |
if (isflagset(NAT)) { |
421 |
setbflag(SIP_PING_FLAG); |
422 |
} |
423 |
|
391 |
if (!save("location")) |
424 |
if (!save("location")) |
392 |
sl_reply_error(); |
425 |
sl_reply_error(); |
393 |
|
426 |
|
Lines 408-413
Link Here
|
408 |
# apply transformations from dialplan table |
441 |
# apply transformations from dialplan table |
409 |
dp_translate("0","$rU/$rU"); |
442 |
dp_translate("0","$rU/$rU"); |
410 |
|
443 |
|
|
|
444 |
|
445 |
if ($rU=~"^\+[1-9][0-9]+$") { |
446 |
|
447 |
if (!do_routing("0")) { |
448 |
send_reply("500","No PSTN Route found"); |
449 |
exit; |
450 |
} |
451 |
|
452 |
route(relay); |
453 |
exit; |
454 |
} |
411 |
|
455 |
|
412 |
|
456 |
|
413 |
# do lookup with method filtering |
457 |
# do lookup with method filtering |
Lines 417-431
Link Here
|
417 |
exit; |
461 |
exit; |
418 |
} |
462 |
} |
419 |
|
463 |
|
420 |
t_newtran(); |
464 |
# redirect to a different VM system |
421 |
t_reply("404", "Not Found"); |
465 |
$du = "sip:127.0.0.2:5060"; # CUSTOMIZE ME |
422 |
exit; |
466 |
route(relay); |
|
|
467 |
|
423 |
} |
468 |
} |
424 |
|
469 |
|
425 |
if (isbflagset(NAT)) setflag(NAT); |
470 |
if (isbflagset(NAT)) setflag(NAT); |
426 |
|
471 |
|
427 |
# when routing via usrloc, log the missed calls also |
472 |
# when routing via usrloc, log the missed calls also |
428 |
setflag(ACC_MISSED); |
473 |
do_accounting("db","missed"); |
|
|
474 |
|
429 |
route(relay); |
475 |
route(relay); |
430 |
} |
476 |
} |
431 |
|
477 |
|
Lines 504-509
Link Here
|
504 |
##} |
550 |
##} |
505 |
|
551 |
|
506 |
|
552 |
|
|
|
553 |
# redirect the failed to a different VM system |
554 |
if (t_check_status("486|408")) { |
555 |
$du = "sip:127.0.0.2:5060"; # CUSTOMIZE ME |
556 |
# do not set the missed call flag again |
557 |
route(relay); |
558 |
} |
507 |
} |
559 |
} |
508 |
|
560 |
|
509 |
|
561 |
|