debug=4 log_stderror=yes memdbg=5 memlog=5 log_facility=LOG_LOCAL0 fork=yes children=4 auto_aliases=yes port=5060 advertised_address=72.55.182.125 mpath="/usr/lib/kamailio/modules_k/:/usr/lib/kamailio/modules/" loadmodule "db_mysql.so" loadmodule "tm.so" # transactions, t_relay() loadmodule "sl.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "usrloc.so" loadmodule "siputils.so" loadmodule "textops.so" loadmodule "registrar.so" loadmodule "xlog.so" loadmodule "ctl.so" loadmodule "nathelper.so" loadmodule "avpops.so" ### Omnity major module additions end ### # ----- rr params ----- # add value to ;lr param to cope with most of the UAs modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) modparam("rr", "append_fromtag", 0) modparam("usrloc", "db_mode", 1) # @todo : Review best DB_MODE modparam("usrloc", "nat_bflag", 6) # Long delay for retransmission absorption, see ticket #12759 # RFC asks for 30 seconds, not the default 5 seconds! modparam("tm", "wt_timer", 30000 ) # @todo : Needed for SIP ping in nathelper modparam("registrar", "received_avp", "$avp(i:801)") # MySQL modparam("db_mysql", "ping_interval", 30) modparam("db_mysql", "auto_reconnect", 1) # view must have uuid, username, attribute, value, type (and domain) modparam("avpops", "avp_table", "avptable") modparam("usrloc", "db_url", "mysql://kamailio_dev:kamailio4none@192.168.41.105/kamailio_dev") modparam("avpops", "db_url", "mysql://kamailio_dev:kamailio4none@192.168.41.105/kamailio_dev") # main request routing logic route{ xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # NAT detection force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } if (method == CANCEL) { if (!t_relay_cancel()) { # implicit drop if relaying was successful, # nothing to do # corresponding INVITE transaction found but error occurred sl_reply("500", "Internal Server Error"); drop; } # bad luck, corresponding INVITE transaction is missing, # do the same as for INVITEs } # authentication # Register has it's own auth method if (is_method("SUBSCRIBE") ) { sl_send_reply(403, 'Go away'); exit ; } if (is_method("REGISTER")) { route(REGISTER); } if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { if (is_method("BYE")) { setflag(1); # do accounting ... setflag(3); # ... even if the transaction fails } route(T_RELAY); } 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"); exit; } } sl_send_reply("404","Not here"); } exit; } #initial requests if ( is_method('NOTIFY' ) ) { sl_send_reply('200', 'OK'); exit; } if (is_method("OPTIONS")) { if (uri==myself) { if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) { options_reply(); } } } # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } t_check_trans(); record_route(); if ( !lookup('location') ) { sl_send_reply('404', 'Not found'); exit; } route(T_RELAY); } route[T_RELAY] { if (!t_relay()) { sl_reply_error(); } } route[REGISTER] { # Left to handle; unregister if (!save("location" ) ) # , "0x04")) { xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); sl_reply_error(); exit; } xlog("L_INFO", "Registration successful - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); exit; }