# # $Id: mangler.cfg 1514 2007-01-16 17:01:22Z bogdan_iancu $ # # 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=yes check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 mhomed=yes # ------------------ module loading ---------------------------------- loadmodule "modules/sl/sl.so" loadmodule "modules/rr/rr.so" loadmodule "modules/maxfwd/maxfwd.so" loadmodule "modules/textops/textops.so" loadmodule "modules/mangler/mangler.so" loadmodule "modules/mi_fifo/mi_fifo.so" # ----------------- setting module-specific parameters --------------- modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo") # seting separator for encoded contact modparam("mangler","contact_flds_separator","*") # ------------------------- request routing logic ------------------- # main routing logic route{ # 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"); exit; }; if ( msg:len > max_len ) { sl_send_reply("513", "Message too big"); exit; }; 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(); break; }