# cat ser.cfg # # $Id: ser.cfg.redundant,v 1.2 2006/06/09 19:50:34 tkramar Exp $ # # 3-rd party registrar config script # # ----------- global configuration parameters ------------------------ debug=1 # 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) server_signature=no sip_warning=no port=5060 # # Change to appropriate IP of ser box # alias="10.50.149.8" children=7 fifo="/tmp/ser_fifo" #THIS causes problem with branch when YES => NEVER NEVER NEVER set this "yes"!!!! #syn_branch=no # ------------------ module loading ---------------------------------- # Uncomment this if you want to use SQL database loadmodule "/usr/lib/ser/modules/mysql.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/uri.so loadmodule "/usr/lib/ser/modules/exec.so" loadmodule "/usr/lib/ser/modules/textops.so" loadmodule "/usr/lib/ser/modules/mediaproxy.so" loadmodule "/usr/lib/ser/modules/domain.so" # Uncomment this if you want digest authentication # mysql.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 SQL database # for persistent storage and comment the previous line modparam("usrloc", "db_mode", 2) #this is a default DB URL - no need to change so far #default timer interval is 60 sec #modparam("usrloc","timer_interval",10) #modparam("usrloc","db_url","sql://ser:heslo@localhost/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) #--- tm params --- #modparam("tm", "via1_matching", 0) modparam("mediaproxy", "natping_interval", 60) modparam("registrar", "nat_flag", 2) # ------------------------- 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 - let pass through if (loose_route()) { t_relay(); break; }; ## NVee if (method=="OPTIONS") { sl_send_reply("200", "OK"); break; }; if (method=="REGISTER") { route(1); break; }; # Force subsequent messages to pass trough this proxy #if (method == "INVITE") { # record_route(); #}; if (client_nat_test("3") && !search("^Record-Route:")) { # Mark as NAT'ed force_rport(); fix_contact(); }; # check the direction and forward to client #PUT CSN IP ADDRESS if (src_ip == 10.50.149.252) { route(2); break; }; #forwarding to the CSN based on numbering plan route(3); } #-----------------------------------------------------REGISTER route[1] { #PUT PEER SER IP ADDRESS if (src_ip == 10.50.149.5) { #-----------------------------------------------------REPLICATION FROM PEER save_noreply("location"); break; } # Mark as NAT'ed if (client_nat_test("3")) { setflag(2); force_rport(); fix_contact(); }; #PUT SER IP ADDRESS if ((!www_authorize("smartconnect.embarq.com", "subscriber")) && (!search("Expires: 0"))) { www_challenge("smartconnect.embarq.com", "0"); break; }; if ((!www_authorize("smartconnect.embarq.com", "subscriber")) && (!search("expires: 0"))) { www_challenge("smartconnect.embarq.com", "0"); break; }; ## NVee #--------------------------------------------------------REPLICATE #PUT PEER SER IP ADDRESS if (!src_ip == 10.50.149.5) { #t_replicate("10.50.149.5", "5060"); forward(10.50.149.5, 5060); } #--------------------------------------------------------CONTACT #replace contact if not STAR if (!search("Contact: \*")) { # GENERATE 200OK from SER save("location"); if ( !(search("Expires: 0") || search("expires=0")) ) { #registration remove_hf("Expires"); remove_hf("Contact"); #PUT SER BOX IP ADDRESS append_hf("Contact: ;expires=3600\r\n"); } else { #deregistration remove_hf("Expires"); remove_hf("Contact"); #PUT SER BOX IP ADDRESS append_hf("Contact: ;expires=0\r\n"); } #STAR in conact - mark this message } else { setflag(1); }; #----------------------------------------------------------SEND TO CSN #PUT CSN IP ADDRESS rewritehostport("10.50.149.252:5060"); t_relay(); if (isflagset(1)) { #erase contacts for REGISTER with STAR save_noreply("location"); }; break; } #-------------------------------------------------------------- CSN --> proxy route[2] { # native SIP destinations are handled using our USRLOC DB if (!lookup("location")) { sl_send_reply("404","Not Found"); break; } else { # forward to current uri now; use stateful forwarding; that # works reliably even if we forward from TCP to UDP t_relay(); #to adsorb retransmissions }; } #--------------------------------------------------------------- proxy --> CSN route[3] { #PUT CSN IP ADDRESS rewritehostport("10.50.149.252:5060"); ##NVee forward(uri:host, uri:port); t_relay(); } #----------------------------------------------------------------REGISTER response onreply_route[4] { #if status not 200 - remove from location #PUT PEER SER IP ADDRESS if(src_ip == 10.50.149.5) { log(1,"*************on_reply_4-FROM PEER****************\r\n"); break; } # log(1,"*************on_reply_4-FROM-CSN****************\r\n"); break; } route[5] { # proxy --> CSN #PUT CSN IP ADDRESS rewritehostport("10.50.149.252:5060"); forward(uri:host, uri:port); }