opensips配置文件

#
# OpenSIPS residential configuration script
#     by OpenSIPS Solutions <[email protected]>
#
# This script was generated via "make menuconfig", from
#   the "Residential" scenario.
# You can enable / disable more features / functionalities by
#   re-generating the scenario with different options.#
#
# Please refer to the Core CookBook at:
#      http://www.opensips.org/Resources/DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#




####### Global Parameters #########


log_level=3
log_stderror=no
log_facility=LOG_LOCAL0


children=1


/* uncomment the following lines to enable debugging */
debug_mode=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


/* comment the next line to enable the auto discovery of local aliases
   based on revers DNS on IPs */
auto_aliases=no




listen=udp:10.100.93.48:5060 # CUSTOMIZE ME




####### Modules Section ########


#set module path
#mpath="/usr/local/lib/opensips/modules/"
mpath="/usr/local/opensips/lib64/opensips/modules"


#### SIGNALING module
loadmodule "signaling.so"


#### StateLess module
loadmodule "sl.so"


#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 5)
modparam("tm", "fr_inv_timeout", 30)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)


#### Record Route Module
loadmodule "rr.so"
/* do not append from tag to the RR (no need for this script) */
modparam("rr", "append_fromtag", 0)


#### MAX ForWarD module
loadmodule "maxfwd.so"


#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"


#### FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)


#### URI module
loadmodule "uri.so"
modparam("uri", "use_uri_table", 0)


#### POSTGRES module
loadmodule "db_mysql.so"


#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url",
"mysql://opensips:[email protected]/opensips") # CUSTOMIZE ME




#### REGISTRAR module
loadmodule "registrar.so"
modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
modparam("registrar", "received_avp", "$avp(received_nh)")/* uncomment the next line not to allow more than 10 contacts per AOR */
#modparam("registrar", "max_contacts", 10)




#### AUTHentication modules
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db|uri", "db_url",
"mysql://opensips:[email protected]/opensips") # CUSTOMIZE ME
modparam("auth_db", "load_credentials", "")


#### ALIAS module
loadmodule "alias_db.so"
modparam("alias_db", "db_url",
"mysql://opensips:[email protected]/opensips") # CUSTOMIZE ME


#### DIALOG module
loadmodule "dialog.so"
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "default_timeout", 21600)  # 6 hours timeout
modparam("dialog", "db_mode", 2)
modparam("dialog", "db_url",
"mysql://opensips:[email protected]/opensips") # CUSTOMIZE ME




loadmodule "proto_udp.so"




####### Routing Logic ########


# main request routing logic


route {
if (!mf_process_maxfwd_header("10")) {
send_reply("483","Too Many Hops");
exit;
}

if (has_totag()) {
if (!loose_route()) {
send_reply("404", "Not here");
exit;
}
}

if (is_method("CANCEL")) {
if (t_check_trans()) {
t_relay();
}
exit;
}


if (is_method("REGISTER")) {
if (!www_authorize("", "subscriber")) {
www_challenge("", "0");
exit;
}
if (!save("location")) {
sl_reply_error();
}
exit;
}

if (is_method("PUBLISH|SUBSCRIBE")) {
sl_send_reply("200", "OK");
exit;
}


if (is_method("INVITE")) {
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
exit;
}
}

t_check_trans();
record_route();

route(relay);
}




route[relay] {
if (!t_relay()) {
send_reply("500","Internal Error");
}
exit;
}

猜你喜欢

转载自blog.csdn.net/daitu3201/article/details/80916985