Wed, 21 Sep 2011 14:04:16 +0200
Introduce severe but necessary corrections and update to new vendor version.
1.1 --- a/opensips/opensips.cfg Wed Sep 21 14:02:13 2011 +0200 1.2 +++ b/opensips/opensips.cfg Wed Sep 21 14:04:16 2011 +0200 1.3 @@ -2,197 +2,380 @@ 1.4 ## opensips.cfg -- OpenSIPS server configuration 1.5 ## 1.6 1.7 + 1.8 +# General configuration help available at: 1.9 +# http://siprouter.teigre.com/doc/gettingstarted/ 1.10 + 1.11 +# Specific routing help available at: 1.12 +# http://www.opensips.org/index.php?n=Resources.DocsCoreRoutes 1.13 + 1.14 +# Information on debug and log levels 1.15 +# http://www.voice-system.ro/docs/ser-syslog/ 1.16 + 1.17 +# Die Konfigbloecke sind: 1.18 +# Global Configuration Parameters 1.19 +# Extension Module Loading 1.20 +# Extension Module Configuration 1.21 +# Main Request Routing Logic 1.22 +# Secondary Request Routing Logic 1.23 +# Branch Request Routing Logic 1.24 +# Reply Request Routing Logic 1.25 +# Failure Request Routing Logic 1.26 +# Local Request Routing Logic 1.27 +# Error Request Routing Logic 1.28 # 1.29 -# GLOBAL CONFIGURATION PARAMETERS 1.30 +# Logging: 1.31 +# L_ALERT (-3) - used if the error requires immediate action. 1.32 +# L_CRIT (-2) - used if the error is a critical situation. 1.33 +# L_ERR (-1) - used if the error doesn't cause system malfunctioning. 1.34 +# L_WARN (1) - used to write warning messages. 1.35 +# L_NOTICE (2) - used to report unusual situations. 1.36 +# L_INFO (3) - used to write informational messages. 1.37 +# L_DBG (4) - used to write messages for debugging. 1.38 + 1.39 + 1.40 # 1.41 - 1.42 +# Global Configuration Parameters 1.43 +# 1.44 # process configuration 1.45 -debug=1 1.46 +debug=4 1.47 log_stderror=no 1.48 fork=yes 1.49 -check_via=no 1.50 -dns=no 1.51 -rev_dns=no 1.52 -children=4 1.53 +children=2 1.54 +tcp_children=2 1.55 user="@l_rusr@" 1.56 group="@l_rgrp@" 1.57 -fifo="@l_prefix@/var/opensips/opensips.fifo" 1.58 -workdir="@l_prefix@/var/opensips" 1.59 +wdir="@l_prefix@/var/opensips" 1.60 1.61 # network configuration 1.62 -alias="sip.example.com" 1.63 -listen="127.0.0.1" 1.64 -port=5060 1.65 +listen=udp:voip.realhost.tld:5060 1.66 +#listen = tls:voip.realhost.tld:5061 1.67 + 1.68 +# network aliases 1.69 +alias=voip.firsthost.tld:5060 1.70 +#alias=voip.firsthost.tld:5061 1.71 +alias=voip.secondhost.tld:5060 1.72 +#alias=voip.secondhost.tld:5061 1.73 + 1.74 +# enable TLS 1.75 +#https://confluence.terena.org/display/IPTelCB/3.5.2.+TLS+for+OpenSER+(UA-Proxy) 1.76 +#http://www.opensips.org/html/docs/tutorials/tls-1.4.x.html 1.77 +# 1.78 +#Run 'openserctl tls rootCA' to create @l_prefix@/etc/openser/tls/rootCA/cacert.pem. 1.79 +#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/. 1.80 +#Copy @l_prefix@/etc/openser/tls/rootCA/cacert.pem to the client host. 1.81 +#On Windows XP client hosts, run 'certmrg.msc' to import the certificate into the root certificate store. 1.82 +# 1.83 +#disable_tls = 0 1.84 +#tls_method = TLSv1 1.85 +#tls_verify_server = 1 1.86 +#tls_verify_client = 1 1.87 +#tls_require_client_certificate = 1 1.88 +#tls_ciphers_list = "HIGH:MEDIUM:!ADH" # openssl ciphers -v HIGH:MEDIUM 1.89 +#tls_certificate = "@l_prefix@/etc/opensips/tls/user/user-cert.pem" 1.90 +#tls_private_key = "@l_prefix@/etc/opensips/tls/user/user-privkey.pem" 1.91 +#tls_ca_list = "@l_prefix@/etc/opensips/tls/user/user-calist.pem" 1.92 + 1.93 1.94 # 1.95 -# EXTENSION MODULE LOADING 1.96 +# Extension Module Loading 1.97 +# http://www.opensips.org/index.php?n=Resources.DocsModules 1.98 # 1.99 +# set module path 1.100 +mpath="@l_prefix@/lib/opensips/modules/" 1.101 1.102 -#loadmodule "@l_prefix@/lib/opensips/modules/dbtext.so" 1.103 +loadmodule "sl.so" # Stateless replier 1.104 +loadmodule "tm.so" # Transaction stateful 1.105 +loadmodule "signaling.so" # Signaling wrapper of sl/tm 1.106 +loadmodule "rr.so" # Record Route and Route 1.107 +loadmodule "maxfwd.so" # Maximum Forward processor 1.108 +loadmodule "db_text.so" # Text backend for database API 1.109 +loadmodule "usrloc.so" # User location implementation 1.110 +loadmodule "registrar.so" # SIP Registrar implementation 1.111 +loadmodule "uri.so" # Generic URI operation 1.112 +loadmodule "auth.so" # Authentication Interface 1.113 +loadmodule "textops.so" # Text based manipulations 1.114 +loadmodule "acc.so" # Accounting 1.115 +loadmodule "auth_db.so" # Database backend authentication 1.116 +loadmodule "mi_fifo.so" # FIFO support for Management Interface 1.117 +#loadmodule "flatstore.so" # Fast writing only text database 1.118 +#loadmodule "alias_db.so" # Database aliases 1.119 +#loadmodule "domain.so" # Multidomain support 1.120 +#loadmodule "nathelper.so" # NAT traversal helper 1.121 +#loadmodule "enum.so" # ENUM lookup 1.122 1.123 -loadmodule "@l_prefix@/lib/opensips/modules/sl.so" 1.124 -loadmodule "@l_prefix@/lib/opensips/modules/tm.so" 1.125 -loadmodule "@l_prefix@/lib/opensips/modules/rr.so" 1.126 -loadmodule "@l_prefix@/lib/opensips/modules/maxfwd.so" 1.127 -loadmodule "@l_prefix@/lib/opensips/modules/usrloc.so" 1.128 -loadmodule "@l_prefix@/lib/opensips/modules/registrar.so" 1.129 -loadmodule "@l_prefix@/lib/opensips/modules/textops.so" 1.130 - 1.131 -#loadmodule "@l_prefix@/lib/opensips/modules/auth.so" 1.132 -#loadmodule "@l_prefix@/lib/opensips/modules/auth_db.so" 1.133 - 1.134 -#loadmodule "@l_prefix@/lib/opensips/modules/nathelper.so" 1.135 1.136 # 1.137 -# EXTENSION MODULE CONFIGURATION 1.138 +# Extension Module Configuration 1.139 # 1.140 +# ----- dbtext params ----- 1.141 +modparam("db_text", "db_mode", 0) # caching for persistence 1.142 1.143 -# module rr: 1.144 -modparam("rr", "enable_full_lr", 1) 1.145 +# ----- multimodule params ----- 1.146 +modparam("usrloc|uri|auth_db", "db_url", "text://@l_prefix@/var/opensips/db") 1.147 1.148 -# module usrloc: 1.149 -modparam("usrloc", "db_mode", 0) 1.150 -#modparam("usrloc", "db_mode", 2) 1.151 -#modparam("usrloc|auth_db", "db_url", "dbtext://@l_prefix@/var/opensips/db") 1.152 +# ----- rr params ----- 1.153 +modparam("rr", "append_fromtag", 1) # important when using detect_direction 1.154 1.155 -# module auth: 1.156 -#modparam("auth_db", "calculate_ha1", 1) 1.157 -#modparam("auth_db", "password_column", "password") 1.158 -#modparam("auth_db", "user_column", "username") 1.159 -#modparam("auth_db", "domain_column", "domain") 1.160 +# ----- usrloc params ----- 1.161 +/* see 'multimodule params' as well */ 1.162 +modparam("usrloc", "db_mode", 2) # Write back database persistence scheme 1.163 1.164 -# module nathelper: 1.165 -#modparam("registrar", "nat_flag", 6) 1.166 -#modparam("nathelper", "natping_interval", 30) 1.167 -#modparam("nathelper", "ping_nated_only", 1) 1.168 -#modparam("nathelper", "rtpproxy_sock", "unix:@l_prefix@/var/opensips/opensips_rtpproxy.sock") 1.169 -#modparam("nathelper", "rtpproxy_disable", 0) 1.170 -#modparam("nathelper", "rtpproxy_disable_tout", 20) 1.171 -#modparam("nathelper", "sipping_from", "sip:pinger@sip.example.com") 1.172 +# ----- registrar params ----- 1.173 +modparam("registrar", "max_contacts", 10) # contacts per AOR allowed 1.174 + 1.175 +# ----- acc params ----- 1.176 +/* see 'multimodule params' as well */ 1.177 +modparam("acc", "db_url", "dbtext://@l_prefix@/var/opensips/db") 1.178 +#modparam("acc", "db_url", "flatstore:@l_prefix@/var/opensips/acc") 1.179 +modparam("acc", "early_media", 1) 1.180 +modparam("acc", "report_cancels", 1) 1.181 +modparam("acc", "detect_direction", 1) 1.182 +modparam("acc", "log_level", 2) 1.183 +modparam("acc", "log_flag", 1) 1.184 +modparam("acc", "log_missed_flag", 2) 1.185 +modparam("acc", "db_flag", 1) 1.186 +modparam("acc", "db_missed_flag", 2) 1.187 +modparam("acc", "failed_transaction_flag", 4) 1.188 + 1.189 +# ----- mi_fifo params ----- 1.190 +modparam("mi_fifo", "fifo_name", "@l_prefix@/var/opensips/opensips.fifo") 1.191 +modparam("mi_fifo", "reply_dir", "@l_prefix@/var/opensips/tmp/") 1.192 + 1.193 1.194 # 1.195 -# MAIN ROUTING LOGIC 1.196 +# Main Request Routing Logic 1.197 # 1.198 +route { 1.199 + # message diagnostics 1.200 + #log(3, "new branch at $ru\n"); 1.201 + xlog("L_INFO", "$rm: Orig - $ou\n"); 1.202 + xlog("L_INFO", "$rm: Req - $ru\n"); 1.203 + xlog("L_INFO", "$rm: To - $tu\n"); 1.204 + xlog("L_INFO", "$rm: Dest - $du\n"); 1.205 + xlog("L_INFO", "$rm: From - $fu\n"); 1.206 1.207 -route{ 1.208 - # initial sanity checks -- messages with 1.209 - # max_forwards==0, or excessively long requests 1.210 - if (!mf_process_maxfwd_header("10")) { 1.211 - sl_send_reply("483", "Too Many Hops"); 1.212 + # sanity checks 1.213 + if (!mf_process_maxfwd_header("10")) { # avoid loops in forward logic 1.214 + sl_send_reply("483","Too Many Hops"); 1.215 exit; 1.216 - }; 1.217 - if (msg:len >= max_len) { 1.218 - sl_send_reply("513", "Message too big"); 1.219 + } 1.220 + if (msg:len > max_len) { # repel DoS attacks 1.221 + sl_send_reply("513", "Message Too Large"); 1.222 exit; 1.223 }; 1.224 1.225 - #if (method == "INVITE" && uri != myself) { 1.226 - # sl_send_reply("403", "No relaying"); 1.227 - # exit; 1.228 - #}; 1.229 + # sequential request within a dialog should 1.230 + # take the path determined by record routing 1.231 + if (has_totag()) { 1.232 + if (loose_route()) { 1.233 + if (is_method("BYE")) { 1.234 + setflag(1); # do accouting... 1.235 + setflag(4); # ...even if the transaction fails 1.236 + } 1.237 + # mark routing logic in request 1.238 + append_hf("P-hint: rr-enforced\r\n"); 1.239 + route(1); 1.240 + } else { 1.241 + sl_send_reply("404", "Not Found"); 1.242 + } 1.243 + exit; 1.244 + } 1.245 1.246 - # NAT: special handling for NAT'ed clients; first, NAT test is 1.247 - # executed: it looks for via!=received and RFC1918 addresses in 1.248 - # Contact (may fail if line-folding is used); also, the received 1.249 - # test should, if completed, should check all vias for presence of 1.250 - # received. 1.251 - #if (nat_uac_test("3")) { 1.252 - # # allow RR-ed requests, as these may indicate that NAT-enabled 1.253 - # # aproxy takes care of it; unless it is REGISTER 1.254 - # if (method == "REGISTER" || ! search("^Record-Route:")) { 1.255 - # log("LOG: Someone trying to register from private IP, rewriting\n"); 1.256 - # fix_nated_contact(); # rewrite contact with source IP of signalling 1.257 - # if (method == "INVITE") { 1.258 - # fix_nated_sdp("1"); # add direction=active to SDP 1.259 - # }; 1.260 - # force_rport(); # add rport parameter to topmost Via 1.261 - # setflag(6); # mark as NAT'ed 1.262 - # }; 1.263 - #}; 1.264 + # 1.265 + # initial requests 1.266 + # 1.267 + if (is_method("CANCEL")) { # CANCEL processing 1.268 + if (t_check_trans()) 1.269 + t_relay(); 1.270 + exit; 1.271 + } 1.272 1.273 - # we record-route all messages -- to make sure that 1.274 - # subsequent messages will go through our proxy; that's 1.275 - # particularly good if upstream and downstream entities 1.276 - # use different transport protocol 1.277 - if (method != "REGISTER") { 1.278 + t_check_trans(); 1.279 + 1.280 + # authenticate if from local subscriber (uncomment to enable auth) 1.281 + #if (!is_method("REGISTER") && from_uri == myself) { 1.282 + # if (!proxy_authorize("", "subscriber")) { 1.283 + # proxy_challenge("", "0"); 1.284 + # exit; 1.285 + # } 1.286 + # if (!check_from()) { 1.287 + # sl_send_reply("403","Forbidden"); 1.288 + # exit; 1.289 + # } 1.290 + # 1.291 + # consume_credentials(); 1.292 + # # caller authenticated 1.293 + #} 1.294 + 1.295 + # record route all messages to ensure that subsequent messages 1.296 + # will go through our proxy, particularly good if upstream 1.297 + # and downstream entities use different transport protocol 1.298 + if (!is_method("REGISTER|MESSAGE")) { 1.299 record_route(); 1.300 - }; 1.301 + } 1.302 1.303 - # subsequent messages withing a dialog should take the 1.304 - # path determined by record-routing 1.305 - if (loose_route()) { 1.306 - # mark routing logic in request 1.307 - append_hf("P-hint: rr-enforced\r\n"); 1.308 + # account only INVITEs 1.309 + if (is_method("INVITE")) { 1.310 + setflag(1); 1.311 + } 1.312 + 1.313 + if (!uri == myself) { 1.314 + /* replace with following line if multidomain support is used */ 1.315 + #if (!is_uri_host_local()) { 1.316 + append_hf("P-hint: outbound\r\n"); 1.317 + # if you have some interdomain connections via TLS 1.318 + #if ($rd == "tls_domain1.net") { 1.319 + # t_relay("tls:domain1.net"); 1.320 + # exit; 1.321 + #} else if ($rd == "tls_domain2.net") { 1.322 + # t_relay("tls:domain2.net"); 1.323 + # exit; 1.324 + #} 1.325 route(1); 1.326 - }; 1.327 + } 1.328 1.329 - if (uri != myself) { 1.330 - # mark routing logic in request 1.331 - append_hf("P-hint: outbound\r\n"); 1.332 - route(1); 1.333 - }; 1.334 + # 1.335 + # requests for my domain 1.336 + # 1.337 + if (is_method("PUBLISH")) { 1.338 + sl_send_reply("503", "Service Unavailable"); 1.339 + exit; 1.340 + } 1.341 1.342 - # if the request is for other domain use USRLOC 1.343 - # (in case, it does not work, use the following command 1.344 - # with proper names and addresses in it) 1.345 - if (uri == myself) { 1.346 - if (method == "REGISTER") { 1.347 - # uncomment this if you want to use digest authentication 1.348 - #if (!www_authorize("sip.example.com", "subscriber")) { 1.349 - # www_challenge("sip.example.com", "0"); 1.350 - # exit; 1.351 - #}; 1.352 - save("location"); 1.353 + if (is_method("REGISTER")) { 1.354 + # authenticate the REGISTER requests (uncomment to enable auth) 1.355 + #if (!www_authorize("", "subscriber")) { 1.356 + # www_challenge("", "0"); 1.357 + # exit; 1.358 + #} 1.359 + # 1.360 + #if (!check_to()) { 1.361 + # sl_send_reply("403","Forbidden"); 1.362 + # exit; 1.363 + #} 1.364 + 1.365 + if (!save("location")) 1.366 + sl_reply_error(); 1.367 + 1.368 + exit; 1.369 + } 1.370 + 1.371 + if ($rU == NULL) { 1.372 + # request with no Username in RURI 1.373 + sl_send_reply("484","Address Incomplete"); 1.374 + exit; 1.375 + } 1.376 + 1.377 + lookup("location"); 1.378 + switch ($retcode) { 1.379 + case 1: 1.380 + append_hf("P-hint: usrloc applied\r\n"); 1.381 + break; 1.382 + case -1: 1.383 + t_newtran(); 1.384 + t_reply("404", "Not Found"); 1.385 exit; 1.386 - }; 1.387 + case -2: 1.388 + sl_send_reply("405", "Method Not Allowed"); 1.389 + exit; 1.390 + case -3: 1.391 + t_newtran(); 1.392 + t_reply("500", "Server Internal Error"); 1.393 + exit; 1.394 + } 1.395 1.396 - lookup("aliases"); 1.397 - if (uri != myself) { 1.398 - append_hf("P-hint: outbound alias\r\n"); 1.399 - route(1); 1.400 - }; 1.401 - 1.402 - # native SIP destinations are handled using our USRLOC DB 1.403 - if (!lookup("location")) { 1.404 - sl_send_reply("404", "Not Found"); 1.405 - exit; 1.406 - }; 1.407 - append_hf("P-hint: usrloc applied\r\n"); 1.408 - }; 1.409 - 1.410 - route(1); 1.411 + setflag(2); # when routing via usrloc then 1.412 + route(1); # log the missed calls as well 1.413 } 1.414 1.415 + 1.416 +# 1.417 +# Secondary Request Routing Logic 1.418 +# 1.419 route[1] { 1.420 - # disable RFC1918 peers 1.421 - if (uri =~ "[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !search("^Route:")) { 1.422 - sl_send_reply("479", "We don't forward to RFC 1918 IPv4 addresses"); 1.423 - exit; 1.424 - }; 1.425 - 1.426 - # NAT: if client or server know to be behind a NAT, enable relay 1.427 - #if (isflagset(6)) { 1.428 - # force_rtp_proxy(); 1.429 - #}; 1.430 - 1.431 - # NAT: processing of replies; apply to all transactions 1.432 - #t_on_reply("1"); 1.433 - 1.434 - # send it out now; use stateful forwarding as it works reliably even for UDP2TCP 1.435 - if (!t_relay()) { 1.436 + # for INVITEs enable some additional helper routes 1.437 + if (is_method("INVITE")) { 1.438 + t_on_branch("1"); 1.439 + t_on_reply("1"); 1.440 + t_on_failure("1"); 1.441 + } 1.442 + 1.443 + # send with stateful forwarding which works reliably even for UDP2TCP 1.444 + if (!t_relay()) 1.445 sl_reply_error(); 1.446 - }; 1.447 + 1.448 + exit; # safeguard 1.449 } 1.450 1.451 -#onreply_route[1] { 1.452 - # NAT: is it a NAT'ed transaction ? 1.453 - # otherwise, is it a transaction behind a NAT and we did not 1.454 - # know at time of request processing ? (RFC1918 contacts) 1.455 - #if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") { 1.456 - # fix_nated_contact(); 1.457 - # force_rtp_proxy(); 1.458 - #} else if (nat_uac_test("1")) { 1.459 - # fix_nated_contact(); 1.460 - #}; 1.461 -#} 1.462 1.463 +# 1.464 +# Branch Request Routing Logic 1.465 +# 1.466 +branch_route[1] { 1.467 + xlog("L_INFO", "new branch at $ru\n"); 1.468 +} 1.469 + 1.470 + 1.471 +# 1.472 +# Reply Request Routing Logic 1.473 +# 1.474 +onreply_route[1] { 1.475 + xlog("L_INFO", "incoming reply at $ru\n"); 1.476 +# if ($ua =~ fritz.box) 1.477 +# xlog("L_ERR", "$rm: The Fritzbox replied!\n"); 1.478 +# if ($ua =~ fritz.box && has_body("application/sdp")) 1.479 +# search_append_body("a=sendrecv.*", "\na=ptime:30"); 1.480 +} 1.481 + 1.482 + 1.483 +# 1.484 +# Failure Request Routing Logic 1.485 +# 1.486 +failure_route[1] { 1.487 + xlog("L_INFO", "failed route at $ru\n"); 1.488 + if (t_was_cancelled()) 1.489 + exit; 1.490 + 1.491 + # uncomment the following lines to block 1.492 + # client redirect based on 3xx replies 1.493 + #if (t_check_status("3[0-9][0-9]")) { 1.494 + #t_reply("404","Not Found"); 1.495 + # exit; 1.496 + #} 1.497 + 1.498 + # uncomment the following lines to redirect 1.499 + # failed calls to a different new destination 1.500 + #if (t_check_status("486|408")) { 1.501 + # sethostport("192.168.2.100:5060"); 1.502 + # append_branch(); 1.503 + # # do not set the missed call flag again 1.504 + # t_relay(); 1.505 + #} 1.506 +} 1.507 + 1.508 + 1.509 +# 1.510 +# Local Request Routing Logic 1.511 +# 1.512 +local_route { 1.513 + if (is_method("INVITE") && $ru=~"@foreign.tld") { 1.514 + append_hf("P-hint: foreign request\r\n"); 1.515 + exit; 1.516 + } 1.517 + if (is_method("BYE")) 1.518 + xlog("L_INFO", "internally generated BYE\n"); 1.519 +} 1.520 + 1.521 + 1.522 +# 1.523 +# Error Request Routing Logic 1.524 +# 1.525 +error_route { 1.526 + xlog("L_ERR", "error route class=$(err.class) level=$(err.level) info=$(err.info) rcode=$(err.rcode) rreason=$(err.rreason)\n"); 1.527 + xlog("L_ERR", "error from [$si:$sp]\n"); 1.528 + xlog("L_ERR", "++++\n$mb\n++++\n"); 1.529 + sl_send_reply("$err.rcode", "$err.rreason"); 1.530 + exit; 1.531 +} 1.532 +
2.1 --- a/opensips/opensips.patch Wed Sep 21 14:02:13 2011 +0200 2.2 +++ b/opensips/opensips.patch Wed Sep 21 14:04:16 2011 +0200 2.3 @@ -1,29 +1,96 @@ 2.4 +Index: main.c 2.5 +diff -Nau main.c.orig main.c 2.6 +--- main.c.orig 2009-12-10 14:11:03.590141302 +0100 2.7 ++++ main.c 2009-12-10 14:11:07.246237908 +0100 2.8 +@@ -1038,6 +1038,10 @@ 2.9 + ret=-1; 2.10 + my_argc=argc; my_argv=argv; 2.11 + 2.12 ++ /* if (!log_stderr), that's not usable yet! '/ 2.13 ++ /* ...so unconditionally log to syslog for now */ 2.14 ++ openlog(argv[0], LOG_PID|LOG_CONS, log_facility); 2.15 ++ 2.16 + /*init pkg mallocs (before parsing cfg or cmd line !)*/ 2.17 + if (init_pkg_mallocs()==-1) 2.18 + goto error00; 2.19 +@@ -1370,6 +1374,11 @@ 2.20 + 2.21 + /* init_daemon? */ 2.22 + if (!dont_fork){ 2.23 ++ /* shortly after main() we called openlog(3) to log */ 2.24 ++ /* the initialization, but since daemonize() has its */ 2.25 ++ /* own syslog(3) handling, we need to close the log first */ 2.26 ++ closelog(); /* close the initialization logging logic */ 2.27 ++ 2.28 + if ( daemonize((log_name==0)?argv[0]:log_name, &own_pgid) <0 ) 2.29 + goto error; 2.30 + } 2.31 Index: Makefile.defs 2.32 ---- Makefile.defs.orig 2009-03-23 19:32:01 +0100 2.33 -+++ Makefile.defs 2009-03-24 19:10:36 +0100 2.34 -@@ -1161,6 +1161,8 @@ 2.35 +diff -Nau Makefile.defs.orig Makefile.defs 2.36 +--- Makefile.defs.orig 2007-12-13 14:39:06.000000000 +0100 2.37 ++++ Makefile.defs 2008-01-14 16:48:02.811615000 +0100 2.38 +@@ -220,7 +220,7 @@ 2.39 + else 2.40 + doc-dir = doc/$(MAIN_NAME)/ 2.41 + man-dir = man/ 2.42 +- data-dir = $(MAIN_NAME)/ 2.43 ++ data-dir = share/$(MAIN_NAME)/ 2.44 + LOCALBASE ?= $(SYSBASE)/local 2.45 + endif 2.46 + endif 2.47 +@@ -1432,6 +1432,10 @@ 2.48 + LIBS+= -lsctp 2.49 + endif 2.50 2.51 - endif #mode=release 2.52 - 2.53 ++#conditionally add libfsl 2.54 +LDFLAGS += -L$(prefix)/lib 2.55 +LIBS += -lfsl 2.56 ++ 2.57 + ifneq ($(found_lock_method), yes) 2.58 + $(warning No locking method found so far, trying SYS V sems) 2.59 + DEFS+= -DUSE_SYSV_SEM # try sys v sems 2.60 +Index: scripts/opensipsctl.8 2.61 +diff -Nau scripts/opensipsctl.8.orig scripts/opensipsctl.8 2.62 +--- scripts/opensipsctl.8.orig 2009-03-25 00:22:16.771365571 +0100 2.63 ++++ scripts/opensipsctl.8 2009-03-25 00:22:34.295365555 +0100 2.64 +@@ -20,8 +20,6 @@ 2.65 2.66 - #*FLAGS used for compiling the modules 2.67 - ifeq ($(CC_NAME), gcc) 2.68 -@@ -1397,8 +1399,8 @@ 2.69 + .SH FILES 2.70 + .PD 0 2.71 +-.I /etc/opensips/.opensipsctlrc 2.72 +-.br 2.73 + .I /usr/local/etc/opensips/.opensipsctlrc 2.74 + .br 2.75 + .I ~/.opensipsctlrc 2.76 +Index: scripts/osipsconsole 2.77 +diff -Nau scripts/osipsconsole.orig scripts/osipsconsole 2.78 +--- scripts/osipsconsole.orig 2009-12-08 03:31:32.633224883 +0100 2.79 ++++ scripts/osipsconsole 2009-12-08 03:31:51.119960848 +0100 2.80 +@@ -30,7 +30,6 @@ 2.81 + use Term::ReadLine; 2.82 + use DBI; 2.83 + use POSIX; 2.84 +-use Frontier::RPC2; 2.85 + use IO::Socket; 2.86 + use Socket; 2.87 + #use Net::IP; 2.88 +@@ -378,6 +377,12 @@ 2.89 + } 2.90 + } 2.91 2.92 - #add libssl if needed 2.93 - ifneq ($(TLS),) 2.94 --DEFS+= -I$(LOCALBASE)/ssl/include -I$(LOCALBASE)/include -I$(SYSBASE)/include/openssl 2.95 --LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl -lcrypto 2.96 -+DEFS+= -I$(prefix)/include 2.97 -+LIBS+= -L$(prefix)/lib -lssl -lcrypto 2.98 - endif 2.99 - 2.100 - #add libsctp if needed 2.101 ++ if ( $MD5 eq "" ) { 2.102 ++ if ( $arr[0] =~ /^\s*MD5/ ) { 2.103 ++ $MD5 = $arr[1]; 2.104 ++ } 2.105 ++ } 2.106 ++ 2.107 + if ( $AWK eq "" ) { 2.108 + if ( $arr[0] =~ /^\s*AWK/ ) { 2.109 + $AWK = $arr[1]; 2.110 Index: modules/permissions/parse_config.c 2.111 ---- modules/permissions/parse_config.c.orig 2009-03-23 19:31:32 +0100 2.112 -+++ modules/permissions/parse_config.c 2009-03-24 19:10:36 +0100 2.113 +diff -Nau modules/permissions/parse_config.c.orig modules/permissions/parse_config.c 2.114 +--- modules/permissions/parse_config.c.orig 2008-08-03 15:54:01 +0200 2.115 ++++ modules/permissions/parse_config.c 2008-08-09 11:58:55 +0200 2.116 @@ -114,8 +114,11 @@ 2.117 except = strstr(str, " EXCEPT "); 2.118 if (except) { 2.119 @@ -48,18 +115,82 @@ 2.120 *e_exceptions = NULL; 2.121 } 2.122 2.123 -Index: rtpproxy-1.2.1/main.c 2.124 ---- rtpproxy-1.2.1/main.c.orig 2009-03-24 05:46:13 +0100 2.125 -+++ rtpproxy-1.2.1/main.c 2009-03-24 19:10:36 +0100 2.126 -@@ -88,7 +88,11 @@ 2.127 - bindhost = NULL; 2.128 - 2.129 - if ((n = resolve(ia, pf, bindhost, servname, AI_PASSIVE)) != 0) 2.130 -+#if defined(__sun__) 2.131 -+ errx(1, "setbindhost"); 2.132 -+#else 2.133 - errx(1, "setbindhost: %s", gai_strerror(n)); 2.134 -+#endif 2.135 +Index: modules/nathelper/nathelper.c 2.136 +diff -Nau modules/nathelper/nathelper.c.orig modules/nathelper/nathelper.c 2.137 +--- modules/nathelper/nathelper.c.orig 2010-12-20 14:33:50.000000000 +0100 2.138 ++++ modules/nathelper/nathelper.c 2011-01-26 17:48:40.685941382 +0100 2.139 +@@ -288,6 +288,9 @@ 2.140 + return 0; 2.141 } 2.142 2.143 - static void 2.144 ++/* MSvB macros */ 2.145 ++#define OPENSIPS_NOOP ((void)0) 2.146 ++ 2.147 + 2.148 + 2.149 + 2.150 +@@ -805,6 +808,7 @@ 2.151 + #define FIX_MEDIP 0x02 2.152 + #define ADD_ANORTPPROXY 0x04 2.153 + #define FIX_ORGIP 0x08 2.154 ++#define FIX_RTCPIP 0x10 2.155 + 2.156 + #define ADIRECTION "a=direction:active" 2.157 + #define ADIRECTION_LEN (sizeof(ADIRECTION) - 1) 2.158 +@@ -821,7 +825,9 @@ 2.159 + { 2.160 + char *buf; 2.161 + int offset; 2.162 ++ int binlump; 2.163 + struct lump* anchor; 2.164 ++ struct lump* templump; 2.165 + str omip, nip, oip; 2.166 + 2.167 + /* check that updating mediaip is really necessary */ 2.168 +@@ -852,7 +858,19 @@ 2.169 + memcpy(buf, CRLF, CRLF_LEN); 2.170 + memcpy(buf + CRLF_LEN, omip.s, omip.len); 2.171 + memcpy(buf + CRLF_LEN + omip.len, oldip->s, oldip->len); 2.172 +- if (insert_new_lump_after(anchor, buf, 2.173 ++ 2.174 ++ /* if the oldmediaip string is already */ 2.175 ++ /* in the body then don't add it again */ 2.176 ++ binlump = 0; 2.177 ++ for (templump = msg->body_lumps; templump; templump = templump->next) 2.178 ++ if (templump->op == LUMP_ADD && strstr(templump->u.value, buf)) 2.179 ++ binlump = 1; 2.180 ++ for (templump = msg->add_rm; templump; templump = templump->next) 2.181 ++ if (templump->op == LUMP_ADD && strstr(templump->u.value, buf)) 2.182 ++ binlump = 1; 2.183 ++ if (strstr(body->s, buf) || binlump) 2.184 ++ pkg_free(buf); 2.185 ++ else if (insert_new_lump_after(anchor, buf, 2.186 + omip.len + oldip->len + CRLF_LEN, 0) == NULL) { 2.187 + LM_ERR("insert_new_lump_after failed\n"); 2.188 + pkg_free(buf); 2.189 +@@ -1038,6 +1056,12 @@ 2.190 + p= p->next; 2.191 + } 2.192 + 2.193 ++ if (level & FIX_RTCPIP) { 2.194 ++ /* Iterate all a=rtcp: and replace ips in them. */ 2.195 ++ if (replace_sdp_ip(msg, &body, "a=rtcp:", str2?&ip:0)==-1) 2.196 ++ return -1; 2.197 ++ } 2.198 ++ 2.199 + return 1; 2.200 + } 2.201 + 2.202 +Index: parser/sdp/sdp_helpr_funcs.c 2.203 +diff -Nau parser/sdp/sdp_helpr_funcs.c.orig parser/sdp/sdp_helpr_funcs.c 2.204 +--- parser/sdp/sdp_helpr_funcs.c.orig 2010-12-08 15:14:06.000000000 +0100 2.205 ++++ parser/sdp/sdp_helpr_funcs.c 2011-01-27 00:39:50.128212053 +0100 2.206 +@@ -392,7 +392,7 @@ 2.207 + 2.208 + cp1 = NULL; 2.209 + for (cp = body->s; (len = body->s + body->len - cp) > 0;) { 2.210 +- cp1 = (char*)ser_memmem(cp, line, len, 2); 2.211 ++ cp1 = (char*)ser_memmem(cp, line, len, strlen(line)); 2.212 + if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r') 2.213 + break; 2.214 + cp = cp1 + 2;
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/opensips/opensips.patch.dict Wed Sep 21 14:04:16 2011 +0200 3.3 @@ -0,0 +1,20 @@ 3.4 +Index: etc/dictionary.opensips 3.5 +diff -Nau etc/dictionary.opensips.orig etc/dictionary.opensips 3.6 +--- etc/dictionary.opensips.orig 2011-01-15 08:08:46.712651102 +0100 3.7 ++++ etc/dictionary.opensips 2011-01-15 08:07:55.702748921 +0100 3.8 +@@ -14,6 +14,7 @@ 3.9 + 3.10 + 3.11 + #### Attributes ### 3.12 ++ATTRIBUTE Sip-Method 101 integer 3.13 + ATTRIBUTE Sip-Uri-User 208 string # Proprietary, auth_radius 3.14 + ATTRIBUTE Sip-Group 211 string # Proprietary, group_radius 3.15 + ATTRIBUTE Sip-Rpid 213 string # Proprietary, auth_radius 3.16 +@@ -23,6 +24,7 @@ 3.17 + 3.18 + ### Service-Type Values ### 3.19 + VALUE Service-Type Group-Check 12 # Proprietary, group_radius 3.20 ++VALUE Service-Type Sip-Session 15 3.21 + VALUE Service-Type SIP-Caller-AVPs 30 # Proprietary, avp_radius 3.22 + VALUE Service-Type SIP-Callee-AVPs 31 # Proprietary, avp_radius 3.23 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/opensips/opensips.patch.lcr Wed Sep 21 14:04:16 2011 +0200 4.3 @@ -0,0 +1,384 @@ 4.4 +Index: modules/lcr/lcr_mod.c 4.5 +diff -Nau modules/lcr/lcr_mod.c.orig modules/lcr/lcr_mod.c 4.6 +--- modules/lcr/lcr_mod.c.orig 2009-03-09 14:42:46.000000000 +0100 4.7 ++++ modules/lcr/lcr_mod.c 2009-03-24 22:50:37.363366116 +0100 4.8 +@@ -114,9 +114,18 @@ 4.9 + 4.10 + #define PRIORITY_COL "priority" 4.11 + 4.12 ++#define USER_COL "usid" 4.13 ++ 4.14 ++#define REALM_COL "realm" 4.15 ++ 4.16 ++#define PASSWD_COL "passwd" 4.17 ++ 4.18 + #define MAX_NO_OF_GWS 32 4.19 + #define MAX_NO_OF_LCRS 256 4.20 + #define MAX_PREFIX_LEN 256 4.21 ++#define MAX_USER_LEN 64 4.22 ++#define MAX_REALM_LEN 64 4.23 ++#define MAX_PASSWD_LEN 64 4.24 + #define MAX_TAG_LEN 16 4.25 + #define MAX_FROM_URI_LEN 256 4.26 + 4.27 +@@ -141,6 +150,12 @@ 4.28 + char tag[MAX_TAG_LEN + 1]; 4.29 + unsigned short tag_len; 4.30 + unsigned int flags; 4.31 ++ char user[MAX_USER_LEN]; 4.32 ++ unsigned short user_len; 4.33 ++ char realm[MAX_REALM_LEN]; 4.34 ++ unsigned short realm_len; 4.35 ++ char passwd[MAX_PASSWD_LEN]; 4.36 ++ unsigned short passwd_len; 4.37 + }; 4.38 + 4.39 + struct lcr_info { 4.40 +@@ -196,6 +211,9 @@ 4.41 + static str prefix_col = str_init(PREFIX_COL); 4.42 + static str from_uri_col = str_init(FROM_URI_COL); 4.43 + static str priority_col = str_init(PRIORITY_COL); 4.44 ++static str user_col = str_init(USER_COL); 4.45 ++static str realm_col = str_init(REALM_COL); 4.46 ++static str passwd_col = str_init(PASSWD_COL); 4.47 + 4.48 + /* timer */ 4.49 + int fr_inv_timer = DEF_FR_INV_TIMER; 4.50 +@@ -208,6 +226,9 @@ 4.51 + static char *contact_avp_param = NULL; 4.52 + static char *rpid_avp_param = NULL; 4.53 + static char *flags_avp_param = NULL; 4.54 ++static char *user_avp_param = NULL; 4.55 ++static char *realm_avp_param = NULL; 4.56 ++static char *passwd_avp_param = NULL; 4.57 + 4.58 + /* prefix mode */ 4.59 + int prefix_mode_param = DEF_PREFIX_MODE; 4.60 +@@ -239,6 +260,12 @@ 4.61 + static int_str rpid_avp; 4.62 + static int flags_avp_type; 4.63 + static int_str flags_avp; 4.64 ++static int user_avp_type; 4.65 ++static int_str user_avp; 4.66 ++static int realm_avp_type; 4.67 ++static int_str realm_avp; 4.68 ++static int passwd_avp_type; 4.69 ++static int_str passwd_avp; 4.70 + 4.71 + struct gw_info **gws; /* Pointer to current gw table pointer */ 4.72 + struct gw_info *gws_1; /* Pointer to gw table 1 */ 4.73 +@@ -327,6 +354,12 @@ 4.74 + {"fr_inv_timer", INT_PARAM, &fr_inv_timer }, 4.75 + {"fr_inv_timer_next", INT_PARAM, &fr_inv_timer_next }, 4.76 + {"prefix_mode", INT_PARAM, &prefix_mode_param }, 4.77 ++ {"user_column", STR_PARAM, &user_col.s }, 4.78 ++ {"realm_column", STR_PARAM, &realm_col.s }, 4.79 ++ {"passwd_column", STR_PARAM, &passwd_col.s }, 4.80 ++ {"auth_username_avp", STR_PARAM, &user_avp_param }, 4.81 ++ {"auth_realm_avp", STR_PARAM, &realm_avp_param }, 4.82 ++ {"auth_password_avp", STR_PARAM, &passwd_avp_param }, 4.83 + {0, 0, 0} 4.84 + }; 4.85 + 4.86 +@@ -438,6 +471,9 @@ 4.87 + prefix_col.len = strlen(prefix_col.s); 4.88 + from_uri_col.len = strlen(from_uri_col.s); 4.89 + priority_col.len = strlen(priority_col.s); 4.90 ++ user_col.len = strlen(user_col.s); 4.91 ++ realm_col.len = strlen(realm_col.s); 4.92 ++ passwd_col.len = strlen(passwd_col.s); 4.93 + 4.94 + /* Bind database */ 4.95 + if (lcr_db_bind(&db_url)) { 4.96 +@@ -563,6 +599,60 @@ 4.97 + return -1; 4.98 + } 4.99 + 4.100 ++ if (user_avp_param && *user_avp_param) { 4.101 ++ s.s = user_avp_param; s.len = strlen(s.s); 4.102 ++ if (pv_parse_spec(&s, &avp_spec)==0 4.103 ++ || avp_spec.type!=PVT_AVP) { 4.104 ++ LM_ERR("Malformed or non AVP definition <%s>\n", user_avp_param); 4.105 ++ return -1; 4.106 ++ } 4.107 ++ 4.108 ++ if(pv_get_avp_name(0, &(avp_spec.pvp), &user_avp, &avp_flags)!=0) { 4.109 ++ LM_ERR("Invalid AVP definition <%s>\n", user_avp_param); 4.110 ++ return -1; 4.111 ++ } 4.112 ++ user_avp_type = avp_flags; 4.113 ++ } else { 4.114 ++ LM_ERR("AVP user_avp has not been defined\n"); 4.115 ++ return -1; 4.116 ++ } 4.117 ++ 4.118 ++ if (realm_avp_param && *realm_avp_param) { 4.119 ++ s.s = realm_avp_param; s.len = strlen(s.s); 4.120 ++ if (pv_parse_spec(&s, &avp_spec)==0 4.121 ++ || avp_spec.type!=PVT_AVP) { 4.122 ++ LM_ERR("Malformed or non AVP definition <%s>\n", realm_avp_param); 4.123 ++ return -1; 4.124 ++ } 4.125 ++ 4.126 ++ if(pv_get_avp_name(0, &(avp_spec.pvp), &realm_avp, &avp_flags)!=0) { 4.127 ++ LM_ERR("Invalid AVP definition <%s>\n", realm_avp_param); 4.128 ++ return -1; 4.129 ++ } 4.130 ++ realm_avp_type = avp_flags; 4.131 ++ } else { 4.132 ++ LM_ERR("AVP realm_avp has not been defined\n"); 4.133 ++ return -1; 4.134 ++ } 4.135 ++ 4.136 ++ if (passwd_avp_param && *passwd_avp_param) { 4.137 ++ s.s = passwd_avp_param; s.len = strlen(s.s); 4.138 ++ if (pv_parse_spec(&s, &avp_spec)==0 4.139 ++ || avp_spec.type!=PVT_AVP) { 4.140 ++ LM_ERR("Malformed or non AVP definition <%s>\n", passwd_avp_param); 4.141 ++ return -1; 4.142 ++ } 4.143 ++ 4.144 ++ if(pv_get_avp_name(0, &(avp_spec.pvp), &passwd_avp, &avp_flags)!=0) { 4.145 ++ LM_ERR("Invalid AVP definition <%s>\n", passwd_avp_param); 4.146 ++ return -1; 4.147 ++ } 4.148 ++ passwd_avp_type = avp_flags; 4.149 ++ } else { 4.150 ++ LM_ERR("AVP passwd_avp has not been defined\n"); 4.151 ++ return -1; 4.152 ++ } 4.153 ++ 4.154 + /* Check table version */ 4.155 + db_con_t* dbh; 4.156 + if (lcr_dbf.init==0){ 4.157 +@@ -801,16 +891,17 @@ 4.158 + int reload_gws(void) 4.159 + { 4.160 + unsigned int i, port, strip, tag_len, prefix_len, from_uri_len, 4.161 +- grp_id, priority; 4.162 ++ user_len, realm_len, passwd_len, grp_id, priority; 4.163 + struct in_addr ip_addr; 4.164 + unsigned int flags; 4.165 + uri_type scheme; 4.166 + uri_transport transport; 4.167 + db_con_t* dbh; 4.168 + char *tag, *prefix, *from_uri; 4.169 ++ char *user, *realm, *passwd; 4.170 + db_res_t* res = NULL; 4.171 + db_row_t* row; 4.172 +- db_key_t gw_cols[8]; 4.173 ++ db_key_t gw_cols[11]; 4.174 + db_key_t lcr_cols[4]; 4.175 + 4.176 + gw_cols[0] = &ip_addr_col; 4.177 +@@ -823,6 +914,9 @@ 4.178 + in the two tables? (ge vw lcr) */ 4.179 + gw_cols[6] = &grp_id_col; 4.180 + gw_cols[7] = &flags_col; 4.181 ++ gw_cols[8] = &user_col; 4.182 ++ gw_cols[9] = &realm_col; 4.183 ++ gw_cols[10] = &passwd_col; 4.184 + 4.185 + lcr_cols[0] = &prefix_col; 4.186 + lcr_cols[1] = &from_uri_col; 4.187 +@@ -846,7 +940,7 @@ 4.188 + return -1; 4.189 + } 4.190 + 4.191 +- if (lcr_dbf.query(dbh, NULL, 0, NULL, gw_cols, 0, 8, 0, &res) < 0) { 4.192 ++ if (lcr_dbf.query(dbh, NULL, 0, NULL, gw_cols, 0, 11, 0, &res) < 0) { 4.193 + LM_ERR("Failed to query gw data\n"); 4.194 + lcr_dbf.close(dbh); 4.195 + return -1; 4.196 +@@ -938,6 +1032,45 @@ 4.197 + lcr_dbf.close(dbh); 4.198 + return -1; 4.199 + } 4.200 ++ if (VAL_NULL(ROW_VALUES(row) + 8) == 1) { 4.201 ++ user_len = 0; 4.202 ++ user = (char *)0; 4.203 ++ } else { 4.204 ++ user = (char *)VAL_STRING(ROW_VALUES(row) + 8); 4.205 ++ user_len = strlen(user); 4.206 ++ if (user_len > MAX_USER_LEN) { 4.207 ++ LM_ERR("Too long gw user <%u>\n", user_len); 4.208 ++ lcr_dbf.free_result(dbh, res); 4.209 ++ lcr_dbf.close(dbh); 4.210 ++ return -1; 4.211 ++ } 4.212 ++ } 4.213 ++ if (VAL_NULL(ROW_VALUES(row) + 9) == 1) { 4.214 ++ realm_len = 0; 4.215 ++ realm = (char *)0; 4.216 ++ } else { 4.217 ++ realm = (char *)VAL_STRING(ROW_VALUES(row) + 9); 4.218 ++ realm_len = strlen(realm); 4.219 ++ if (realm_len > MAX_REALM_LEN) { 4.220 ++ LM_ERR("Too long gw realm <%u>\n", realm_len); 4.221 ++ lcr_dbf.free_result(dbh, res); 4.222 ++ lcr_dbf.close(dbh); 4.223 ++ return -1; 4.224 ++ } 4.225 ++ } 4.226 ++ if (VAL_NULL(ROW_VALUES(row) + 10) == 1) { 4.227 ++ passwd_len = 0; 4.228 ++ passwd = (char *)0; 4.229 ++ } else { 4.230 ++ passwd = (char *)VAL_STRING(ROW_VALUES(row) + 10); 4.231 ++ passwd_len = strlen(passwd); 4.232 ++ if (passwd_len > MAX_PASSWD_LEN) { 4.233 ++ LM_ERR("Too long gw passwd <%u>\n", passwd_len); 4.234 ++ lcr_dbf.free_result(dbh, res); 4.235 ++ lcr_dbf.close(dbh); 4.236 ++ return -1; 4.237 ++ } 4.238 ++ } 4.239 + if (*gws == gws_1) { 4.240 + gws_2[i].ip_addr = (unsigned int)ip_addr.s_addr; 4.241 + gws_2[i].port = port; 4.242 +@@ -949,6 +1082,15 @@ 4.243 + gws_2[i].tag_len = tag_len; 4.244 + if (tag_len) 4.245 + memcpy(&(gws_2[i].tag[0]), tag, tag_len); 4.246 ++ gws_2[i].user_len = user_len; 4.247 ++ if (user_len) 4.248 ++ memcpy(&(gws_2[i].user[0]), user, user_len); 4.249 ++ gws_2[i].realm_len = realm_len; 4.250 ++ if (realm_len) 4.251 ++ memcpy(&(gws_2[i].realm[0]), realm, realm_len); 4.252 ++ gws_2[i].passwd_len = passwd_len; 4.253 ++ if (passwd_len) 4.254 ++ memcpy(&(gws_2[i].passwd[0]), passwd, passwd_len); 4.255 + } else { 4.256 + gws_1[i].ip_addr = (unsigned int)ip_addr.s_addr; 4.257 + gws_1[i].port = port; 4.258 +@@ -960,6 +1102,15 @@ 4.259 + gws_1[i].tag_len = tag_len; 4.260 + if (tag_len) 4.261 + memcpy(&(gws_1[i].tag[0]), tag, tag_len); 4.262 ++ gws_1[i].user_len = user_len; 4.263 ++ if (user_len) 4.264 ++ memcpy(&(gws_1[i].user[0]), user, user_len); 4.265 ++ gws_1[i].realm_len = realm_len; 4.266 ++ if (realm_len) 4.267 ++ memcpy(&(gws_1[i].realm[0]), realm, realm_len); 4.268 ++ gws_1[i].passwd_len = passwd_len; 4.269 ++ if (passwd_len) 4.270 ++ memcpy(&(gws_1[i].passwd[0]), passwd, passwd_len); 4.271 + } 4.272 + } 4.273 + 4.274 +@@ -1141,6 +1292,21 @@ 4.275 + attr = add_mi_attr(node, MI_DUP_VALUE, "FLAGS", 5, p, len); 4.276 + if(attr == NULL) 4.277 + return -1; 4.278 ++ 4.279 ++ attr = add_mi_attr(node, MI_DUP_VALUE, "USER", 6, 4.280 ++ (*gws)[i].user, (*gws)[i].user_len ); 4.281 ++ if(attr == NULL) 4.282 ++ return -1; 4.283 ++ 4.284 ++ attr = add_mi_attr(node, MI_DUP_VALUE, "REALM", 6, 4.285 ++ (*gws)[i].realm, (*gws)[i].realm_len ); 4.286 ++ if(attr == NULL) 4.287 ++ return -1; 4.288 ++ 4.289 ++ attr = add_mi_attr(node, MI_DUP_VALUE, "PASSWD", 6, 4.290 ++ (*gws)[i].passwd, (*gws)[i].passwd_len ); 4.291 ++ if(attr == NULL) 4.292 ++ return -1; 4.293 + } 4.294 + 4.295 + for (i = 0; i < MAX_NO_OF_LCRS; i++) { 4.296 +@@ -1184,6 +1350,9 @@ 4.297 + char ruri[MAX_URI_SIZE]; 4.298 + unsigned int i, j, k, index, addr, port, strip, gw_index, 4.299 + duplicated_gw, flags, have_rpid_avp; 4.300 ++ char *user; 4.301 ++ char *realm; 4.302 ++ char *passwd; 4.303 + uri_type scheme; 4.304 + uri_transport transport; 4.305 + struct ip_addr address; 4.306 +@@ -1407,6 +1576,9 @@ 4.307 + transport = (*gws)[index].transport; 4.308 + flags = (*gws)[index].flags; 4.309 + strip = (*gws)[index].strip; 4.310 ++ user = (*gws)[index].user; 4.311 ++ realm = (*gws)[index].realm; 4.312 ++ passwd = (*gws)[index].passwd; 4.313 + if (strip > ruri_user.len) { 4.314 + LM_ERR("Strip count of gw is too large <%u>\n", strip); 4.315 + goto skip; 4.316 +@@ -1476,6 +1648,25 @@ 4.317 + val.s = value; 4.318 + add_avp(gw_uri_avp_type|AVP_VAL_STR, gw_uri_avp, val); 4.319 + LM_DBG("Added gw_uri_avp <%.*s>\n", value.len, value.s); 4.320 ++ 4.321 ++ value.s = user; 4.322 ++ value.len = strlen(value.s); 4.323 ++ val.s = value; 4.324 ++ add_avp(user_avp_type|AVP_VAL_STR, user_avp, val); 4.325 ++ LM_DBG("Added user_avp <%.*s>\n", value.len, value.s); 4.326 ++ 4.327 ++ value.s = realm; 4.328 ++ value.len = strlen(value.s); 4.329 ++ val.s = value; 4.330 ++ add_avp(realm_avp_type|AVP_VAL_STR, realm_avp, val); 4.331 ++ LM_DBG("Added realm_avp <%.*s>\n", value.len, value.s); 4.332 ++ 4.333 ++ value.s = passwd; 4.334 ++ value.len = strlen(value.s); 4.335 ++ val.s = value; 4.336 ++ add_avp(passwd_avp_type|AVP_VAL_STR, passwd_avp, val); 4.337 ++ LM_DBG("Added passwd_avp <%.*s>\n", value.len, value.s); 4.338 ++ 4.339 + skip: 4.340 + continue; 4.341 + } 4.342 +@@ -1558,7 +1749,8 @@ 4.343 + static int next_gw(struct sip_msg* _m, char* _s1, char* _s2) 4.344 + { 4.345 + int_str gw_uri_val, ruri_user_val, val; 4.346 +- struct usr_avp *gu_avp, *ru_avp; 4.347 ++ int_str user_val, realm_val, passwd_val; 4.348 ++ struct usr_avp *gu_avp, *ru_avp, *usr_avp, *rlm_avp, *pwd_avp; 4.349 + int rval; 4.350 + str new_ruri; 4.351 + char *at, *at_char, *strip_char, *endptr; 4.352 +@@ -1575,6 +1767,35 @@ 4.353 + gw_uri_val.s.len = gw_uri_val.s.len - (at - gw_uri_val.s.s); 4.354 + gw_uri_val.s.s = at; 4.355 + 4.356 ++ /* Save gateway AVPs for use in script */ 4.357 ++ usr_avp = search_first_avp(user_avp_type, user_avp, &user_val, 0); 4.358 ++ rlm_avp = search_first_avp(realm_avp_type, realm_avp, &realm_val, 0); 4.359 ++ pwd_avp = search_first_avp(passwd_avp_type, passwd_avp, &passwd_val, 0); 4.360 ++ if (!usr_avp) { 4.361 ++ LM_DBG("User AVP no set\n"); 4.362 ++ return -1; 4.363 ++ } 4.364 ++ else { 4.365 ++ add_avp(user_avp_type|AVP_VAL_STR, user_avp, user_val); 4.366 ++ LM_DBG("Added user_avp <%.*s>\n", user_val.s.len, user_val.s.s); 4.367 ++ } 4.368 ++ if (!rlm_avp) { 4.369 ++ LM_DBG("Realm AVP no set\n"); 4.370 ++ return -1; 4.371 ++ } 4.372 ++ else { 4.373 ++ add_avp(realm_avp_type|AVP_VAL_STR, realm_avp, realm_val); 4.374 ++ LM_DBG("Added realm_avp <%.*s>\n", realm_val.s.len, realm_val.s.s); 4.375 ++ } 4.376 ++ if (!pwd_avp) { 4.377 ++ LM_DBG("Passwd AVP no set\n"); 4.378 ++ return -1; 4.379 ++ } 4.380 ++ else { 4.381 ++ add_avp(passwd_avp_type|AVP_VAL_STR, passwd_avp, passwd_val); 4.382 ++ LM_DBG("Added passwd_avp <%.*s>\n", passwd_val.s.len, passwd_val.s.s); 4.383 ++ } 4.384 ++ 4.385 + /* Create new Request-URI taking URI user from ruri_user AVP 4.386 + and other parts of from gateway URI AVP. */ 4.387 + ru_avp = search_first_avp(ruri_user_avp_type, ruri_user_avp,
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/opensips/opensips.patch.reg Wed Sep 21 14:04:16 2011 +0200 5.3 @@ -0,0 +1,85 @@ 5.4 +Index: modules/registrar/save.c 5.5 +diff -Nau modules/registrar/save.c.orig modules/registrar/save.c 5.6 +--- modules/registrar/save.c.orig 2008-08-03 15:53:57.000000000 +0200 5.7 ++++ modules/registrar/save.c 2009-03-24 21:44:46.182865192 +0100 5.8 +@@ -76,7 +76,7 @@ 5.9 + struct save_ctx { 5.10 + unsigned int flags; 5.11 + str aor; 5.12 +- unsigned int max_contacts; 5.13 ++ int max_contacts; 5.14 + }; 5.15 + 5.16 + 5.17 +@@ -388,7 +388,7 @@ 5.18 + if (e == 0) 5.19 + continue; 5.20 + 5.21 +- if (_sctx->max_contacts && (num >= _sctx->max_contacts)) { 5.22 ++ if (_sctx->max_contacts && (num >= abs(_sctx->max_contacts))) { 5.23 + if (_sctx->flags®_SAVE_FORCE_REG_FLAG) { 5.24 + /* we are overflowing the number of maximum contacts, 5.25 + so remove the first (oldest) one to prevent this */ 5.26 +@@ -494,6 +494,7 @@ 5.27 + contact_t* _c, struct save_ctx *_sctx) 5.28 + { 5.29 + ucontact_info_t *ci; 5.30 ++ ucontact_t *ucon = 0; 5.31 + ucontact_t* c; 5.32 + int e; 5.33 + unsigned int cflags; 5.34 +@@ -554,7 +555,7 @@ 5.35 + continue; 5.36 + 5.37 + /* we need to add a new contact -> too many ?? */ 5.38 +- if (_sctx->max_contacts && num>=_sctx->max_contacts) { 5.39 ++ if (_sctx->max_contacts && num>=abs(_sctx->max_contacts)) { 5.40 + if (_sctx->flags®_SAVE_FORCE_REG_FLAG) { 5.41 + /* we are overflowing the number of maximum contacts, 5.42 + so remove the first (oldest) one to prevent this */ 5.43 +@@ -581,6 +582,23 @@ 5.44 + goto error; 5.45 + } 5.46 + 5.47 ++ /* remove matching contacts or matching Call-ID headers before */ 5.48 ++ /* inserting a new one if indicated by a negative max_contacts */ 5.49 ++ if (_sctx->max_contacts < 0) { 5.50 ++ for (ucon = _r->contacts; ucon; ucon = ucon->next) { 5.51 ++ if (((ci->callid->len == ucon->callid.len) && \ 5.52 ++ !memcmp(ci->callid->s, ucon->callid.s, ci->callid->len)) \ 5.53 ++ || \ 5.54 ++ ((_c->uri.len==ucon->c.len) && \ 5.55 ++ !memcmp(_c->uri.s, ucon->c.s, _c->len))) { 5.56 ++ if (ul.delete_ucontact(_r, ucon) < 0) { 5.57 ++ rerrno = R_UL_DEL_C; 5.58 ++ LM_ERR("failed to delete contact\n"); 5.59 ++ goto error; 5.60 ++ } 5.61 ++ } 5.62 ++ } 5.63 ++ } 5.64 + if (ul.insert_ucontact( _r, &_c->uri, ci, &c) < 0) { 5.65 + rerrno = R_UL_INS_C; 5.66 + LM_ERR("failed to insert contact\n"); 5.67 +Index: modules/registrar/sip_msg.c 5.68 +diff -Nau modules/registrar/sip_msg.c.orig modules/registrar/sip_msg.c 5.69 +--- modules/registrar/sip_msg.c.orig 2008-08-03 15:53:57.000000000 +0200 5.70 ++++ modules/registrar/sip_msg.c 2009-03-24 21:44:46.182865192 +0100 5.71 +@@ -137,7 +137,7 @@ 5.72 + /* Message without contacts is OK */ 5.73 + if (_m->contact == 0) return 0; 5.74 + 5.75 +- if (((contact_body_t*)_m->contact->parsed)->star == 1) { 5.76 ++ if (((contact_body_t*)_m->contact->parsed)->star == -1) { 5.77 + /* The first Contact HF is star */ 5.78 + /* Expires must be zero */ 5.79 + if (get_expires_hf(_m) > 0) { 5.80 +@@ -167,7 +167,7 @@ 5.81 + p = _m->contact->next; 5.82 + while(p) { 5.83 + if (p->type == HDR_CONTACT_T) { 5.84 +- if (((contact_body_t*)p->parsed)->star == 1) { 5.85 ++ if (((contact_body_t*)p->parsed)->star == -1) { 5.86 + rerrno = R_STAR_CONT; 5.87 + return 1; 5.88 + }
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/opensips/opensips.patch.rtpproxy Wed Sep 21 14:04:16 2011 +0200 6.3 @@ -0,0 +1,57 @@ 6.4 +Index: main.c 6.5 +diff -Nau main.c.orig main.c 6.6 +--- main.c.orig 2008-06-17 05:19:48 +0200 6.7 ++++ main.c 2008-08-09 11:58:55 +0200 6.8 +@@ -86,7 +86,11 @@ 6.9 + bindhost = NULL; 6.10 + 6.11 + if ((n = resolve(ia, pf, bindhost, servname, AI_PASSIVE)) != 0) 6.12 ++#if defined(__sun__) 6.13 ++ errx(1, "setbindhost"); 6.14 ++#else 6.15 + errx(1, "setbindhost: %s", gai_strerror(n)); 6.16 ++#endif 6.17 + } 6.18 + 6.19 + static void 6.20 +Index: rtpp_command.c 6.21 +diff -Nau rtpp_command.c.orig rtpp_command.c 6.22 +--- rtpp_command.c.orig 2009-03-25 02:53:17.397562078 +0100 6.23 ++++ rtpp_command.c 2009-03-25 02:52:59.126654989 +0100 6.24 +@@ -72,6 +72,36 @@ 6.25 + static void handle_query(struct cfg *, int, struct sockaddr_storage *, 6.26 + socklen_t, char *, struct rtpp_session *, int); 6.27 + 6.28 ++#if defined(__sun__) 6.29 ++static char 6.30 ++*strsep(char **stringp, const char *delim) 6.31 ++{ 6.32 ++ char *s; 6.33 ++ const char *spanp; 6.34 ++ int c, sc; 6.35 ++ char *tok; 6.36 ++ 6.37 ++ if ((s = *stringp) == NULL) 6.38 ++ return NULL; 6.39 ++ for (tok = s;;) { 6.40 ++ c = *s++; 6.41 ++ spanp = delim; 6.42 ++ do { 6.43 ++ if ((sc = *spanp++) == c) { 6.44 ++ if (c == 0) 6.45 ++ s = NULL; 6.46 ++ else 6.47 ++ s[-1] = 0; 6.48 ++ *stringp = s; 6.49 ++ return tok; 6.50 ++ } 6.51 ++ } while (sc != 0); 6.52 ++ } 6.53 ++ /* NOTREACHED */ 6.54 ++ return NULL; 6.55 ++} 6.56 ++ 6.57 ++#endif 6.58 + static int 6.59 + create_twinlistener(struct cfg *cf, struct sockaddr *ia, int port, int *fds) 6.60 + {
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/opensips/opensips.patch.save Wed Sep 21 14:04:16 2011 +0200 7.3 @@ -0,0 +1,42 @@ 7.4 +Index: modules/registrar/save.c 7.5 +diff -Nau modules/registrar/save.c.orig modules/registrar/save.c 7.6 +--- modules/registrar/save.c.orig 2008-03-07 14:12:56.307895000 +0100 7.7 ++++ modules/registrar/save.c 2008-03-08 00:03:02.436987000 +0100 7.8 +@@ -51,6 +51,7 @@ 7.9 + #include "../../ut.h" 7.10 + #include "../../qvalue.h" 7.11 + #include "../../dset.h" 7.12 ++#include "../../msg_translator.h" 7.13 + #ifdef USE_TCP 7.14 + #include "../../tcp_server.h" 7.15 + #endif 7.16 +@@ -687,9 +688,28 @@ 7.17 + contact_t* c; 7.18 + int st; 7.19 + str aor; 7.20 ++ unsigned int new_len = 0; 7.21 ++ struct sip_msg* sip_manip = 0; 7.22 + 7.23 + rerrno = R_FINE; 7.24 + 7.25 ++ /* make a cheap shallow copy of the incoming message */ 7.26 ++ sip_manip = (void*)pkg_malloc(sizeof(struct sip_msg)); 7.27 ++ if (sip_manip==0) { 7.28 ++ LM_ERR("no more pkg memory\n"); 7.29 ++ goto error; 7.30 ++ } 7.31 ++ memcpy(sip_manip,_m,sizeof(struct sip_msg)); 7.32 ++ 7.33 ++ /* incorporate changes made to the routing script so far, */ 7.34 ++ /* this mean that the so called 'lumps' will be processed */ 7.35 ++ sip_manip->buf = build_res_buf_from_sip_res(_m, &new_len); 7.36 ++ sip_manip->len = new_len; 7.37 ++ 7.38 ++ /* from here on, use the new refreshed message data as */ 7.39 ++ /* specifically manipulated according to the user's wish */ 7.40 ++ _m = sip_manip; /* only safe when passing by value */ 7.41 ++ 7.42 + if (parse_message(_m) < 0) { 7.43 + goto error; 7.44 + } 7.45 +Don't forget to free(3) the pkg_alloc(3) memory!!!
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/opensips/opensips.patch.uac Wed Sep 21 14:04:16 2011 +0200 8.3 @@ -0,0 +1,195 @@ 8.4 +Index: modules/uac/auth.c 8.5 +diff -Nau modules/uac/auth.c.orig modules/uac/auth.c 8.6 +--- modules/uac/auth.c.orig 2008-08-03 15:53:40.000000000 +0200 8.7 ++++ modules/uac/auth.c 2009-03-24 21:48:53.478867420 +0100 8.8 +@@ -143,14 +143,172 @@ 8.9 + HASHHEX response; 8.10 + str *new_hdr; 8.11 + 8.12 ++ /* pretransact */ 8.13 ++ int nret = 0; 8.14 ++ pv_value_t pv_val; 8.15 ++ str *newuri = 0; 8.16 ++ struct uac_credential *tst = 0; 8.17 ++ struct hdr_field *tmp_hdr = 0; 8.18 ++ struct hdr_field *del_hdr = 0; 8.19 ++ 8.20 ++ 8.21 ++ /* Goes something like this... */ 8.22 ++ /* HA1 = echo -n 'username:realm:password' | md5sum */ 8.23 ++ /* echo -n 'itsme:mydom.com:stupidpass' | md5sum */ 8.24 ++ /* HA2 = echo -n 'message:uri' | md5sum */ 8.25 ++ /* echo -n 'INVITE:sip:danc@ing.fool.es' | md5sum */ 8.26 ++ /* Response = echo -n 'HA1:nonce:HA2' | md5sum */ 8.27 + /* get transaction */ 8.28 + t = uac_tmb.t_gett(); 8.29 +- if (t==T_UNDEFINED || t==T_NULL_CELL) 8.30 +- { 8.31 +- LM_CRIT("no current transaction found\n"); 8.32 +- goto error; 8.33 +- } 8.34 ++ if (t==T_UNDEFINED || t==T_NULL_CELL) { 8.35 ++ /* begin without any transaction */ 8.36 ++ /* set relevant structure variables */ 8.37 ++ crd = 0; 8.38 ++ crd = pkg_malloc(sizeof(struct uac_credential)); 8.39 ++ if (!crd) { 8.40 ++ LM_ERR("no more pkg memory\n"); 8.41 ++ goto error; 8.42 ++ } 8.43 ++ 8.44 ++ /* set the realm from existing UAC message */ 8.45 ++ tmp_hdr = msg->proxy_auth; 8.46 ++ del_hdr = 0; 8.47 ++ while (tmp_hdr) { 8.48 ++ crd->realm.s = strchr(strstr(tmp_hdr->body.s, "realm="), '"') + 1; 8.49 ++ crd->realm.len = strchr(crd->realm.s, '"') - crd->realm.s; 8.50 ++ if(pv_get_spec_value(msg, &auth_realm_spec, &pv_val)==0 \ 8.51 ++ && pv_val.rs.len>0) /* ensure realm is the desired one */ 8.52 ++ if (strncmp(crd->realm.s, pv_val.rs.s, crd->realm.len)==0) 8.53 ++ del_hdr = tmp_hdr; 8.54 ++ tmp_hdr = tmp_hdr->sibling; 8.55 ++ } 8.56 ++ if (del_hdr) 8.57 ++ crd->realm = pv_val.rs; /* success */ 8.58 ++ else 8.59 ++ nret++; /* failure */ 8.60 ++ 8.61 ++ /* set username from new AVP proxy values */ 8.62 ++ if(pv_get_spec_value(msg, &auth_username_spec, &pv_val)!=0 \ 8.63 ++ || pv_val.flags&PV_VAL_NULL || pv_val.rs.len<=0) 8.64 ++ nret++; /* signal failure with nonzero value */ 8.65 ++ else 8.66 ++ crd->user = pv_val.rs; 8.67 ++ 8.68 ++ /* set password from new AVP proxy values */ 8.69 ++ if(pv_get_spec_value(msg, &auth_password_spec, &pv_val)!=0 \ 8.70 ++ || pv_val.flags&PV_VAL_NULL || pv_val.rs.len<=0) 8.71 ++ nret++; /* signal failure with nonzero value */ 8.72 ++ else 8.73 ++ crd->passwd = pv_val.rs; 8.74 ++ 8.75 ++ if (nret) { /* if not found, look into predefined credentials */ 8.76 ++ tst = uac_auth_api._lookup_realm(&crd->realm); 8.77 ++ 8.78 ++ if (tst==0) { /* found? */ 8.79 ++ LM_DBG("no credential for realm \"%.*s\"\n", \ 8.80 ++ crd->realm.len, crd->realm.s); 8.81 ++ pkg_free(crd); 8.82 ++ goto error; 8.83 ++ } 8.84 ++ 8.85 ++ crd = tst; /* use predefined credentials */ 8.86 ++ /* set the realm from existing UAC message */ 8.87 ++ tmp_hdr = msg->proxy_auth; 8.88 ++ del_hdr = 0; 8.89 ++ while (tmp_hdr) { 8.90 ++ if(pv_get_spec_value(msg, &auth_realm_spec, &pv_val)==0 \ 8.91 ++ && pv_val.rs.len>0) /* ensure realm is the desired one */ 8.92 ++ if (strncmp(crd->realm.s, pv_val.rs.s, crd->realm.len)==0) 8.93 ++ del_hdr = tmp_hdr; 8.94 ++ tmp_hdr = tmp_hdr->sibling; 8.95 ++ } 8.96 ++ if (del_hdr == 0) { /* proxy-auth header matching realm not found */ 8.97 ++ LM_DBG("no credential for realm \"%.*s\"\n", \ 8.98 ++ crd->realm.len, crd->realm.s); 8.99 ++ pkg_free(crd); 8.100 ++ goto error; 8.101 ++ } 8.102 ++ } 8.103 ++ 8.104 ++ /* set the uri from existing UAC message */ 8.105 ++ newuri = pkg_malloc(sizeof(str)); 8.106 ++ if (!newuri) { 8.107 ++ LM_ERR("no more pkg memory\n"); 8.108 ++ goto error; 8.109 ++ } 8.110 ++ newuri->s = pkg_malloc(msg->new_uri.len); 8.111 ++ if (!newuri->s) { 8.112 ++ LM_ERR("no more pkg memory\n"); 8.113 ++ pkg_free(newuri); 8.114 ++ goto error; 8.115 ++ } 8.116 ++ newuri->len = msg->new_uri.len; 8.117 ++ strncpy(newuri->s, msg->new_uri.s, msg->new_uri.len); 8.118 ++ if (!newuri->s) { 8.119 ++ LM_DBG("failed to retrieve URI from UAC message\n"); 8.120 ++ pkg_free(newuri->s); 8.121 ++ pkg_free(newuri); 8.122 ++ goto error; 8.123 ++ } 8.124 ++ 8.125 ++ /* set the nonce from existing UAC message */ 8.126 ++ tmp_hdr = msg->proxy_auth; 8.127 ++ auth->nonce.len = 0; 8.128 ++ auth->nonce.s = 0; 8.129 ++ while (tmp_hdr) { 8.130 ++ if(pv_get_spec_value(msg, &auth_realm_spec, &pv_val)==0 \ 8.131 ++ && pv_val.rs.len>0) /* ensure realm is the desired one */ 8.132 ++ if (strncmp(crd->realm.s, pv_val.rs.s, crd->realm.len)==0) { 8.133 ++ auth->nonce.s = strchr(strstr(tmp_hdr->body.s, "nonce="), '"') + 1; 8.134 ++ auth->nonce.len = strchr(auth->nonce.s, '"') - auth->nonce.s; 8.135 ++ } 8.136 ++ tmp_hdr = tmp_hdr->sibling; 8.137 ++ } 8.138 ++ if (auth->nonce.s == 0) { 8.139 ++ LM_DBG("failed to retrieve nonce from UAC message\n"); 8.140 ++ pkg_free(crd); 8.141 ++ goto error; 8.142 ++ } 8.143 ++ 8.144 ++ /* do authentication */ 8.145 ++ uac_auth_api._do_uac_auth(msg, newuri, crd, auth, &auth_nc_cnonce, response); 8.146 ++ if (response==0) { 8.147 ++ LM_ERR("failed to calculate challenge response\n"); 8.148 ++ pkg_free(crd); 8.149 ++ goto error; 8.150 ++ } 8.151 ++ 8.152 ++ /* build the authorization header */ 8.153 ++ new_hdr = uac_auth_api._build_authorization_hdr(407, newuri, crd, auth, &auth_nc_cnonce, response); 8.154 ++ if (new_hdr==0) { 8.155 ++ LM_ERR("failed to build authorization hdr\n"); 8.156 ++ pkg_free(crd); 8.157 ++ goto error; 8.158 ++ } 8.159 ++ 8.160 ++ /* remove the old proxy-auth header and relink message index */ 8.161 ++ /* before updating the authorization credentials of the message */ 8.162 ++ if (del_hdr) { /* updated a record and must remove the old one */ 8.163 ++ if (del_lump(msg, del_hdr->name.s - msg->buf, del_hdr->len, 0)==0) { 8.164 ++ LM_ERR("can't remove credentials\n"); 8.165 ++ pkg_free(crd); 8.166 ++ goto error; 8.167 ++ } 8.168 ++ } 8.169 ++ 8.170 ++ /* so far, so good -> add the header and set the proper RURI */ 8.171 ++ if (apply_urihdr_changes(msg, newuri, new_hdr)<0) 8.172 ++ { 8.173 ++ LM_ERR("failed to apply changes\n"); 8.174 ++ pkg_free(crd); 8.175 ++ goto error; 8.176 ++ } 8.177 ++ 8.178 ++ pkg_free(crd); /* finished calculating new response string, success */ 8.179 ++ return 0; 8.180 ++ } /* if (t==T_UNDEFINED || t==T_NULL_CELL) */ 8.181 + 8.182 ++ /* begin with transaction reply */ 8.183 + /* get the selected branch */ 8.184 + branch = uac_tmb.t_get_picked(); 8.185 + if (branch<0) { 8.186 +Index: modules/uac/uac.c 8.187 +diff -Nau modules/uac/uac.c.orig modules/uac/uac.c 8.188 +--- modules/uac/uac.c.orig 2008-08-03 15:53:40.000000000 +0200 8.189 ++++ modules/uac/uac.c 2009-03-24 21:49:48.922890737 +0100 8.190 +@@ -117,7 +117,7 @@ 8.191 + REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE }, 8.192 + {"uac_auth", (cmd_function)w_uac_auth, 0, 8.193 + 0, 0, 8.194 +- FAILURE_ROUTE }, 8.195 ++ REQUEST_ROUTE|FAILURE_ROUTE }, 8.196 + {0,0,0,0,0,0} 8.197 + }; 8.198 +
9.1 --- a/opensips/opensips.spec Wed Sep 21 14:02:13 2011 +0200 9.2 +++ b/opensips/opensips.spec Wed Sep 21 14:04:16 2011 +0200 9.3 @@ -1,6 +1,6 @@ 9.4 ## 9.5 ## opensips.spec -- OpenPKG RPM Package Specification 9.6 -## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/> 9.7 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 9.8 ## 9.9 ## Permission to use, copy, modify, and distribute this software for 9.10 ## any purpose with or without fee is hereby granted, provided that 9.11 @@ -22,40 +22,62 @@ 9.12 ## 9.13 9.14 # package options 9.15 -%define V_opensips 1.6.4 9.16 %define V_rtpproxy 1.2.1 9.17 9.18 # package information 9.19 Name: opensips 9.20 -Summary: Open SIP Server 9.21 +Summary: Open SIP Router 9.22 URL: http://www.opensips.org/ 9.23 -Vendor: FhG FOKUS et al. 9.24 +Vendor: Voice System SRL 9.25 Packager: OpenPKG Foundation e.V. 9.26 Distribution: OpenPKG Community 9.27 Class: PLUS 9.28 Group: VoIP 9.29 License: GPL 9.30 -Version: %{V_opensips} 9.31 -Release: 20101221 9.32 +Version: 1.7.0 9.33 +Release: 20110912 9.34 9.35 # package options 9.36 -%option with_fsl yes 9.37 -%option with_ssl no 9.38 +%option with_cons yes 9.39 +%option with_fsl yes 9.40 +%option with_ssl yes 9.41 +%option with_sctp no 9.42 +%option with_json no 9.43 +%option with_croute no 9.44 +%option with_ldap no 9.45 +%option with_memcached no 9.46 +%option with_radius no 9.47 +%option with_snmp no 9.48 +%option with_bdb no 9.49 +%option with_mysql no 9.50 +%option with_osp no 9.51 +%option with_pgsql no 9.52 +%option with_odbc no 9.53 +%option with_geoip no 9.54 +%option with_dbgmem no 9.55 9.56 # list of sources 9.57 -Source0: http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{V_opensips}-tls_src.tar.gz 9.58 -Source1: http://b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz 9.59 +Source0: http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{version}_src.tar.gz 9.60 +Source1: http://www.b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz 9.61 Source2: rc.opensips 9.62 Source3: fsl.opensips 9.63 Source4: opensips.cfg 9.64 -Source5: opensips.schema-dbtext.txt 9.65 Patch0: opensips.patch 9.66 +Patch1: opensips.patch.dict 9.67 +Patch2: opensips.patch.uac 9.68 +Patch3: opensips.patch.reg 9.69 +Patch4: opensips.patch.rtpproxy 9.70 9.71 # build information 9.72 -BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, flex, bison, sed 9.73 -PreReq: OpenPKG, openpkg >= 20100101 9.74 -BuildPreReq: pcre 9.75 -PreReq: pcre 9.76 +Prefix: %{l_prefix} 9.77 +BuildRoot: %{l_buildroot} 9.78 +BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, flex, bison, sed 9.79 +PreReq: OpenPKG, openpkg >= 20060823, bash 9.80 +BuildPreReq: libxml, expat, curl, pkgconfig 9.81 +PreReq: libxml, expat, curl 9.82 +%if "%{with_cons}" == "yes" 9.83 +PreReq: perl-dbi, perl-term 9.84 +%endif 9.85 %if "%{with_fsl}" == "yes" 9.86 BuildPreReq: fsl 9.87 PreReq: fsl 9.88 @@ -64,22 +86,91 @@ 9.89 BuildPreReq: openssl 9.90 PreReq: openssl 9.91 %endif 9.92 +%if "%{with_croute}" == "yes" 9.93 +BuildPreReq: confuse 9.94 +PreReq: confuse 9.95 +%endif 9.96 +%if "%{with_json}" == "yes" 9.97 +BuildPreReq: json 9.98 +PreReq: json 9.99 +%endif 9.100 +%if "%{with_ldap}" == "yes" 9.101 +BuildPreReq: openldap 9.102 +PreReq: openldap 9.103 +%endif 9.104 +%if "%{with_memcached}" == "yes" 9.105 +BuildPreReq: memcached 9.106 +PreReq: memcached 9.107 +%endif 9.108 +%if "%{with_osp}" == "yes" 9.109 +BuildPreReq: osptoolkit 9.110 +PreReq: osptoolkit 9.111 +%endif 9.112 +%if "%{with_radius}" == "yes" 9.113 +BuildPreReq: radiusclient 9.114 +PreReq: radiusclient 9.115 +%endif 9.116 +%if "%{with_snmp}" == "yes" 9.117 +BuildPreReq: snmp 9.118 +PreReq: snmp 9.119 +%endif 9.120 +%if "%{with_bdb}" == "yes" 9.121 +BuildPreReq: db 9.122 +PreReq: db 9.123 +%endif 9.124 +%if "%{with_mysql}" == "yes" 9.125 +BuildPreReq: mysql 9.126 +PreReq: mysql 9.127 +%endif 9.128 +%if "%{with_pgsql}" == "yes" 9.129 +BuildPreReq: postgresql 9.130 +PreReq: postgresql 9.131 +%endif 9.132 +%if "%{with_odbc}" == "yes" 9.133 +BuildPreReq: unixodbc 9.134 +PreReq: unixodbc 9.135 +%endif 9.136 +%if "%{with_geoip}" == "yes" 9.137 +BuildPreReq: geoip 9.138 +PreReq: geoip 9.139 +%endif 9.140 +AutoReq: no 9.141 +AutoReqProv: no 9.142 9.143 %description 9.144 OpenSIPS is (beside Kamailio) a successor to OpenSER, which in 9.145 - turn was spawned from FhG FOKUS' SIP Express Router (SER). It 9.146 + turn was spawned from FhG FOKUS's SIP Express Router (SER). It 9.147 provides SIP (RFC3621) registrar, proxy and routing functionality. 9.148 - A C shell like scripting language provides full control over the 9.149 - server's behaviour. It's modular architecture allows only required 9.150 - functionality to be loaded. 9.151 + A C shell like scripting language provides for control over the 9.152 + server's behaviour. It's modular architecture allows for fine 9.153 + grained loading of required functionality. 9.154 + 9.155 + The third party Sippy RTPproxy from http://www.rtpproxy.org/ 9.156 + is included to make communication between SIP user agents 9.157 + behind NATs (Network Address Translators) possible. 9.158 + 9.159 + OpenSIPS can be used as a: OpenSIPS fits in scenarios: 9.160 + 9.161 + Registrar server SIP trunking 9.162 + Router, proxy SIP load balancing 9.163 + Redirect server SIP front end termination 9.164 + Presence agent Residential providers 9.165 + Back to back user agent white label solutions 9.166 + Instant messaging server Enterprise services 9.167 + SIP to SMS gateway LCR for multi gateways 9.168 + SIP to XMPP gateway 9.169 + Load balancer or dispatcher 9.170 + Front end for asterisk 9.171 + NAT traversal unit 9.172 + Application server 9.173 9.174 %track 9.175 prog opensips = { 9.176 - version = %{V_opensips} 9.177 + version = %{version} 9.178 url = http://www.opensips.org/pub/opensips/ 9.179 regex = (\d+\.\d+\.\d+)/ 9.180 url = http://www.opensips.org/pub/opensips/__NEWVER__/src/ 9.181 - regex = opensips-(__VER__)-tls_src\.tar\.gz 9.182 + regex = opensips-(__VER__)_src\.tar\.gz 9.183 } 9.184 prog opensips:rtpproxy = { 9.185 version = %{V_rtpproxy} 9.186 @@ -91,11 +182,267 @@ 9.187 %setup -q -n opensips-%{version}-tls 9.188 %setup -q -n opensips-%{version}-tls -T -D -a 1 9.189 %patch -p0 9.190 + %patch -p0 -P 1 9.191 + %patch -p0 -P 2 9.192 + %patch -p0 -P 3 9.193 + ( cd rtpproxy-%{V_rtpproxy} 9.194 + %patch -p0 -P 4 9.195 + ) || exit $? 9.196 + %{l_shtool} subst \ 9.197 + -e 's;^#! */bin/sh;#! %{l_prefix}/bin/bash;' \ 9.198 + scripts/opensipsctl 9.199 + %{l_shtool} subst \ 9.200 + -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \ 9.201 + modules/seas/doc/xml2sgml.sh \ 9.202 + scripts/opensipsdbctl \ 9.203 + test/* 9.204 + %{l_shtool} subst \ 9.205 +%if "%{with_dbgmem}" == "yes" 9.206 + -e 's;\(-DF_MALLOC\);#\1;' \ 9.207 + -e 's;#\(-DDBG_QM_MALLOC\);\1;' \ 9.208 +%endif 9.209 + -e 's;\(#define PKG_MEM_POOL_SIZE\) \(1024\*1024\);\1 8*\2;' \ 9.210 + Makefile.defs \ 9.211 + config.h 9.212 + %{l_shtool} subst \ 9.213 +%if "%{with_fsl}" == "yes" 9.214 + -e 's;@fslldflags@;-L$(prefix)/lib;g' \ 9.215 + -e 's;@fsllibs@;-lfsl;g' \ 9.216 +%else 9.217 + -e 's;@fslldflags@;;g' \ 9.218 + -e 's;@fsllibs@;;g' \ 9.219 +%endif 9.220 + -e 's;^\(DEFS+= -I\)\$(LOCALBASE).*;\1$(prefix)/include;' \ 9.221 + -e 's;^\(DEFS+= -L\)\$(LOCALBASE).*;\1$(prefix)/lib -lssl -lcrypto;' \ 9.222 + -e 's;^SVNVERSION *=.*;;g' \ 9.223 + -e 's;^DBHTML2TXT *=.*;;g' \ 9.224 + -e 's;^DBXML2PDF *=.*;;g' \ 9.225 + -e 's;lib64;lib;' \ 9.226 + Makefile.defs 9.227 + %{l_shtool} subst \ 9.228 + -e 's;\(radiusclient\)-ng;\1;g' \ 9.229 + modules/aaa_radius/aaa_radius.c \ 9.230 + modules/aaa_radius/rad.c \ 9.231 + Makefile.defs 9.232 + %{l_shtool} subst \ 9.233 + -e 's;\(\$(data-dir)\)/\(dbtext\)/opensips;\1/\2;g' \ 9.234 + -e 's;\(\$(data-dir)\)/\(db_berkeley\)/opensips;\1/\2;g' \ 9.235 + -e 's;\(/usr/local/etc/opensips\);\1/*;g' \ 9.236 + -e 's;\(s#/usr/local/sbin\)#;\1/*#;g' \ 9.237 + -e 's;\(s#/usr/share/doc/$(NAME)/#$(doc-target)\)#;\1/#;g' \ 9.238 + -e 's;\(\$(MAKE).*\) \(install_module_custom\);\1 makefile_defs=0 \2;' \ 9.239 + Makefile 9.240 + %{l_shtool} subst \ 9.241 + -e 's;^\(LIBS=\).*;\1-L`%{l_prefix}/bin/pkg-config --libs db`;' \ 9.242 + utils/db_berkeley/Makefile 9.243 + %{l_shtool} subst \ 9.244 + -e 's;/usr/share/doc/opensips/AUTHORS;%{l_prefix}/share/opensips/doc/AUTHORS;' \ 9.245 + scripts/opensipsctl.8 9.246 + %{l_shtool} subst \ 9.247 + -e 's;\(ETCDIR=".*\)/"$;\1";' \ 9.248 + -e 's;\(ETCDIR="\)/usr/local/\(etc/opensips"\);\1%{l_prefix}/\2;' \ 9.249 + -e 's;\. /etc/opensips/opensipsctlrc;true;' \ 9.250 + -e 's;\. ~/.opensipsctlrc;true;' \ 9.251 + -e 's;/usr/local\(/lib/opensips/opensipsctl\);%{l_prefix}\1;' \ 9.252 + -e 's;/usr/local/\(etc/opensips/opensipsctlrc\);%{l_prefix}/\1;' \ 9.253 + -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \ 9.254 + scripts/opensipsdbctl \ 9.255 + scripts/opensipsctl 9.256 + %{l_shtool} subst \ 9.257 + -e 's;\(DB_PATH="\)[^"][^"]*;\1%{l_prefix}/var/opensips/db;' \ 9.258 + scripts/osipsconsolerc \ 9.259 + scripts/opensipsctlrc 9.260 + %{l_shtool} subst \ 9.261 + -e 's;=/var/run/\(opensips.pid\);=%{l_prefix}/var/opensips/\1;g' \ 9.262 + -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;g' \ 9.263 + -e 's;\(my \$fifo_reply_path\) = "/tmp/";\1 = "%{l_prefix}/var/opensips/";' \ 9.264 + -e 's;\(my \$HISTORY_FILE\) = "/tmp/osipsconsole_history";\1 = "%{l_prefix}/var/opensips/osipsconsole_history";' \ 9.265 + scripts/opensipsctl \ 9.266 + scripts/opensipsctlrc \ 9.267 + scripts/osipsconsole \ 9.268 + scripts/osipsconsolerc 9.269 + %{l_shtool} subst \ 9.270 + -e 's;/usr/local;;g' \ 9.271 + -e 's;\(/etc/opensips/\)\.\(opensipsctlrc\);%{l_prefix}\1\2;g' \ 9.272 + scripts/opensipsctl.8 9.273 + %{l_shtool} subst \ 9.274 + -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;' \ 9.275 + scripts/opensipsctl.base 9.276 + %{l_shtool} subst \ 9.277 + -e 's;\(path=\)\$CHROOT_DIR/tmp/\(\$name\);\1${OSER_FIRET}/\2;g' \ 9.278 + scripts/opensipsctl.fifo 9.279 + %{l_shtool} subst \ 9.280 + -e 's;/usr/local/share/opensips/dbtext/opensips;%{l_prefix}/var/opensips/db;' \ 9.281 + scripts/opensipsctl.dbtext 9.282 + %{l_shtool} subst \ 9.283 + -e 's;\(DB_PATH="\)[^"][^"]*;%{l_prefix}/var/opensips/db_berkeley;' \ 9.284 + scripts/opensipsctl.db_berkeley 9.285 + %{l_shtool} subst \ 9.286 + -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \ 9.287 + scripts/opensipsctl \ 9.288 + scripts/opensipsdbctl.base 9.289 + %{l_shtool} subst \ 9.290 + -e 's;/usr/local/etc/opensips/dbtext;%{l_prefix}/var/opensips/db;' \ 9.291 + -e 's;\(\$DATA_DIR/dbtext\)/opensips;\1;g' \ 9.292 + scripts/opensipsdbctl.dbtext 9.293 + %{l_shtool} subst \ 9.294 + -e 's;\(DATA_DIR="\)[^"][^"]*;\1%{l_prefix}/share/opensips;' \ 9.295 + scripts/opensipsdbctl.dbtext \ 9.296 + scripts/opensipsdbctl.oracle 9.297 + %{l_shtool} subst \ 9.298 + -e 's;/usr/local/etc/opensips/db_berkeley;%{l_prefix}/var/opensips/db_berkeley;' \ 9.299 + -e 's;/usr/local/BerkeleyDB.[^/][^/]*/bin;%{l_prefix}/bin;' \ 9.300 + scripts/opensipsdbctl.db_berkeley 9.301 + %{l_shtool} subst \ 9.302 + -e 's;/usr/local/\(share/opensips\);%{l_prefix}/\1;' \ 9.303 + scripts/opensipsdbctl.db_berkeley \ 9.304 + scripts/opensipsdbctl.mysql \ 9.305 + scripts/opensipsdbctl.pgsql 9.306 + %{l_shtool} subst \ 9.307 + -e 's;\(script_flags(int\));\1,null);' \ 9.308 + scripts/dbtext/opensips/dialog 9.309 + %{l_shtool} subst \ 9.310 + -e 's;body(string);body(blob);' \ 9.311 + -e 's;sender(string);sender(string,null);' \ 9.312 + scripts/dbtext/opensips/presentity 9.313 + %{l_shtool} subst \ 9.314 + -e 's;\(expires(int\));\1,null);' \ 9.315 + -e 's;\(desired_expires(int\));\1,null);' \ 9.316 + -e 's;\(contact(string\));\1,null);' \ 9.317 + -e 's;\(remote_contact(string\));\1,null);' \ 9.318 + -e 's;\(version(int\));\1,null);' \ 9.319 + -e 's;\(extra_headers(string\));\1,null);' \ 9.320 + scripts/dbtext/opensips/pua 9.321 + %{l_shtool} subst \ 9.322 + -e 's;\(reason(string\));\1,null);' \ 9.323 + scripts/dbtext/opensips/active_watchers \ 9.324 + scripts/dbtext/opensips/rls_watchers 9.325 + %{l_shtool} subst \ 9.326 + -e 's;#! */usr/bin/python;#! %{l_prefix}/bin/python;' \ 9.327 + scripts/dbtextdb/*.py 9.328 + %{l_shtool} subst \ 9.329 + -e 's;#! */usr/bin/perl;#! %{l_prefix}/bin/perl;' \ 9.330 + -e 's;^\(my \$PATH_BIN =\) "./";\1 "%{l_prefix}/bin/";' \ 9.331 + -e 's;^\(my \$PATH_CTLRC =\) "./scripts/";\1 "%{l_prefix}/etc/opensips/";' \ 9.332 + -e 's;^\(my \$PATH_ETC =\) "/usr/local/etc";\1 "%{l_prefix}/etc";' \ 9.333 + -e 's;^\(my \$PATH_LIBS =\) "/usr/local/lib";\1 "%{l_prefix}/lib";' \ 9.334 + -e 's;^\(my \$PATH_SHARE =\) "/usr/local/share";\1 "%{l_prefix}/share";' \ 9.335 + -e 's;^\(my $path = \)"/tmp/";\1"%{l_prefix}/var/opensips/";' \ 9.336 + scripts/osipsconsole 9.337 + %{l_shtool} subst \ 9.338 + -e 's;if ( -x "/usr/bin/";if ( -x "%{l_prefix}/bin";' \ 9.339 + -e 's;if \[ -x "/usr/bin/\$1" \];if [ -x "%{l_prefix}/bin/$1" ];' \ 9.340 + -e 's;\$TOOLPATH = "/usr/bin/";$TOOLPATH = "%{l_prefix}/bin/";' \ 9.341 + -e 's;TOOLPATH="/usr/bin/\$1";TOOLPATH="%{l_prefix}/bin/$1";' \ 9.342 + -e 's;if ( -x "/bin/";if ( -x "/usr/bin/";' \ 9.343 + -e 's;if \[ -x "/bin/\$1" \];if [ -x "/usr/bin/$1" ];' \ 9.344 + -e 's;\$TOOLPATH = "/bin/";$TOOLPATH = "/usr/bin/";' \ 9.345 + -e 's;TOOLPATH="/bin/\$1";TOOLPATH="/usr/bin/$1";' \ 9.346 + -e 's;if ( -x "/usr/local/bin/\$1";if ( -x "/bin/$1";' \ 9.347 + -e 's;if \[ -x "/usr/local/bin/\$1" \];if [ -x "/bin/$1" ];' \ 9.348 + -e 's;\$TOOLPATH = "/usr/local/bin/;$TOOLPATH = "/bin/;' \ 9.349 + -e 's;TOOLPATH="/usr/local/bin/\$1";TOOLPATH="/bin/$1";' \ 9.350 + scripts/osipsconsole \ 9.351 + scripts/opensipsctl.base 9.352 + %{l_shtool} subst \ 9.353 + -e 's;^\(DEFS+=\).*\\$;\1 \\;' \ 9.354 + -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libcurl libxml-2.0`;g" \ 9.355 + -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libcurl libxml-2.0`;" \ 9.356 + modules/xcap_client/Makefile 9.357 + %{l_shtool} subst \ 9.358 + -e 's;^\(DEFS+=\).*\\$;\1 \\;' \ 9.359 + -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libxml-2.0`;g" \ 9.360 + -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libxml-2.0`;" \ 9.361 + modules/cpl-c/Makefile \ 9.362 + modules/presence/Makefile \ 9.363 + modules/presence_dialoginfo/Makefile \ 9.364 + modules/presence_xml/Makefile \ 9.365 + modules/pua/Makefile \ 9.366 + modules/pua_bla/Makefile \ 9.367 + modules/pua_dialoginfo/Makefile \ 9.368 + modules/pua_mi/Makefile \ 9.369 + modules/pua_usrloc/Makefile \ 9.370 + modules/pua_xmpp/Makefile \ 9.371 + modules/b2b_logic/Makefile \ 9.372 + modules/rls/Makefile 9.373 + %{l_shtool} subst \ 9.374 + -e 's;^\(DEFS+=\).*;\1`%{l_prefix}/bin/pkg-config --cflags-only-I libconfuse`;' \ 9.375 + -e 's;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libconfuse`;' \ 9.376 + modules/carrierroute/Makefile 9.377 + %{l_shtool} subst \ 9.378 + -e 's;\(LIBS = .*-L\$(shell pg_config --libdir) -lpq\);\1 $(shell pg_config --libs);' \ 9.379 + modules/db_postgres/Makefile 9.380 + %{l_shtool} subst \ 9.381 + -e 's;-I\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/include[\t ]*;;' \ 9.382 + -e 's;-L\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/lib[\t ]*;;' \ 9.383 + modules/db_berkeley/Makefile \ 9.384 + utils/db_berkeley/Makefile 9.385 + %{l_shtool} subst \ 9.386 + -e 's;\(\$(cfg-prefix)\)\$(shell net-snmp-config --prefix);\1;' \ 9.387 + modules/snmpstats/Makefile 9.388 + %{l_shtool} subst \ 9.389 + -e 's;LM_WARN(\(\"uac does not spread across\);LM_NOTICE(\1;' \ 9.390 + modules/tm/uac.c 9.391 + %{l_shtool} subst \ 9.392 + -e 's;\(#define MAX_SSL_RETRIES\) 32;\1 1024;' \ 9.393 + tls/tls_server.c 9.394 + %{l_shtool} subst \ 9.395 + -e 's;^\(default_bits[ \t]*=[ \t]*\)2048;\14096;' \ 9.396 + etc/tls/ca.conf 9.397 + %{l_shtool} subst \ 9.398 + -e '1,2d' \ 9.399 + etc/tls/README 9.400 + %{l_shtool} subst \ 9.401 + -e 's;\(radiusclient\)-ng;\1;g' \ 9.402 + -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \ 9.403 + radius.h 9.404 9.405 %build 9.406 + # select modules 9.407 + modslist='b2b_entities b2b_logic cpl-c db_http dialplan identity jabber perl perlvdb presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp regex rls tlsops xcap_client xmpp' 9.408 +%if "%{with_croute}" == "yes" 9.409 + modslist="$modslist carrierroute" 9.410 +%endif 9.411 +%if "%{with_json}" == "yes" 9.412 + modslist="$modslist json" 9.413 +%endif 9.414 +%if "%{with_ldap}" == "yes" 9.415 + modslist="$modslist h350 ldap" 9.416 +%endif 9.417 +%if "%{with_memcached}" == "yes" 9.418 + modslist="$modslist memcached" 9.419 +%endif 9.420 +%if "%{with_osp}" == "yes" 9.421 + modslist="$modslist osp" 9.422 +%endif 9.423 +%if "%{with_radius}" == "yes" 9.424 + modslist="$modslist aaa_radius auth_aaa group uri" 9.425 +%endif 9.426 +%if "%{with_snmp}" == "yes" 9.427 + modslist="$modslist snmpstats" 9.428 +%endif 9.429 +%if "%{with_bdb}" == "yes" 9.430 + modslist="$modslist db_berkeley" 9.431 +%endif 9.432 +%if "%{with_mysql}" == "yes" 9.433 + modslist="$modslist db_mysql" 9.434 +%endif 9.435 +%if "%{with_pgsql}" == "yes" 9.436 + modslist="$modslist db_postgres" 9.437 +%endif 9.438 +%if "%{with_odbc}" == "yes" 9.439 + modslist="$modslist db_unixodbc" 9.440 +%endif 9.441 +%if "%{with_geoip}" == "yes" 9.442 + modslist="$modslist mmgeoip" 9.443 +%endif 9.444 + 9.445 # build dependencies 9.446 %{l_make} %{l_mflags} \ 9.447 - CC="%{l_cc} %{l_cflags} %{l_cppflags}" \ 9.448 + CC="%{l_cc}" \ 9.449 +%if "%{with_sctp}" == "yes" 9.450 + SCTP=1 \ 9.451 +%endif 9.452 %if "%{with_ssl}" == "yes" 9.453 TLS=1 \ 9.454 %endif 9.455 @@ -103,22 +450,43 @@ 9.456 dep >/dev/null 2>&1 || true 9.457 9.458 # build program 9.459 - %{l_make} %{l_mflags} \ 9.460 - CC="%{l_cc} %{l_cflags} %{l_cppflags}" \ 9.461 -%if "%{with_ssl}" == "yes" 9.462 - TLS=1 \ 9.463 + %{l_make} %{l_mflags -O} \ 9.464 + CC="%{l_cc}" \ 9.465 +%if "%{with_sctp}" == "yes" 9.466 + SCTP=1 \ 9.467 %endif 9.468 - prefix=%{l_prefix} 9.469 - 9.470 - # build modules 9.471 - %{l_make} %{l_mflags} \ 9.472 - CC="%{l_cc} %{l_cflags} %{l_cppflags}" \ 9.473 %if "%{with_ssl}" == "yes" 9.474 TLS=1 \ 9.475 %endif 9.476 prefix=%{l_prefix} \ 9.477 - modules \ 9.478 - skip_modules="mysql jabber" 9.479 + opensips 9.480 + 9.481 + # build utilities 9.482 + %{l_make} %{l_mflags -O} \ 9.483 + CC="%{l_cc}" \ 9.484 +%if "%{with_sctp}" == "yes" 9.485 + SCTP=1 \ 9.486 +%endif 9.487 +%if "%{with_ssl}" == "yes" 9.488 + TLS=1 \ 9.489 +%endif 9.490 + prefix=%{l_prefix} \ 9.491 + modules="$modslist" \ 9.492 + utils 9.493 + 9.494 + # build modules 9.495 + %{l_make} %{l_mflags -O} \ 9.496 + CC="%{l_cc}" \ 9.497 +%if "%{with_sctp}" == "yes" 9.498 + SCTP=1 \ 9.499 +%endif 9.500 +%if "%{with_ssl}" == "yes" 9.501 + TLS=1 \ 9.502 +%endif 9.503 + include_modules="$modslist" \ 9.504 + skip_modules="" \ 9.505 + prefix=%{l_prefix} \ 9.506 + modules 9.507 9.508 # build rtpproxy extension 9.509 ( cd rtpproxy-%{V_rtpproxy} 9.510 @@ -128,62 +496,96 @@ 9.511 case "%{l_platform -t}" in 9.512 *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;; 9.513 esac 9.514 + export GREP="grep" 9.515 ./configure 9.516 - %{l_make} %{l_mflags} 9.517 + %{l_make} %{l_mflags -O} 9.518 ) || exit $? 9.519 9.520 %install 9.521 + rm -rf $RPM_BUILD_ROOT 9.522 9.523 - # install program 9.524 + # select modules 9.525 + modslist='b2b_entities b2b_logic cpl-c db_http identity jabber perl perlvdb presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp regex rls tlsops xcap_client xmpp' 9.526 +%if "%{with_croute}" == "yes" 9.527 + modslist="$modslist carrierroute" 9.528 +%endif 9.529 +%if "%{with_json}" == "yes" 9.530 + modslist="$modslist json" 9.531 +%endif 9.532 +%if "%{with_ldap}" == "yes" 9.533 + modslist="$modslist h350 ldap" 9.534 +%endif 9.535 +%if "%{with_memcached}" == "yes" 9.536 + modslist="$modslist memcached" 9.537 +%endif 9.538 +%if "%{with_osp}" == "yes" 9.539 + modslist="$modslist osp" 9.540 +%endif 9.541 +%if "%{with_radius}" == "yes" 9.542 + modslist="$modslist aaa_radius auth_aaa group uri" 9.543 +%endif 9.544 +%if "%{with_snmp}" == "yes" 9.545 + modslist="$modslist snmpstats" 9.546 +%endif 9.547 +%if "%{with_bdb}" == "yes" 9.548 + modslist="$modslist db_berkeley" 9.549 +%endif 9.550 +%if "%{with_mysql}" == "yes" 9.551 + modslist="$modslist db_mysql" 9.552 +%endif 9.553 +%if "%{with_pgsql}" == "yes" 9.554 + modslist="$modslist db_postgres" 9.555 +%endif 9.556 +%if "%{with_odbc}" == "yes" 9.557 + modslist="$modslist db_unixodbc" 9.558 +%endif 9.559 +%if "%{with_geoip}" == "yes" 9.560 + modslist="$modslist mmgeoip" 9.561 +%endif 9.562 + 9.563 + # install program, utils, and modules 9.564 %{l_make} %{l_mflags} \ 9.565 INSTALL="%{l_shtool} install%{l_nil} -c" \ 9.566 basedir=$RPM_BUILD_ROOT \ 9.567 prefix=%{l_prefix} \ 9.568 - cfg-prefix=$RPM_BUILD_ROOT \ 9.569 - cfg-target=%{l_prefix}/etc/opensips/ \ 9.570 - doc-dir=share/opensips/doc/ \ 9.571 - man-dir=man/ \ 9.572 + doc-dir=share/opensips/doc \ 9.573 + man-dir=man \ 9.574 + data-dir=share/opensips \ 9.575 + include_modules="$modslist" \ 9.576 + skip_modules="" \ 9.577 install 9.578 9.579 - # install modules 9.580 - %{l_make} %{l_mflags} \ 9.581 - INSTALL="%{l_shtool} install%{l_nil} -c" \ 9.582 - basedir=$RPM_BUILD_ROOT \ 9.583 - prefix=%{l_prefix} \ 9.584 - cfg-prefix=$RPM_BUILD_ROOT \ 9.585 - cfg-target=%{l_prefix}/etc/opensips/ \ 9.586 - doc-dir=share/opensips/doc/ \ 9.587 - man-dir=man/ \ 9.588 - install-modules \ 9.589 - skip_modules="mysql jabber" 9.590 - 9.591 - # install rtpproxy extension 9.592 + # install rtpproxy software 9.593 %{l_shtool} install -c -s -m 755 \ 9.594 - rtpproxy-%{V_rtpproxy}/rtpproxy $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_rtpproxy 9.595 + rtpproxy-%{V_rtpproxy}/rtpproxy \ 9.596 + $RPM_BUILD_ROOT%{l_prefix}/sbin/rtpproxy 9.597 9.598 # strip down installation 9.599 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 9.600 - rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_mysql.sh 9.601 9.602 - # post-adjust installation 9.603 - %{l_shtool} subst \ 9.604 - -e 's;/etc/opensips/opensipsctlrc;%{l_prefix}/etc/opensips/opensipsctlrc;g' \ 9.605 - $RPM_BUILD_ROOT%{l_prefix}/sbin/opensipsctl 9.606 - %{l_shtool} mkdir -f -p -m 755 \ 9.607 - $RPM_BUILD_ROOT%{l_prefix}/etc/opensips 9.608 - %{l_shtool} install -c -m 644 \ 9.609 - -e 's;^# \(PID_FILE\)=.*;\1=%{l_prefix}/var/opensips/opensips.pid;' \ 9.610 - -e 's;^# \(OSIPS_FIFO\)=.*;\1=%{l_prefix}/var/opensips/opensips.fifo;' \ 9.611 - scripts/opensipsctlrc \ 9.612 - $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/opensipsctlrc 9.613 + # create installation hierarchy 9.614 + %{l_shtool} mkdir -f -p -m 700 \ 9.615 + $RPM_BUILD_ROOT%{l_prefix}/var/opensips/acc \ 9.616 + $RPM_BUILD_ROOT%{l_prefix}/var/opensips/tmp 9.617 9.618 # install default configuration 9.619 %{l_shtool} mkdir -f -p -m 755 \ 9.620 $RPM_BUILD_ROOT%{l_prefix}/etc/opensips 9.621 - %{l_shtool} install -c -m 755 %{l_value -s -a} \ 9.622 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 9.623 %{SOURCE opensips.cfg} \ 9.624 + %{SOURCE opensipsctlrc} \ 9.625 + %{SOURCE osipsconsolerc} \ 9.626 $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/ 9.627 9.628 + # conditionally install osipsconsole resources 9.629 +%if "%{with_cons}" == "yes" 9.630 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 9.631 + %{SOURCE osipsconsolerc} \ 9.632 + $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/ 9.633 +%else 9.634 + rm $RPM_BUILD_ROOT%{l_prefix}/sbin/osipsconsole 9.635 +%endif 9.636 + 9.637 # install OSSP fsl configuration 9.638 %{l_shtool} mkdir -f -p -m 755 \ 9.639 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 9.640 @@ -191,23 +593,17 @@ 9.641 %{SOURCE fsl.opensips} \ 9.642 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 9.643 9.644 - # install run-command script 9.645 + # install runcommand script 9.646 %{l_shtool} mkdir -f -p -m 755 \ 9.647 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 9.648 %{l_shtool} install -c -m 755 %{l_value -s -a} \ 9.649 %{SOURCE rc.opensips} \ 9.650 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 9.651 9.652 - # create database directory and install database schema definitions 9.653 - %{l_shtool} mkdir -f -p -m 755 \ 9.654 - $RPM_BUILD_ROOT%{l_prefix}/var/opensips 9.655 - %{l_shtool} install -c -m 644 \ 9.656 - %{SOURCE opensips.schema-dbtext.txt} \ 9.657 - $RPM_BUILD_ROOT%{l_prefix}/share/opensips/ 9.658 - 9.659 # determine installation files 9.660 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 9.661 %{l_files_std} \ 9.662 + '%not %dir %{l_prefix}/etc/fsl' \ 9.663 '%config %{l_prefix}/etc/fsl/*' \ 9.664 '%config %{l_prefix}/etc/opensips/*' \ 9.665 '%doc %{l_prefix}/share/opensips/doc/*' \ 9.666 @@ -216,20 +612,17 @@ 9.667 %files -f files 9.668 9.669 %clean 9.670 + rm -rf $RPM_BUILD_ROOT 9.671 9.672 %post 9.673 - # on install, setup database 9.674 + # on install, setup database (osipsconsole db create /pfx/var/opensips/db) 9.675 if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then 9.676 - mkdir $RPM_INSTALL_PREFIX/var/opensips/db 9.677 - chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db 9.678 - chmod 755 $RPM_INSTALL_PREFIX/var/opensips/db 9.679 - schema="$RPM_INSTALL_PREFIX/share/opensips/opensips.schema-dbtext.txt" 9.680 - for table in `sed -e '/^#.*/d' -e '/^$/d' -e 's;\([^:]*\):.*;\1;' <$schema | sort -u`; do 9.681 - grep "^${table}:" $schema | sed -e "s;^${table}: *;;" \ 9.682 - >$RPM_INSTALL_PREFIX/var/opensips/db/$table 9.683 - done 9.684 - chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true 9.685 - chmod 644 $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true 9.686 + %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \ 9.687 + $RPM_INSTALL_PREFIX/var/opensips/db 9.688 + rm -f $RPM_INSTALL_PREFIX/share/opensips/dbtext/*.orig 9.689 + %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \ 9.690 + $RPM_INSTALL_PREFIX/share/opensips/dbtext/* \ 9.691 + $RPM_INSTALL_PREFIX/var/opensips/db/ 9.692 fi 9.693 9.694 # after upgrade, restart service
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/opensips/opensipsctlrc Wed Sep 21 14:04:16 2011 +0200 10.3 @@ -0,0 +1,134 @@ 10.4 +## 10.5 +## opensipsctlrc -- OpenSIPS control tools configuration 10.6 +## 10.7 + 10.8 +## your SIP domain 10.9 +SIP_DOMAIN=name.host.tld 10.10 + 10.11 +## chrooted directory 10.12 +# $CHROOT_DIR="/path/to/chrooted/directory" 10.13 + 10.14 +## Database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT; 10.15 +## by default none is loaded. Use opensipsdbctl to setup a database. 10.16 +DBENGINE=DBTEXT 10.17 + 10.18 +## database host 10.19 +# DBHOST=localhost 10.20 + 10.21 +## database name (for ORACLE this is TNS name) 10.22 +# DBNAME=opensips 10.23 + 10.24 +# database path used by dbtext or db_berkeley 10.25 +DB_PATH=@l_prefix@/var/opensips/db 10.26 + 10.27 +## database read/write user 10.28 +# DBRWUSER=@l_rusr@ 10.29 + 10.30 +## password for database read/write user 10.31 +# DBRWPW=rente_word_pass_rw 10.32 + 10.33 +## database read only user 10.34 +# DBROUSER=@l_rusr@ 10.35 + 10.36 +## password for database read only user 10.37 +# DBROPW=rentero_word_pass 10.38 + 10.39 +## database super user (for ORACLE this is 'scheme-creator' user) 10.40 +# DBROOTUSER=@l_susr@ 10.41 + 10.42 +# user name column 10.43 +# USERCOL="username" 10.44 + 10.45 + 10.46 +# SQL definitions 10.47 +# If you change this definitions here, then you must change them 10.48 +# in db/schema/entities.xml too. 10.49 +# 10.50 + 10.51 +# FOREVER="2020-05-28 21:32:15" 10.52 +# DEFAULT_ALIASES_EXPIRES=$FOREVER 10.53 +# DEFAULT_Q="1.0" 10.54 +# DEFAULT_CALLID="Default-Call-ID" 10.55 +# DEFAULT_CSEQ="13" 10.56 +# DEFAULT_LOCATION_EXPIRES=$FOREVER 10.57 + 10.58 + 10.59 +# Program to calculate a message-digest fingerprint 10.60 +# MD5="md5sum" 10.61 + 10.62 +# awk tool 10.63 +# AWK="awk" 10.64 + 10.65 +# grep tool 10.66 +# GREP="grep" 10.67 + 10.68 +# sed tool 10.69 +# SED="sed" 10.70 + 10.71 + 10.72 +# Describe what additional tables to install. Valid values for the variables 10.73 +# below are yes/no/ask. With ask (default) it will interactively ask the user 10.74 +# for an answer, while yes/no allow for automated, unassisted installs. 10.75 +# 10.76 + 10.77 +# If to install tables for the modules in the EXTRA_MODULES variable. 10.78 +# INSTALL_EXTRA_TABLES=ask 10.79 + 10.80 +# If to install presence related tables. 10.81 +# INSTALL_PRESENCE_TABLES=ask 10.82 + 10.83 +# Define what module tables should be installed. 10.84 +# If you use the postgres database and want to change the installed tables, 10.85 +# then you must also adjust the STANDARD_TABLES or EXTRA_TABLES variable 10.86 +# accordingly in the opensipsdbctl.base script. 10.87 + 10.88 +# opensips standard modules 10.89 +# STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc 10.90 +# msilo alias_db uri_db speeddial avpops auth_db pdt dialog 10.91 +# dispatcher dialplan drouting nathelper load_balancer" 10.92 + 10.93 +# opensips extra modules 10.94 +# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist" 10.95 + 10.96 + 10.97 +## type of aliases used: DB - database aliases; UL - usrloc aliases 10.98 +## - default: none 10.99 +# ALIASES_TYPE="DB" 10.100 + 10.101 +## control engine: FIFO or UNIXSOCK 10.102 +## - default FIFO 10.103 +CTLENGINE=FIFO 10.104 + 10.105 +## path to FIFO file 10.106 +OSIPS_FIFO=@l_prefix@/var/opensips/opensips.fifo 10.107 + 10.108 +## path to server inbound FIFO directory 10.109 +OSER_FIRET=@l_prefix@/var/opensips 10.110 + 10.111 +## MI_CONNECTOR control engine: FIFO, UNIXSOCK, UDP, XMLRPC 10.112 +# MI_CONNECTOR=FIFO:@l_prefix@/var/opensips/opensips.fifo 10.113 +# MI_CONNECTOR=UNIXSOCK:/tmp/opensips.sock 10.114 +# MI_CONNECTOR=UDP:192.168.2.133:8000 10.115 +# MI_CONNECTOR=XMLRPC:192.168.2.133:8000 10.116 + 10.117 +## check ACL names; default on (1); off (0) 10.118 +# VERIFY_ACL=1 10.119 + 10.120 +## ACL names - if VERIFY_ACL is set, only the ACL names from below list 10.121 +## are accepted 10.122 +# ACL_GROUPS="local ld int voicemail free-pstn" 10.123 + 10.124 +## verbose - debug purposes - default '0' 10.125 +# VERBOSE=1 10.126 + 10.127 +## do (1) or don't (0) store plaintext passwords 10.128 +## in the subscriber table - default '1' 10.129 +STORE_PLAINTEXT_PW=0 10.130 + 10.131 +## OPENSIPS START Options 10.132 +## PID file path - default is: /var/run/opensips.pid 10.133 +PID_FILE=@l_prefix@/var/opensips/opensips.pid 10.134 + 10.135 +## Extra start options - default is: not set 10.136 +# example: start opensips with 64MB share memory: STARTOPTIONS="-m 64" 10.137 +# STARTOPTIONS=
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/opensips/osipsconsolerc Wed Sep 21 14:04:16 2011 +0200 11.3 @@ -0,0 +1,98 @@ 11.4 +## 11.5 +## osipsconsolerc -- OpenSIPS management configuration 11.6 +## 11.7 + 11.8 +## your SIP domain 11.9 +SIP_DOMAIN=name.host.tld 11.10 + 11.11 +## Database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT; 11.12 +## by default none is loaded. Use opensipsdbctl to setup a database. 11.13 +DBENGINE=DBTEXT 11.14 + 11.15 +## database host 11.16 +# DBHOST=localhost 11.17 + 11.18 +## database port for PostgreSQL 11.19 +# DBPORT=5433 11.20 + 11.21 +## database name (for ORACLE this is TNS name) 11.22 +# DBNAME=opensips 11.23 + 11.24 +## database path used by dbtext or db_berkeley 11.25 +DB_PATH=@l_prefix@/var/opensips/db 11.26 + 11.27 +## database read/write user 11.28 +# DBRWUSER=@l_rusr@ 11.29 + 11.30 +## password for database read/write user 11.31 +# DBRWPW=rente_word_pass_rw 11.32 + 11.33 +## database read only user 11.34 +# DBROUSER=@l_rusr@ 11.35 + 11.36 +## password for database read only user 11.37 +# DBROPW=rentero_word_pass 11.38 + 11.39 +## database super user (for ORACLE this is 'scheme-creator' user) 11.40 +# DBROOTUSER=@l_susr@ 11.41 + 11.42 +# Program to calculate a message-digest fingerprint 11.43 +# MD5="md5sum" 11.44 + 11.45 +# awk tool 11.46 +# AWK="awk" 11.47 + 11.48 +# grep tool 11.49 +# GREP="egrep" 11.50 + 11.51 +# sed tool 11.52 +# SED="sed" 11.53 + 11.54 + 11.55 +# Describe what additional tables to install. Valid values for the variables 11.56 +# below are yes/no/ask. With ask (default) it will interactively ask the user 11.57 +# for an answer, while yes/no allow for automated, unassisted installs. 11.58 +# 11.59 + 11.60 +# Define what module tables should be installed. 11.61 +# If you use the postgres database and want to change the installed tables, 11.62 +# then you must also adjust the STANDARD_TABLES or EXTRA_TABLES variable 11.63 +# accordingly in the opensipsdbctl.base script. 11.64 + 11.65 +# opensips standard modules 11.66 +# STANDARD_MODULES="standard acc lcr domain group permissions registrar 11.67 +# usrloc msilo alias_db uri_db speeddial avpops auth_db 11.68 +# pdt dialog dispatcher dialplan drouting nathelper 11.69 +# load_balancer" 11.70 + 11.71 +# opensips extra modules 11.72 +# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist" 11.73 + 11.74 + 11.75 +## type of aliases used: DB - database aliases; UL - usrloc aliases 11.76 +## - default: none 11.77 +# ALIASES_TYPE="DB" 11.78 + 11.79 +## MI_CONNECTOR control engine: FIFO, UNIXSOCK, UDP, XMLRPC 11.80 +# MI_CONNECTOR=FIFO:@l_prefix@/var/opensips/opensips.fifo 11.81 +# MI_CONNECTOR=UNIXSOCK:/tmp/opensips.sock 11.82 +# MI_CONNECTOR=UDP:192.168.2.133:8000 11.83 +# MI_CONNECTOR=XMLRPC:192.168.2.133:8000 11.84 + 11.85 +## check ACL names; default on (1); off (0) 11.86 +# VERIFY_ACL=1 11.87 + 11.88 +## ACL names - if VERIFY_ACL is set, only ACL names from list are accepted 11.89 +# ACL_GROUPS="local ld int voicemail free-pstn" 11.90 + 11.91 +## do (1) or don't (0) store plaintext passwords 11.92 +## in the subscriber table - default '1' 11.93 +STORE_PLAINTEXT_PW=0 11.94 + 11.95 +## OPENSIPS START Options 11.96 +## PID file path - default is: /var/run/opensips.pid 11.97 +PID_FILE=@l_prefix@/var/opensips/opensips.pid 11.98 + 11.99 +## Extra start options - default is: not set 11.100 +# example: start opensips with 64MB share memory: STARTOPTIONS="-m 64" 11.101 +# STARTOPTIONS=
12.1 --- a/opensips/rc.opensips Wed Sep 21 14:02:13 2011 +0200 12.2 +++ b/opensips/rc.opensips Wed Sep 21 14:04:16 2011 +0200 12.3 @@ -5,8 +5,8 @@ 12.4 12.5 %config 12.6 opensips_enable="$openpkg_rc_def" 12.7 - opensips_flags="" 12.8 opensips_rtpproxy="yes" 12.9 + opensips_rtpproxy_addr="127.0.0.1:12345" 12.10 opensips_log_prolog="true" 12.11 opensips_log_epilog="true" 12.12 opensips_log_numfiles="10" 12.13 @@ -18,7 +18,9 @@ 12.14 opensips_pidfile="@l_prefix@/var/opensips/opensips.pid" 12.15 opensips_rtpproxy_pidfile="@l_prefix@/var/opensips/opensips_rtpproxy.pid" 12.16 opensips_rtpproxy_socket="@l_prefix@/var/opensips/opensips_rtpproxy.sock" 12.17 - opensips_rtpproxy_listen=`grep '^listen=' $opensips_cfgfile | sed -e 's/^listen="\(.*\)".*/\1/'` 12.18 + opensips_signal () { 12.19 + [ -f $opensips_pidfile ] && kill -$1 `cat $opensips_pidfile` 12.20 + } 12.21 opensips_rtpproxy_signal () { 12.22 [ -f $opensips_rtpproxy_pidfile ] && kill -$1 `cat $opensips_rtpproxy_pidfile` 12.23 } 12.24 @@ -29,7 +31,7 @@ 12.25 if @l_prefix@/sbin/opensips -c >/dev/null 2>&1; then 12.26 opensips_usable="yes" 12.27 fi 12.28 - if @l_prefix@/sbin/opensipsctl ps >/dev/null 2>&1; then 12.29 + if rcService opensips enable yes && opensips_signal 0; then 12.30 opensips_active="yes" 12.31 fi 12.32 echo "opensips_enable=\"$opensips_enable\"" 12.33 @@ -40,20 +42,20 @@ 12.34 rcService opensips enable yes || exit 0 12.35 rcService opensips active yes && exit 0 12.36 if rcVarIsYes opensips_rtpproxy; then 12.37 - cmd="@l_prefix@/sbin/opensips_rtpproxy" \ 12.38 - cmd="$cmd -l $opensips_rtpproxy_listen" 12.39 + cmd="@l_prefix@/sbin/rtpproxy" \ 12.40 + cmd="$cmd -u @l_rusr@" 12.41 + cmd="$cmd -l $opensips_rtpproxy_addr" 12.42 cmd="$cmd -s unix:$opensips_rtpproxy_socket" 12.43 cmd="$cmd -p $opensips_rtpproxy_pidfile" 12.44 su @l_rusr@ -c "$cmd" 12.45 fi 12.46 - @l_prefix@/sbin/opensips \ 12.47 - -P $opensips_pidfile \ 12.48 - ${opensips_flags} 12.49 + @l_prefix@/sbin/opensipsctl start 12.50 12.51 %stop -u @l_susr@ 12.52 rcService opensips enable yes || exit 0 12.53 rcService opensips active no && exit 0 12.54 @l_prefix@/sbin/opensipsctl stop 12.55 + rm -f $opensips_pidfile 2>/dev/null || true 12.56 if rcVarIsYes opensips_rtpproxy; then 12.57 opensips_rtpproxy_signal TERM 12.58 fi