"Fossies" - the Fresh Open Source Software Archive

Member "opensips-3.0.1/test/5.cfg" (16 Apr 2019, 9900 Bytes) of package /linux/misc/opensips-3.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "5.cfg": 2.4.5_vs_3.0.0.

    1 #
    2 # OpenSIPS basic configuration script
    3 #     by Anca Vamanu <anca@voice-system.ro>
    4 #
    5 # Please refer to the Core CookBook at http://www.opensips.org/dokuwiki/doku.php
    6 # for a explanation of possible statements, functions and parameters.
    7 #
    8 
    9 
   10 ####### Global Parameters #########
   11 
   12 log_level=3
   13 log_stderror=no
   14 log_facility=LOG_LOCAL0
   15 
   16 children=4
   17 
   18 /* uncomment the following lines to enable debugging */
   19 #debug_mode=yes
   20 
   21 /* uncomment the next line to disable TCP (default on) */
   22 #disable_tcp=yes
   23 
   24 /* uncomment the next line to enable the auto temporary blacklisting of 
   25    not available destinations (default disabled) */
   26 #disable_dns_blacklist=no
   27 
   28 /* uncomment the next line to enable IPv6 lookup after IPv4 dns 
   29    lookup failures (default disabled) */
   30 #dns_try_ipv6=yes
   31 
   32 /* uncomment the next line to disable the auto discovery of local aliases
   33    based on reverse DNS on IPs (default on) */
   34 #auto_aliases=no
   35 
   36 /* uncomment the following lines to enable TLS support  (default off) */
   37 #disable_tls = no
   38 #listen = tls:your_IP:5061
   39 #tls_verify_server = 1
   40 #tls_verify_client = 1
   41 #tls_require_client_certificate = 0
   42 #tls_method = TLSv1
   43 #tls_certificate = "/usr/local/etc/opensips/tls/user/user-cert.pem"
   44 #tls_private_key = "/usr/local/etc/opensips/tls/user/user-privkey.pem"
   45 #tls_ca_list = "/usr/local/etc/opensips/tls/user/user-calist.pem"
   46 
   47 
   48 /* uncomment and configure the following line if you want opensips to 
   49    bind on a specific interface/port/proto (default bind on all available) */
   50 #listen=udp:192.168.1.2:5060
   51 
   52 
   53 ####### Modules Section ########
   54 
   55 #set module path
   56 mpath="../modules"
   57 
   58 /* uncomment next line for MySQL DB support */
   59 #loadmodule "db_mysql.so"
   60 loadmodule "sl/sl.so"
   61 loadmodule "tm/tm.so"
   62 loadmodule "rr/rr.so"
   63 loadmodule "maxfwd/maxfwd.so"
   64 loadmodule "usrloc/usrloc.so"
   65 loadmodule "registrar/registrar.so"
   66 loadmodule "textops/textops.so"
   67 loadmodule "mi_fifo/mi_fifo.so"
   68 loadmodule "acc/acc.so"
   69 
   70 /* uncomment next lines for MySQL based authentication support 
   71    NOTE: a DB (like db_mysql) module must be also loaded */
   72 #loadmodule "auth.so"
   73 #loadmodule "auth_db.so"
   74 /* uncomment next line for aliases support
   75    NOTE: a DB (like db_mysql) module must be also loaded */
   76 #loadmodule "alias_db.so"
   77 /* uncomment next line for multi-domain support
   78    NOTE: a DB (like db_mysql) module must be also loaded
   79    NOTE: be sure and enable multi-domain support in all used modules
   80          (see "multi-module params" section ) */
   81 #loadmodule "domain.so"
   82 /* uncomment the next two lines for presence server support
   83    NOTE: a DB (like db_mysql) module must be also loaded */
   84 #loadmodule "presence.so"
   85 #loadmodule "presence_xml.so"
   86 
   87 
   88 # ----------------- setting module-specific parameters ---------------
   89 
   90 
   91 # ----- mi_fifo params -----
   92 modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
   93 
   94 
   95 # ----- rr params -----
   96 # do not append from tag to the RR (no need for this script)
   97 modparam("rr", "append_fromtag", 0)
   98 
   99 
  100 # ----- rr params -----
  101 modparam("registrar", "method_filtering", 1)
  102 /* uncomment the next line to disable parallel forking via location */
  103 # modparam("registrar", "append_branches", 0)
  104 /* uncomment the next line not to allow more than 10 contacts per AOR */
  105 #modparam("registrar", "max_contacts", 10)
  106 
  107 
  108 # ----- acc params -----
  109 /* what sepcial events should be accounted ? */
  110 modparam("acc", "early_media", 1)
  111 modparam("acc", "report_cancels", 1)
  112 /* by default ww do not adjust the direct of the sequential requests.
  113    if you enable this parameter, be sure the enable "append_fromtag"
  114    in "rr" module */
  115 modparam("acc", "detect_direction", 0)
  116 /* account triggers (flags) */
  117 modparam("acc", "failed_transaction_flag", 3)
  118 modparam("acc", "log_flag", 1)
  119 modparam("acc", "log_missed_flag", 2)
  120 /* uncomment the following lines to enable DB accounting also */
  121 modparam("acc", "db_flag", 1)
  122 modparam("acc", "db_missed_flag", 2)
  123 
  124 
  125 # ----- usrloc params -----
  126 modparam("usrloc", "db_mode",   0)
  127 /* uncomment the following lines if you want to enable DB persistency
  128    for location entries */
  129 #modparam("usrloc", "db_mode",   2)
  130 #modparam("usrloc", "db_url",
  131 #	"mysql://opensips:opensipsrw@192.168.1.3/opensips_1_3")
  132 
  133 
  134 # ----- auth_db params -----
  135 /* uncomment the following lines if you want to enable the DB based
  136    authentication */
  137 #modparam("auth_db", "calculate_ha1", yes)
  138 #modparam("auth_db", "password_column", "password")
  139 #modparam("auth_db", "db_url",
  140 #	"mysql://opensips:opensipsrw@192.168.1.3/opensips_1_3")
  141 #modparam("auth_db", "load_credentials", "")
  142 
  143 
  144 # ----- alias_db params -----
  145 /* uncomment the following lines if you want to enable the DB based
  146    aliases */
  147 #modparam("alias_db", "db_url",
  148 #	"mysql://opensips:opensipsrw@192.168.1.3/opensips_1_3")
  149 
  150 
  151 # ----- domain params -----
  152 /* uncomment the following lines to enable multi-domain detection
  153    support */
  154 #modparam("domain", "db_url",
  155 #	"mysql://opensips:opensipsrw@192.168.1.3/opensips_1_3")
  156 #modparam("domain", "db_mode", 1)   # Use caching
  157 
  158 
  159 # ----- multi-module params -----
  160 /* uncomment the following line if you want to enable multi-domain support
  161    in the modules (dafault off) */
  162 #modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)
  163 
  164 
  165 # ----- presence params -----
  166 /* uncomment the following lines if you want to enable presence */
  167 #modparam("presence|presence_xml", "db_url",
  168 #	"mysql://opensips:opensipsrw@192.168.1.3/opensips_1_3")
  169 #modparam("presence_xml", "force_active", 1)
  170 #modparam("presence", "server_address", "sip:192.168.1.2:5060")
  171 
  172 
  173 ####### Routing Logic ########
  174 
  175 
  176 # main request routing logic
  177 
  178 route{
  179 
  180 	if (!mf_process_maxfwd_header("10")) {
  181 		sl_send_reply("483","Too Many Hops");
  182 		exit;
  183 	}
  184 
  185 	if (has_totag()) {
  186 		# sequential request withing a dialog should
  187 		# take the path determined by record-routing
  188 		if (loose_route()) {
  189 			if (is_method("BYE")) {
  190 				setflag(1); # do accouting ...
  191 				setflag(3); # ... even if the transaction fails
  192 			}
  193 			route(1);
  194 		} else {
  195 			/* uncomment the following lines if you want to enable presence */
  196 			##if (is_method("SUBSCRIBE") && $rd == "your.server.ip.address") {
  197 			##	# in-dialog subscribe requests
  198 			##	route(2);
  199 			##	exit;
  200 			##}
  201 			if ( is_method("ACK") ) {
  202 				if ( t_check_trans() ) {
  203 					# non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
  204 					t_relay();
  205 					exit;
  206 				} else {
  207 					# ACK without matching transaction ... ignore and discard.\n");
  208 					exit;
  209 				}
  210 			}
  211 			sl_send_reply("404","Not here");
  212 		}
  213 		exit;
  214 	}
  215 
  216 	#initial requests
  217 
  218 	# CANCEL processing
  219 	if (is_method("CANCEL"))
  220 	{
  221 		if (t_check_trans())
  222 			t_relay();
  223 		exit;
  224 	}
  225 
  226 	t_check_trans();
  227 
  228 	# authenticate if from local subscriber (uncomment to enable auth)
  229 	##if (!($rm=="REGISTER") && is_myself("$fd"))
  230 	##{
  231 	##	if (!proxy_authorize("", "subscriber")) {
  232 	##		proxy_challenge("", "0");
  233 	##		exit;
  234 	##	}
  235 	##	if ($au!=$fU) {
  236 	##		sl_send_reply("403","Forbidden auth ID");
  237 	##		exit;
  238 	##	}
  239 	##
  240 	##	consume_credentials();
  241 	##	# caller authenticated
  242 	##}
  243 
  244 	# record routing
  245 	if (!is_method("REGISTER|MESSAGE"))
  246 		record_route();
  247 
  248 	# account only INVITEs
  249 	if (is_method("INVITE")) {
  250 		setflag(1); # do accouting
  251 	}
  252 	if (!is_myself("$rd"))
  253 	/* replace with following line if multi-domain support is used */
  254 	##if (!is_uri_host_local())
  255 	{
  256 		append_hf("P-hint: outbound\r\n"); 
  257 		# if you have some interdomain connections via TLS
  258 		##if($rd=="tls_domain1.net") {
  259 		##	t_relay("tls:domain1.net");
  260 		##	exit;
  261 		##} else if($rd=="tls_domain2.net") {
  262 		##	t_relay("tls:domain2.net");
  263 		##	exit;
  264 		##}
  265 		route(1);
  266 	}
  267 
  268 	# requests for my domain
  269 
  270 	/* uncomment this if you want to enable presence server 
  271 	   and comment the next 'if' block
  272 	   NOTE: uncomment also the definition of route[2] from  below */
  273 	##if( is_method("PUBLISH|SUBSCRIBE"))
  274 	##		route(2);
  275 
  276 	if (is_method("PUBLISH"))
  277 	{
  278 		sl_send_reply("503", "Service Unavailable");
  279 		exit;
  280 	}
  281 	
  282 
  283 	if (is_method("REGISTER"))
  284 	{
  285 		# authenticate the REGISTER requests (uncomment to enable auth)
  286 		##if (!www_authorize("", "subscriber"))
  287 		##{
  288 		##	www_challenge("", "0");
  289 		##	exit;
  290 		##}
  291 		##
  292 		##if ($au!=$tU) 
  293 		##{
  294 		##	sl_send_reply("403","Forbidden auth ID");
  295 		##	exit;
  296 		##}
  297 
  298 		if (!save("location"))
  299 			sl_reply_error();
  300 
  301 		exit;
  302 	}
  303 
  304 	if ($rU==NULL) {
  305 		# request with no Username in RURI
  306 		sl_send_reply("484","Address Incomplete");
  307 		exit;
  308 	}
  309 
  310 	# apply DB based aliases (uncomment to enable)
  311 	##alias_db_lookup("dbaliases");
  312 
  313 	if (!lookup("location")) {
  314 		switch ($retcode) {
  315 			case -1:
  316 			case -3:
  317 				t_newtran();
  318 				t_reply("404", "Not Found");
  319 				exit;
  320 			case -2:
  321 				sl_send_reply("405", "Method Not Allowed");
  322 				exit;
  323 		}
  324 	}
  325 
  326 	# when routing via usrloc, log the missed calls also
  327 	setflag(2);
  328 
  329 	route(1);
  330 }
  331 
  332 
  333 route[1] {
  334 	# for INVITEs enable some additional helper routes
  335 	if (is_method("INVITE")) {
  336 		t_on_branch("2");
  337 		t_on_reply("2");
  338 		t_on_failure("1");
  339 	}
  340 
  341 	if (!t_relay()) {
  342 		sl_reply_error();
  343 	};
  344 	exit;
  345 }
  346 
  347 
  348 # Presence route
  349 /* uncomment the whole following route for enabling presence
  350    NOTE: do not forget to enable the call of this route from the main
  351      route */
  352 ##route[2]
  353 ##{
  354 ##	if (!t_newtran())
  355 ##	{
  356 ##		sl_reply_error();
  357 ##		exit;
  358 ##	};
  359 ##
  360 ##	if(is_method("PUBLISH"))
  361 ##	{
  362 ##		handle_publish();
  363 ##		t_release();
  364 ##	}
  365 ##	else
  366 ##	if( is_method("SUBSCRIBE"))
  367 ##	{
  368 ##		handle_subscribe();
  369 ##		t_release();
  370 ##	}
  371 ##
  372 ##	exit;
  373 ##}
  374 
  375 
  376 branch_route[2] {
  377 	xlog("new branch at $ru\n");
  378 }
  379 
  380 
  381 onreply_route[2] {
  382 	xlog("incoming reply\n");
  383 }
  384 
  385 
  386 failure_route[1] {
  387 	if (t_was_cancelled()) {
  388 		exit;
  389 	}
  390 
  391 	# uncomment the following lines if you want to block client 
  392 	# redirect based on 3xx replies.
  393 	##if (t_check_status("3[0-9][0-9]")) {
  394 	##t_reply("404","Not found");
  395 	##	exit;
  396 	##}
  397 
  398 	# uncomment the following lines if you want to redirect the failed 
  399 	# calls to a different new destination
  400 	##if (t_check_status("486|408")) {
  401 	##	sethostport("192.168.2.100:5060");
  402 	##	# do not set the missed call flag again
  403 	##	t_relay();
  404 	##}
  405 }