📄 mangler.cfg
字号:
## $Id: mangler.cfg,v 1.3 2003/11/20 20:53:40 andrei Exp $## simple quick-start config script## WARNING: replace PUBLIC_IP with the public ip of the nat box# (e.g.: 213.34.65.56 )# ----------- global configuration parameters ------------------------#debug=3 # debug level (cmd line: -dddddddddd)#fork=no#log_stderror=yescheck_via=no # (cmd. line: -v)dns=no # (cmd. line: -r)rev_dns=no # (cmd. line: -R)#port=5060#children=4fifo="/tmp/ser_fifo"mhomed=yesdisable_tls=yes# ------------------ module loading ----------------------------------loadmodule "modules/sl/sl.so"#loadmodule "modules/tm/tm.so"loadmodule "modules/rr/rr.so"loadmodule "modules/maxfwd/maxfwd.so"#loadmodule "modules/usrloc/usrloc.so"#loadmodule "modules/registrar/registrar.so"/* for the search() export */loadmodule "modules/textops/textops.so"loadmodule "modules/mangler/mangler.so"# Uncomment this if you want digest authentication# mysql.so must be loaded !#loadmodule "/usr/lib/ser/modules/auth.so"# ----------------- setting module-specific parameters ---------------# seting separator for encoded contactmodparam("mangler","contact_flds_separator","*")# -- usrloc params --#modparam("usrloc", "db_mode", 0)# ------------------------- request routing logic -------------------# main routing logicroute{ # initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { sl_send_reply("513", "Message too big"); break; }; record_route(); /* replace PUBLIC_IP with the public ip of the nat box (e.g.: 213.34.65.56 )*/ /* outgoing connection */ if (src_ip == 10.0.0.0/8 || src_ip == 192.168.0.0/16 ){ /* we mangle the contact address and ports in SDP part of the * message */ if (method == "INVITE"){ sdp_mangle_ip("0.0.0.0/0","PUBLIC_IP"); /* diferent mangling based on what phone we use */ if (src_ip==10.0.0.1) sdp_mangle_port("+1000"); if (src_ip==10.0.0.2) sdp_mangle_port("-1000"); }; if (search("Contact: .*@(10\.|111\.)")){ /* we seem to have a private address on a Contact which is not * valid */ encode_contact("enc_prefix","PUBLIC_IP"); }; /* #if ser is behind a NAT and NAT box has port forwarding #on port 5060 set to our ser private address ... record_route(PUBLIC_IP); */ }; /* we received something for a local phone */ if (uri=~"enc_prefix*"){ decode_contact(); }; # forward to current uri now forward(uri:host, uri:port); break;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -