# # $Id: ser.cfg,v 1.5 2005/05/21 19:40:43 lemp Exp $ # # simple quick-start config script # # ----------- global configuration parameters ------------------------ #debug=3 # debug level (cmd line: -dddddddddd) #fork=yes #log_stderror=no # (cmd line: -E) /* Uncomment these lines to enter debugging mode debug=7 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 fifo="/tmp/ser_fifo" mhomed=1 # ------------------ module loading ---------------------------------- # Uncomment this if you want to use dbtext database loadmodule "/usr/lib/ser/modules/dbtext.so" loadmodule "/usr/lib/ser/modules/sl.so" loadmodule "/usr/lib/ser/modules/tm.so" loadmodule "/usr/lib/ser/modules/rr.so" loadmodule "/usr/lib/ser/modules/maxfwd.so" loadmodule "/usr/lib/ser/modules/usrloc.so" loadmodule "/usr/lib/ser/modules/registrar.so" loadmodule "/usr/lib/ser/modules/inner_nathelper.so" # Uncomment this if you want digest authentication # dbtext.so must be loaded ! #loadmodule "/usr/lib/ser/modules/auth.so" #loadmodule "/usr/lib/ser/modules/auth_db.so" # ----------------- setting module-specific parameters --------------- # -- usrloc params -- #modparam("usrloc", "db_mode", 0) # Uncomment this if you want to use dbtext database # for persistent storage and comment the previous line modparam("usrloc", "db_mode", 2) modparam("usrloc", "db_url", "/var/dbtext/ser") # -- auth params -- # Uncomment if you are using auth module # #modparam("auth_db", "calculate_ha1", yes) # # If you set "calculate_ha1" parameter to yes (which true in this config), # uncomment also the following parameter) # #modparam("auth_db", "password_column", "password") # -- rr params -- # add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 1) # ------------------------- 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"); break; }; if ( msg:len > max_len ) { sl_send_reply("513", "Message too big"); break; }; # loose-route processing if (loose_route()) { t_relay(); break; }; if (method=="REGISTER") { if (src_ip==192.168.0.0/16 or src_ip==172.16.0.0/12 or src_ip==10.0.0.0/8) { if (!nat_uac_test("1")) { log(1, "Dont't like that STUN thing\n"); break; } if (uri==myself) { #wants to register only at router, no external SIP provider #log(1, "internal REGISTER\n"); #make entry at local registrar save("location"); } else { #wants to register at external SIP provider #log(1, "external REGISTER\n"); #check if user is already registered at internal registrar if (!lookup("location")) { #if not do a drive-by registration #for registration at internal registrar #without a reply save_noreply("location"); }; #Fixing of private address in contact hf fix_nated_contact("192.168.1.2"); if (!t_relay()) { sl_reply_error(); }; }; break; } else { #Handling of registrations from internet #Default is registrations not accepted break; }; }; if (src_ip==192.168.0.0/16 or src_ip==172.16.0.0/12 or src_ip==10.0.0.0/8) { if (uri==myself) { if (!lookup("location") and !lookup("aliases")) { sl_send_reply("404", "Not Found"); break; }; } else { if (!lookup("location") and !lookup("aliases")) { #log(1, "outgoing request\n"); fix_nated_contact("192.168.1.2"); if (method=="INVITE") { setflag(5); force_rtp_proxy("FAIE"); #log(1, "forcing RTP proxy IE\n"); }; t_on_reply("1"); }; }; } else { if (uri==myself) { if (lookup("location") or lookup("aliases")) { #log(1, "incoming request\n"); if (method=="INVITE") { setflag(5); force_rtp_proxy("FAEI"); #log(1, "forcing RTP proxy EI\n"); }; t_on_reply("1"); } else { sl_send_reply("404", "Not Found"); break; }; }; }; # forward to current uri now; use stateful forwarding; that # works reliably even if we forward from TCP to UDP if (!t_relay()) { sl_reply_error(); }; } onreply_route[1] { if (src_ip==192.168.0.0/16 or src_ip==172.16.0.0/12 or src_ip==10.0.0.0/8) { #log(1, "outgoing reply\n"); fix_nated_contact("192.168.1.2"); if (isflagset(5) && status =~ "(183)|2[0-9][0-9]") { force_rtp_proxy("FAIE"); }; } else { #log(1, "incoming reply\n"); if (isflagset(5) && status =~ "(183)|2[0-9][0-9]") { force_rtp_proxy("FAEI"); }; }; }