###################################################################### # SER Config File ###################################################################### ###################################################################### # Global prams ###################################################################### /* 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" ###################################################################### # Load Modules ###################################################################### loadmodule "/usr/lib/ser/modules/mysql.so" /*MySQL DB Module*/ loadmodule "/usr/lib/ser/modules/sl.so" /*Stateless routing*/ loadmodule "/usr/lib/ser/modules/tm.so" /*Statefull routing*/ loadmodule "/usr/lib/ser/modules/rr.so" /*Record Routing*/ loadmodule "/usr/lib/ser/modules/maxfwd.so" /*Max-fwd header logic*/ loadmodule "/usr/lib/ser/modules/usrloc.so" /*User Location*/ loadmodule "/usr/lib/ser/modules/registrar.so" /*SIP Register functions*/ loadmodule "/usr/lib/ser/modules/exec.so" /*Execute external commands*/ loadmodule "/usr/lib/ser/modules/auth.so" /*User authentication*/ loadmodule "/usr/lib/ser/modules/auth_db.so" /*User auth. using MySQL DB*/ loadmodule "/usr/lib/ser/modules/group.so" /*Group commands*/ ###################################################################### # Module Params ###################################################################### # -- usrloc params -- modparam("usrloc", "db_mode", 2) modparam("usrloc", "db_url", "sql://user:pass@localhost/ser") # -- auth params -- modparam("auth_db", "db_url", "sql://user:pass@localhost/ser") modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") # -- rr params -- # add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 0) # -- group params -- modparam("group", "db_url", "sql://user:pass@localhost/ser") ###################################################################### # Server Aliases ###################################################################### alias="mcm.net.mx" alias="X.X.81.94" ###################################################################### # Main Routing Logic ###################################################################### route{ # Initial sanity checks if (!mf_process_maxfwd_header("15")) { sl_send_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { sl_send_reply("513", "Message too big"); break; }; if (loose_route()) { setflag(2); t_relay(); break; }; record_route(); # Registering routines if (method=="REGISTER") { if (!www_authorize("mcm.net.mx", "subscriber")) { www_challenge("mcm.net.mx", "0"); log(1,"User Rejected, challenge sent."); break; }; save("location"); break; }; # Check the source of call and auth. if required # If the call comes from the gateways, no authentication is # required (X.X.81.67 or X.X.84.67) if (src_ip==X.X.81.67 or src_ip==X.X.84.67) { # Check if the user accept calls log(1,"Call from pstn. \n"); } else { if (method=="INVITE") { if (!proxy_authorize("mcm.net.mx", "subscriber")) { proxy_challenge("mcm.net.mx", "0"); break; }; }; # INVITE to authorized PSTN } # Routing plan if (uri=~"^sip:5559853[0-9][0-9][0-9]@.*") { if (!lookup("location")) { if (is_user_in("Request-URI", "hg")) { exec_dset("/usr/scripts/huntgroup2 $SIP_ORUI 1 "); if (uri=~"^sip:[0-9]+@.*") { append_branch(); # Set fealiure route for Hunt Groups t_on_failure("1"); t_relay(); }; } else { setflag(3); sl_send_reply("404", "Not Found"); break; }; } else { if ( is_user_in("Request-URI", "hg") ) { # Set fealiure route for Hunt Groups t_on_failure("1"); }; # Try to send call to dest. if (!t_relay()) { sl_reply_error(); }; }; # Forward numeric uri's to PSTN gateways } else if (uri=~"^sip:[0|1|2|3|5|8|9][0-9]*@.*") { rewritehost("X.X.81.67"); t_relay(); } else { sl_send_reply("403", "Call cannot be served here"); break; }; } # Hunt group routes failure_route[1] { log(1,"First number bysy, try next.\n"); # forwarding failed -- try again at another destination exec_dset("/usr/scripts/huntgroup2 $SIP_ORUI 1 "); append_branch(); if (uri=~"^sip:[0-9]+@.*") { # Set next faliure route t_on_failure("2"); }; t_relay(); } failure_route[2] { log(1,"Next number busy, try next.\n"); # forwarding failed -- try again at another destination exec_dset("/usr/scripts/huntgroup2 $SIP_ORUI 0 "); append_branch(); if (uri=~"^sip:[0-9]+@.*") { t_on_failure("2"); }; t_relay(); } ###################################################################### # End SER Config File ######################################################################