# Please refer to the Core CookBook at http://www.openser.org/dokuwiki/doku.php # for a explanation of possible statements, functions and parameters. # # Please send comments to "Ovidiu Sas" # # # This config will work with openser 1.3 # # ----------- global configuration parameters ------------------------ ####### Global Parameters ######### debug=3 log_stderror=no fork=yes children=4 listen=eth0 ####### Modules Section ######## #set module path mpath="/usr/lib/openser/modules/" loadmodule "mysql.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "mi_fifo.so" loadmodule "uri_db.so" loadmodule "uri.so" loadmodule "xlog.so" loadmodule "carrierroute.so" # ----------------- setting module-specific parameters --------------- # ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo") # ----- carrierroute params ----- modparam("carrierroute", "db_url", "mysql://openserro:openserro@localhost/openser") modparam("carrierroute", "config_source", "db") ####### Routing Logic ######## # main request routing logic route{ if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }; if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { route(1); } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { # non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server t_relay(); exit; } else { # ACK without matching transaction ... ignore and discard.\n"); xlog("L_WARN", "[$mi] discarding ACK\n"); exit; }; }; sl_send_reply("404","Not here"); }; exit; }; #initial requests # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; }; t_check_trans(); # record routing if (!is_method("REGISTER|MESSAGE")) record_route(); if (!uri==myself) { append_hf("P-hint: outbound\r\n"); route(1); exit; }; # requests for my domain if ($rU==NULL) { # request with no Username in RURI sl_send_reply("484","Address Incomplete"); exit; } if (is_method("INVITE")) { if (cr_tree_rewrite_uri("default", "0")) { t_on_failure("11"); route(1); exit; }; exit; }; } route[1] { if (!t_relay()) { sl_reply_error(); }; exit; } onreply_route[2] { xlog("incoming reply\n"); } ###################### # "default" failover # ###################### failure_route[11] { xlog("L_INFO", "entering failure_route[11] for reply code '$T_reply_code'\n"); if (t_was_cancelled()) { exit; } if (t_check_status("408|5[0-9][0-9]")) { xlog("L_INFO","cr_tree_rewrite_uri(\"default\", \"1\");\n"); if (cr_tree_rewrite_uri("default", "1")) { t_on_failure("12"); append_branch(); route(1); }; exit; } else if (t_check_status("3[0-9][0-9]")) { t_reply("404","Not found"); exit; } } failure_route[12] { xlog("L_INFO", "entering failure_route[12] for reply code '$T_reply_code'\n"); if (t_was_cancelled()) { exit; } if (t_check_status("408|5[0-9][0-9]")) { xlog("L_INFO","cr_tree_rewrite_uri(\"default\", \"2\");\n"); if (cr_tree_rewrite_uri("default", "2")) { t_on_failure("13"); append_branch(); route(1); }; exit; } else if (t_check_status("3[0-9][0-9]")) { t_reply("404","Not found"); exit; } } failure_route[13] { xlog("L_INFO", "entering failure_route[13] for reply code '$T_reply_code'\n"); if (t_was_cancelled()) { exit; } }