Wed, 21 Sep 2011 16:06:14 +0200
Warning, downgrading software version due to TLS or TCP blocking defects in newest vendor version.
michael@376 | 1 | ## |
michael@376 | 2 | ## opensips.cfg -- OpenSIPS server configuration |
michael@376 | 3 | ## |
michael@376 | 4 | |
michael@377 | 5 | |
michael@377 | 6 | # General configuration help available at: |
michael@377 | 7 | # http://siprouter.teigre.com/doc/gettingstarted/ |
michael@377 | 8 | |
michael@377 | 9 | # Specific routing help available at: |
michael@377 | 10 | # http://www.opensips.org/index.php?n=Resources.DocsCoreRoutes |
michael@377 | 11 | |
michael@377 | 12 | # Information on debug and log levels |
michael@377 | 13 | # http://www.voice-system.ro/docs/ser-syslog/ |
michael@377 | 14 | |
michael@377 | 15 | # Die Konfigbloecke sind: |
michael@377 | 16 | # Global Configuration Parameters |
michael@377 | 17 | # Extension Module Loading |
michael@377 | 18 | # Extension Module Configuration |
michael@377 | 19 | # Main Request Routing Logic |
michael@377 | 20 | # Secondary Request Routing Logic |
michael@377 | 21 | # Branch Request Routing Logic |
michael@377 | 22 | # Reply Request Routing Logic |
michael@377 | 23 | # Failure Request Routing Logic |
michael@377 | 24 | # Local Request Routing Logic |
michael@377 | 25 | # Error Request Routing Logic |
michael@376 | 26 | # |
michael@377 | 27 | # Logging: |
michael@377 | 28 | # L_ALERT (-3) - used if the error requires immediate action. |
michael@377 | 29 | # L_CRIT (-2) - used if the error is a critical situation. |
michael@377 | 30 | # L_ERR (-1) - used if the error doesn't cause system malfunctioning. |
michael@377 | 31 | # L_WARN (1) - used to write warning messages. |
michael@377 | 32 | # L_NOTICE (2) - used to report unusual situations. |
michael@377 | 33 | # L_INFO (3) - used to write informational messages. |
michael@377 | 34 | # L_DBG (4) - used to write messages for debugging. |
michael@377 | 35 | |
michael@377 | 36 | |
michael@376 | 37 | # |
michael@377 | 38 | # Global Configuration Parameters |
michael@377 | 39 | # |
michael@376 | 40 | # process configuration |
michael@377 | 41 | debug=4 |
michael@376 | 42 | log_stderror=no |
michael@376 | 43 | fork=yes |
michael@377 | 44 | children=2 |
michael@377 | 45 | tcp_children=2 |
michael@376 | 46 | user="@l_rusr@" |
michael@376 | 47 | group="@l_rgrp@" |
michael@377 | 48 | wdir="@l_prefix@/var/opensips" |
michael@376 | 49 | |
michael@376 | 50 | # network configuration |
michael@377 | 51 | listen=udp:voip.realhost.tld:5060 |
michael@377 | 52 | #listen = tls:voip.realhost.tld:5061 |
michael@377 | 53 | |
michael@377 | 54 | # network aliases |
michael@377 | 55 | alias=voip.firsthost.tld:5060 |
michael@377 | 56 | #alias=voip.firsthost.tld:5061 |
michael@377 | 57 | alias=voip.secondhost.tld:5060 |
michael@377 | 58 | #alias=voip.secondhost.tld:5061 |
michael@377 | 59 | |
michael@377 | 60 | # enable TLS |
michael@377 | 61 | #https://confluence.terena.org/display/IPTelCB/3.5.2.+TLS+for+OpenSER+(UA-Proxy) |
michael@377 | 62 | #http://www.opensips.org/html/docs/tutorials/tls-1.4.x.html |
michael@377 | 63 | # |
michael@377 | 64 | #Run 'openserctl tls rootCA' to create @l_prefix@/etc/openser/tls/rootCA/cacert.pem. |
michael@377 | 65 | #Run 'openserctl tls userCERT' to create user-calist.pem, user-cert.pem, user-cert_req.pem, and user-privkey.pem in @l_prefix@/etc/openser/tls/user/. |
michael@377 | 66 | #Copy @l_prefix@/etc/openser/tls/rootCA/cacert.pem to the client host. |
michael@377 | 67 | #On Windows XP client hosts, run 'certmrg.msc' to import the certificate into the root certificate store. |
michael@377 | 68 | # |
michael@377 | 69 | #disable_tls = 0 |
michael@377 | 70 | #tls_method = TLSv1 |
michael@377 | 71 | #tls_verify_server = 1 |
michael@377 | 72 | #tls_verify_client = 1 |
michael@377 | 73 | #tls_require_client_certificate = 1 |
michael@377 | 74 | #tls_ciphers_list = "HIGH:MEDIUM:!ADH" # openssl ciphers -v HIGH:MEDIUM |
michael@377 | 75 | #tls_certificate = "@l_prefix@/etc/opensips/tls/user/user-cert.pem" |
michael@377 | 76 | #tls_private_key = "@l_prefix@/etc/opensips/tls/user/user-privkey.pem" |
michael@377 | 77 | #tls_ca_list = "@l_prefix@/etc/opensips/tls/user/user-calist.pem" |
michael@377 | 78 | |
michael@376 | 79 | |
michael@376 | 80 | # |
michael@377 | 81 | # Extension Module Loading |
michael@377 | 82 | # http://www.opensips.org/index.php?n=Resources.DocsModules |
michael@376 | 83 | # |
michael@377 | 84 | # set module path |
michael@377 | 85 | mpath="@l_prefix@/lib/opensips/modules/" |
michael@376 | 86 | |
michael@377 | 87 | loadmodule "sl.so" # Stateless replier |
michael@377 | 88 | loadmodule "tm.so" # Transaction stateful |
michael@377 | 89 | loadmodule "signaling.so" # Signaling wrapper of sl/tm |
michael@377 | 90 | loadmodule "rr.so" # Record Route and Route |
michael@377 | 91 | loadmodule "maxfwd.so" # Maximum Forward processor |
michael@377 | 92 | loadmodule "db_text.so" # Text backend for database API |
michael@377 | 93 | loadmodule "usrloc.so" # User location implementation |
michael@377 | 94 | loadmodule "registrar.so" # SIP Registrar implementation |
michael@377 | 95 | loadmodule "uri.so" # Generic URI operation |
michael@377 | 96 | loadmodule "auth.so" # Authentication Interface |
michael@377 | 97 | loadmodule "textops.so" # Text based manipulations |
michael@377 | 98 | loadmodule "acc.so" # Accounting |
michael@377 | 99 | loadmodule "auth_db.so" # Database backend authentication |
michael@377 | 100 | loadmodule "mi_fifo.so" # FIFO support for Management Interface |
michael@377 | 101 | #loadmodule "flatstore.so" # Fast writing only text database |
michael@377 | 102 | #loadmodule "alias_db.so" # Database aliases |
michael@377 | 103 | #loadmodule "domain.so" # Multidomain support |
michael@377 | 104 | #loadmodule "nathelper.so" # NAT traversal helper |
michael@377 | 105 | #loadmodule "enum.so" # ENUM lookup |
michael@376 | 106 | |
michael@376 | 107 | |
michael@376 | 108 | # |
michael@377 | 109 | # Extension Module Configuration |
michael@376 | 110 | # |
michael@377 | 111 | # ----- dbtext params ----- |
michael@377 | 112 | modparam("db_text", "db_mode", 0) # caching for persistence |
michael@376 | 113 | |
michael@377 | 114 | # ----- multimodule params ----- |
michael@377 | 115 | modparam("usrloc|uri|auth_db", "db_url", "text://@l_prefix@/var/opensips/db") |
michael@376 | 116 | |
michael@377 | 117 | # ----- rr params ----- |
michael@382 | 118 | modparam("rr", "enable_full_lr", 1) # add value to ;lr param for broken UAs |
michael@377 | 119 | modparam("rr", "append_fromtag", 1) # important when using detect_direction |
michael@376 | 120 | |
michael@377 | 121 | # ----- usrloc params ----- |
michael@377 | 122 | /* see 'multimodule params' as well */ |
michael@377 | 123 | modparam("usrloc", "db_mode", 2) # Write back database persistence scheme |
michael@376 | 124 | |
michael@377 | 125 | # ----- registrar params ----- |
michael@377 | 126 | modparam("registrar", "max_contacts", 10) # contacts per AOR allowed |
michael@377 | 127 | |
michael@377 | 128 | # ----- acc params ----- |
michael@377 | 129 | /* see 'multimodule params' as well */ |
michael@377 | 130 | modparam("acc", "db_url", "dbtext://@l_prefix@/var/opensips/db") |
michael@377 | 131 | #modparam("acc", "db_url", "flatstore:@l_prefix@/var/opensips/acc") |
michael@377 | 132 | modparam("acc", "early_media", 1) |
michael@382 | 133 | modparam("acc", "report_ack", 1) |
michael@377 | 134 | modparam("acc", "report_cancels", 1) |
michael@377 | 135 | modparam("acc", "detect_direction", 1) |
michael@377 | 136 | modparam("acc", "log_level", 2) |
michael@377 | 137 | modparam("acc", "log_flag", 1) |
michael@377 | 138 | modparam("acc", "log_missed_flag", 2) |
michael@377 | 139 | modparam("acc", "db_flag", 1) |
michael@377 | 140 | modparam("acc", "db_missed_flag", 2) |
michael@377 | 141 | modparam("acc", "failed_transaction_flag", 4) |
michael@377 | 142 | |
michael@377 | 143 | # ----- mi_fifo params ----- |
michael@377 | 144 | modparam("mi_fifo", "fifo_name", "@l_prefix@/var/opensips/opensips.fifo") |
michael@377 | 145 | modparam("mi_fifo", "reply_dir", "@l_prefix@/var/opensips/tmp/") |
michael@377 | 146 | |
michael@376 | 147 | |
michael@376 | 148 | # |
michael@377 | 149 | # Main Request Routing Logic |
michael@376 | 150 | # |
michael@377 | 151 | route { |
michael@377 | 152 | # message diagnostics |
michael@377 | 153 | #log(3, "new branch at $ru\n"); |
michael@377 | 154 | xlog("L_INFO", "$rm: Orig - $ou\n"); |
michael@377 | 155 | xlog("L_INFO", "$rm: Req - $ru\n"); |
michael@377 | 156 | xlog("L_INFO", "$rm: To - $tu\n"); |
michael@377 | 157 | xlog("L_INFO", "$rm: Dest - $du\n"); |
michael@377 | 158 | xlog("L_INFO", "$rm: From - $fu\n"); |
michael@376 | 159 | |
michael@377 | 160 | # sanity checks |
michael@377 | 161 | if (!mf_process_maxfwd_header("10")) { # avoid loops in forward logic |
michael@377 | 162 | sl_send_reply("483","Too Many Hops"); |
michael@376 | 163 | exit; |
michael@377 | 164 | } |
michael@377 | 165 | if (msg:len > max_len) { # repel DoS attacks |
michael@377 | 166 | sl_send_reply("513", "Message Too Large"); |
michael@376 | 167 | exit; |
michael@376 | 168 | }; |
michael@376 | 169 | |
michael@377 | 170 | # sequential request within a dialog should |
michael@377 | 171 | # take the path determined by record routing |
michael@377 | 172 | if (has_totag()) { |
michael@377 | 173 | if (loose_route()) { |
michael@377 | 174 | if (is_method("BYE")) { |
michael@377 | 175 | setflag(1); # do accouting... |
michael@377 | 176 | setflag(4); # ...even if the transaction fails |
michael@377 | 177 | } |
michael@377 | 178 | # mark routing logic in request |
michael@377 | 179 | append_hf("P-hint: rr-enforced\r\n"); |
michael@377 | 180 | route(1); |
michael@377 | 181 | } else { |
michael@377 | 182 | sl_send_reply("404", "Not Found"); |
michael@377 | 183 | } |
michael@377 | 184 | exit; |
michael@377 | 185 | } |
michael@376 | 186 | |
michael@377 | 187 | # |
michael@377 | 188 | # initial requests |
michael@377 | 189 | # |
michael@377 | 190 | if (is_method("CANCEL")) { # CANCEL processing |
michael@377 | 191 | if (t_check_trans()) |
michael@377 | 192 | t_relay(); |
michael@377 | 193 | exit; |
michael@377 | 194 | } |
michael@376 | 195 | |
michael@377 | 196 | t_check_trans(); |
michael@377 | 197 | |
michael@377 | 198 | # authenticate if from local subscriber (uncomment to enable auth) |
michael@377 | 199 | #if (!is_method("REGISTER") && from_uri == myself) { |
michael@377 | 200 | # if (!proxy_authorize("", "subscriber")) { |
michael@377 | 201 | # proxy_challenge("", "0"); |
michael@377 | 202 | # exit; |
michael@377 | 203 | # } |
michael@377 | 204 | # if (!check_from()) { |
michael@377 | 205 | # sl_send_reply("403","Forbidden"); |
michael@377 | 206 | # exit; |
michael@377 | 207 | # } |
michael@377 | 208 | # |
michael@377 | 209 | # consume_credentials(); |
michael@377 | 210 | # # caller authenticated |
michael@377 | 211 | #} |
michael@377 | 212 | |
michael@377 | 213 | # record route all messages to ensure that subsequent messages |
michael@377 | 214 | # will go through our proxy, particularly good if upstream |
michael@377 | 215 | # and downstream entities use different transport protocol |
michael@377 | 216 | if (!is_method("REGISTER|MESSAGE")) { |
michael@376 | 217 | record_route(); |
michael@377 | 218 | } |
michael@376 | 219 | |
michael@377 | 220 | # account only INVITEs |
michael@377 | 221 | if (is_method("INVITE")) { |
michael@377 | 222 | setflag(1); |
michael@377 | 223 | } |
michael@377 | 224 | |
michael@377 | 225 | if (!uri == myself) { |
michael@377 | 226 | /* replace with following line if multidomain support is used */ |
michael@377 | 227 | #if (!is_uri_host_local()) { |
michael@377 | 228 | append_hf("P-hint: outbound\r\n"); |
michael@377 | 229 | # if you have some interdomain connections via TLS |
michael@377 | 230 | #if ($rd == "tls_domain1.net") { |
michael@377 | 231 | # t_relay("tls:domain1.net"); |
michael@377 | 232 | # exit; |
michael@377 | 233 | #} else if ($rd == "tls_domain2.net") { |
michael@377 | 234 | # t_relay("tls:domain2.net"); |
michael@377 | 235 | # exit; |
michael@377 | 236 | #} |
michael@376 | 237 | route(1); |
michael@377 | 238 | } |
michael@376 | 239 | |
michael@377 | 240 | # |
michael@377 | 241 | # requests for my domain |
michael@377 | 242 | # |
michael@377 | 243 | if (is_method("PUBLISH")) { |
michael@377 | 244 | sl_send_reply("503", "Service Unavailable"); |
michael@377 | 245 | exit; |
michael@377 | 246 | } |
michael@376 | 247 | |
michael@377 | 248 | if (is_method("REGISTER")) { |
michael@377 | 249 | # authenticate the REGISTER requests (uncomment to enable auth) |
michael@377 | 250 | #if (!www_authorize("", "subscriber")) { |
michael@377 | 251 | # www_challenge("", "0"); |
michael@377 | 252 | # exit; |
michael@377 | 253 | #} |
michael@377 | 254 | # |
michael@377 | 255 | #if (!check_to()) { |
michael@377 | 256 | # sl_send_reply("403","Forbidden"); |
michael@377 | 257 | # exit; |
michael@377 | 258 | #} |
michael@377 | 259 | |
michael@377 | 260 | if (!save("location")) |
michael@377 | 261 | sl_reply_error(); |
michael@377 | 262 | |
michael@377 | 263 | exit; |
michael@377 | 264 | } |
michael@377 | 265 | |
michael@377 | 266 | if ($rU == NULL) { |
michael@377 | 267 | # request with no Username in RURI |
michael@377 | 268 | sl_send_reply("484","Address Incomplete"); |
michael@377 | 269 | exit; |
michael@377 | 270 | } |
michael@377 | 271 | |
michael@377 | 272 | lookup("location"); |
michael@377 | 273 | switch ($retcode) { |
michael@377 | 274 | case 1: |
michael@377 | 275 | append_hf("P-hint: usrloc applied\r\n"); |
michael@377 | 276 | break; |
michael@377 | 277 | case -1: |
michael@377 | 278 | t_newtran(); |
michael@377 | 279 | t_reply("404", "Not Found"); |
michael@376 | 280 | exit; |
michael@377 | 281 | case -2: |
michael@377 | 282 | sl_send_reply("405", "Method Not Allowed"); |
michael@377 | 283 | exit; |
michael@377 | 284 | case -3: |
michael@377 | 285 | t_newtran(); |
michael@377 | 286 | t_reply("500", "Server Internal Error"); |
michael@377 | 287 | exit; |
michael@377 | 288 | } |
michael@376 | 289 | |
michael@377 | 290 | setflag(2); # when routing via usrloc then |
michael@377 | 291 | route(1); # log the missed calls as well |
michael@376 | 292 | } |
michael@376 | 293 | |
michael@377 | 294 | |
michael@377 | 295 | # |
michael@377 | 296 | # Secondary Request Routing Logic |
michael@377 | 297 | # |
michael@376 | 298 | route[1] { |
michael@377 | 299 | # for INVITEs enable some additional helper routes |
michael@377 | 300 | if (is_method("INVITE")) { |
michael@377 | 301 | t_on_branch("1"); |
michael@377 | 302 | t_on_reply("1"); |
michael@377 | 303 | t_on_failure("1"); |
michael@377 | 304 | } |
michael@377 | 305 | |
michael@377 | 306 | # send with stateful forwarding which works reliably even for UDP2TCP |
michael@377 | 307 | if (!t_relay()) |
michael@376 | 308 | sl_reply_error(); |
michael@377 | 309 | |
michael@377 | 310 | exit; # safeguard |
michael@376 | 311 | } |
michael@376 | 312 | |
michael@376 | 313 | |
michael@377 | 314 | # |
michael@377 | 315 | # Branch Request Routing Logic |
michael@377 | 316 | # |
michael@377 | 317 | branch_route[1] { |
michael@377 | 318 | xlog("L_INFO", "new branch at $ru\n"); |
michael@377 | 319 | } |
michael@377 | 320 | |
michael@377 | 321 | |
michael@377 | 322 | # |
michael@377 | 323 | # Reply Request Routing Logic |
michael@377 | 324 | # |
michael@377 | 325 | onreply_route[1] { |
michael@377 | 326 | xlog("L_INFO", "incoming reply at $ru\n"); |
michael@377 | 327 | # if ($ua =~ fritz.box) |
michael@377 | 328 | # xlog("L_ERR", "$rm: The Fritzbox replied!\n"); |
michael@377 | 329 | # if ($ua =~ fritz.box && has_body("application/sdp")) |
michael@377 | 330 | # search_append_body("a=sendrecv.*", "\na=ptime:30"); |
michael@377 | 331 | } |
michael@377 | 332 | |
michael@377 | 333 | |
michael@377 | 334 | # |
michael@377 | 335 | # Failure Request Routing Logic |
michael@377 | 336 | # |
michael@377 | 337 | failure_route[1] { |
michael@377 | 338 | xlog("L_INFO", "failed route at $ru\n"); |
michael@377 | 339 | if (t_was_cancelled()) |
michael@377 | 340 | exit; |
michael@377 | 341 | |
michael@377 | 342 | # uncomment the following lines to block |
michael@377 | 343 | # client redirect based on 3xx replies |
michael@377 | 344 | #if (t_check_status("3[0-9][0-9]")) { |
michael@377 | 345 | #t_reply("404","Not Found"); |
michael@377 | 346 | # exit; |
michael@377 | 347 | #} |
michael@377 | 348 | |
michael@377 | 349 | # uncomment the following lines to redirect |
michael@377 | 350 | # failed calls to a different new destination |
michael@377 | 351 | #if (t_check_status("486|408")) { |
michael@377 | 352 | # sethostport("192.168.2.100:5060"); |
michael@377 | 353 | # append_branch(); |
michael@377 | 354 | # # do not set the missed call flag again |
michael@377 | 355 | # t_relay(); |
michael@377 | 356 | #} |
michael@377 | 357 | } |
michael@377 | 358 | |
michael@377 | 359 | |
michael@377 | 360 | # |
michael@377 | 361 | # Local Request Routing Logic |
michael@377 | 362 | # |
michael@377 | 363 | local_route { |
michael@377 | 364 | if (is_method("INVITE") && $ru=~"@foreign.tld") { |
michael@377 | 365 | append_hf("P-hint: foreign request\r\n"); |
michael@377 | 366 | exit; |
michael@377 | 367 | } |
michael@377 | 368 | if (is_method("BYE")) |
michael@377 | 369 | xlog("L_INFO", "internally generated BYE\n"); |
michael@377 | 370 | } |
michael@377 | 371 | |
michael@377 | 372 | |
michael@377 | 373 | # |
michael@377 | 374 | # Error Request Routing Logic |
michael@377 | 375 | # |
michael@377 | 376 | error_route { |
michael@377 | 377 | xlog("L_ERR", "error route class=$(err.class) level=$(err.level) info=$(err.info) rcode=$(err.rcode) rreason=$(err.rreason)\n"); |
michael@377 | 378 | xlog("L_ERR", "error from [$si:$sp]\n"); |
michael@377 | 379 | xlog("L_ERR", "++++\n$mb\n++++\n"); |
michael@377 | 380 | sl_send_reply("$err.rcode", "$err.rreason"); |
michael@377 | 381 | exit; |
michael@377 | 382 | } |
michael@377 | 383 |