Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- debug=6
- log_stderror=no
- log_facility=LOG_LOCAL0
- fork=yes
- children=4
- /* uncomment the following lines to enable debugging */
- #debug=6
- #log_stderror=yes
- /* uncomment the next line to disable TCP (default on) */
- #disable_tcp=yes
- /* uncomment the next line to enable the auto temporary blacklisting of
- not available destinations (default disabled) */
- #disable_dns_blacklist=no
- /* uncomment the next line to enable IPv6 lookup after IPv4 dns
- lookup failures (default disabled) */
- #dns_try_ipv6=yes
- /* uncomment the next line to disable the auto discovery of local aliases
- based on revers DNS on IPs (default on) */
- #auto_aliases=no
- /* uncomment the following lines to enable TLS support (default off) */
- #disable_tls = no
- #listen = tls:your_IP:5061
- #tls_verify_server = 1
- #tls_verify_client = 1
- #tls_require_client_certificate = 0
- #tls_method = TLSv1
- #tls_certificate = "//etc/opensips/tls/user/user-cert.pem"
- #tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"
- #tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"
- /* default db_url to be used by modules requiring DB connection;
- uncomment it if you use any module requiring DB connectivity */
- db_default_url="mysql://xxxxx:xxxxx@localhost/opensips"
- /*
- INTERFACE BINDING
- */
- port=5060
- listen=udp:10.195.100.5:5060
- listen=tcp:10.195.100.5:5061
- listen=tls:10.195.100.5:5062
- ####### Modules Section ########
- #set module path
- mpath="//lib/opensips/modules/"
- loadmodule "db_mysql.so"
- loadmodule "signaling.so"
- loadmodule "sl.so"
- loadmodule "tm.so"
- loadmodule "rr.so"
- loadmodule "maxfwd.so"
- loadmodule "usrloc.so"
- loadmodule "registrar.so"
- loadmodule "textops.so"
- loadmodule "mi_fifo.so"
- loadmodule "uri.so"
- loadmodule "acc.so"
- loadmodule "domain.so"
- loadmodule "drouting.so"
- # ----------------- setting module-specific parameters ---------------
- # ----- mi_fifo params -----
- modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
- # ----- rr params -----
- modparam("rr", "append_fromtag", 0)
- # ----- usrloc params -----
- modparam("usrloc", "db_mode", 0)
- modparam("usrloc", "db_mode", 2)
- modparam("usrloc", "db_url", "mysql://xxxxx:xxxxx@localhost/opensips")
- # ----- uri params -----
- modparam("uri", "use_uri_table", 0)
- # ----- acc params -----
- modparam("acc", "early_media", 1)
- modparam("acc", "report_cancels", 1)
- modparam("acc", "detect_direction", 0)
- modparam("acc", "failed_transaction_flag", 3)
- modparam("acc", "log_flag", 1)
- modparam("acc", "log_missed_flag", 2)
- modparam("acc", "db_flag", 1)
- modparam("acc", "db_missed_flag", 2)
- # ----- domain params -----
- modparam("domain", "db_url", "mysql://xxxxx:xxxxx@localhost/opensips")
- modparam("domain", "db_mode", 1) # Use caching
- # ----- multi-module params -----
- modparam("auth_db|usrloc|uri", "use_domain", 1)
- # ----- drouting params -----
- modparam("drouting", "db_url", "mysql://xxxxx:xxxxx@localhost/opensips")
- modparam("drouting", "use_domain", 1)
- modparam("drouting", "probing_interval", 60)
- modparam("drouting", "probing_from", "sip:pinger@10.195.100.5")
- modparam("drouting", "probing_method", "OPTIONS")
- modparam("drouting", "probing_reply_codes", "501, 403, 404")
- ####### Routing Logic ########
- # main request routing logic
- route{
- if (!mf_process_maxfwd_header("10")) {
- xlog("DEBUG: Failed the loop test!\n");
- sl_send_reply("483","Too Many Hops");
- exit;
- }
- if (is_method("INVITE")) {
- xlog("DEBUG: INVITE message...\n");
- setflag(1); # do accounting
- record_route();
- route(4); # Call our dynamic route.
- }
- if (has_totag()) {
- xlog("DEBUG: HAS TOTAG...\n");
- # if this is a sequential request, use the recorded route
- if(loose_route()) {
- if (is_method("BYE")) {
- setflag(1); # do accounting
- setflag(3); # ... even if the transaction fails
- } else if (is_method("INVITE"))
- {
- setflag(1); # do accounting
- record_route(); # record the route
- route(4); # route it dynamically
- }
- # If it's neither an INVITE or BYE, use the recorded route in loose_route()
- route(1);
- } else {
- # if it's an ACK message
- if (is_method("ACK")) {
- # check to see if it's a transaction we know about
- if (t_check_trans()) {
- # it's not loosely routed, but it is stateful -- forward it
- t_relay();
- exit; # we're done
- } else {
- # if we don't know which transaction the ACK is to, discard
- exit; # we're done
- }
- }
- # if it isn't loosely routed, and it isn't an ACK
- sl_send_reply("404", "Not here");
- }
- # if we get here, we don't know what the heck it is, discard
- exit;
- }
- #initial requests
- # CANCEL processing
- if (is_method("CANCEL"))
- {
- xlog("DEBUG: Message Canceled!\n");
- if (t_check_trans())
- t_relay();
- exit;
- }
- t_check_trans();
- # preloaded route checking
- if (loose_route()) {
- xlog("L_ERR",
- "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
- if (!is_method("ACK"))
- sl_send_reply("403","Preload Route denied");
- exit;
- }
- # record routing
- if (!is_method("REGISTER|MESSAGE"))
- record_route();
- # outbound
- if (!is_uri_host_local())
- {
- xlog("DEBUG: Hit the if !is_uri_host_local statement!\n");
- append_hf("P-hint: outbound\r\n");
- route(1);
- }
- if (is_method("PUBLISH"))
- {
- sl_send_reply("503", "Service Unavailable");
- exit;
- }
- if (is_method("REGISTER"))
- {
- if (!save("location"))
- sl_reply_error();
- exit;
- }
- if ($rU==NULL) {
- # request with no Username in RURI
- sl_send_reply("484","Address Incomplete");
- exit;
- }
- # do lookup with method filtering
- if (!lookup("location","m")) {
- switch ($retcode) {
- case -1:
- case -3:
- t_newtran();
- t_reply("404", "Not Found");
- exit;
- case -2:
- sl_send_reply("405", "Method Not Allowed");
- exit;
- }
- }
- # when routing via usrloc, log the missed calls also
- setflag(2);
- route(1);
- }
- route[1] {
- xlog("DEBUG: >>>BEGIN: route[1] Block -->\n");
- # for INVITEs enable some additional helper routes
- if (is_method("INVITE")) {
- t_on_branch("2");
- t_on_reply("2");
- t_on_failure("1");
- }
- if (!t_relay()) {
- xlog("DEBUG: route[1] Block: Failed to relay-->!\n");
- sl_reply_error();
- };
- exit;
- }
- # drouting route
- route[4] {
- #log that we're trying dynamically at least
- xlog("DEBUG: >>>BEGIN: route[4] Block -->\n");
- if (!do_routing("0")) {
- xlog("!do_routing: No Rules matching the URI\n");
- send_reply("503", "No Rules matching the URI");
- exit;
- }
- if (is_method("INVITE")) {
- t_on_failure("4");
- }
- route(1);
- }
- branch_route[2] {
- xlog("new branch at $ru\n");
- }
- onreply_route[2] {
- xlog("incoming reply\n");
- }
- failure_route[1] {
- xlog("DEBUG: failure_route[1] Block-->!\n");
- if (t_was_cancelled()) {
- exit;
- }
- }
- failure_route[4] {
- xlog("DEBUG: Hit the DRouting failure route!\n");
- if (t_was_cancelled()) {
- exit;
- }
- if (t_check_status("[34][0-9][0-9]")) {
- exit;
- }
- if (use_next_gw()) {
- t_relay();
- exit;
- } else {
- t_reply ("503", "Service not available");
- exit;
- }
- }
Add Comment
Please, Sign In to add comment