# ----------- global configuration parameters ------------------------ # These are standard parameters for SER # # INTERNET HOST AND PORT # # The port parameter specifies which TCP/UDP port SER should run. The # default is 5060 according to RFC 3261. # #port=5060 # # The listen parameter specifies which interface / IP address SER runs. # By default, SER listens on all interfaces. One can restrict SER to run on # IP address (e.g. 192.168.1.1), hostname (e.g. sip.some.domain) or # interface name (e.g. eth0). Multiple entries are accepted by specifying # more than one. (e.g. listen="eth0" "192.168.1.1" "sip.some.domain") # Protocol and port number are accepted as well (e.g. tcp:*:5066) # listen=eth0 # DEBUG and LOG # # The debug parameter specifies the debugging level. # #debug=4 # # The log_facility parameter specifies which syslog facility log message # is sent to. Default is to send to LOG_DAEMON. See man (8) syslog.conf # for details # log_facility=LOG_LOCAL6 # # The log_stderr parameter instruct SER to send debugging information # to stderr instand of syslog. When set to yes and fork is set to no, SER # will be running in the foreground and messages send to stderr. Default # is to send to syslog. # #log_stderror=no # DNS related parameters #check_via=no # (cmd. line: -v) #dns=no # (cmd. line: -r) #rev_dns=no # (cmd. line: -R) #reply_to_via # SERVER RELATED parameters # # The fork parameter, if set to yes, put SER into daemon mode. Otherwise, # SER will be running in the foreground. Default is yes. # #fork=yes # # The children parameter specifies how many copies of SER processes should # be start for each supported protocol and interface. Default is 8 copies # per interface for both TCP and UDP. # children=2 # sip_warning=no #server_signature=no user=ser group=apache #chroot="/var/ser" #wdir="/" #mhomed=no #advertised_address="sip.some.domain" #advertised_port=5060 #syn_branch=no #disable_core=no #open_fd_limit=1024 # FIFO related parameters # # The fifo_dir parameter specifies the directory where temporary file from # fifo_reply will be created. This has no relationship to the fifo parameter. fifo_dir="/tmp/" # # The fifo parameter specifies the FIFO file for external program (e.g. serctl) # to communicat with SER server. Default is /tmp/ser_fifo. # fifo="/var/run/ser/ser_fifo" # # The fifo_mode parameter specifies the UNIX file mask of the FIFO file. # Default is the file mask of the running user. # fifo_mode=0660 #fifo_db_url= avp_db_url="mysql://ser:heslo@localhost/ser" # UNIX Socket related parameters unix_sock="/var/run/ser/ser_sock" #unix_sock_children=1 #unix_tx_timeout=330 # TCP related parameters. #disable_tcp=no #tcp_accept_aliases=yes #tcp_children=1 #tcp_connect_timeout=10 #tcp_send_timeout=10 #alias="some.domain" # ------------------ module loading ---------------------------------- # Basic modules, common to all implementation. loadmodule "/usr/local/lib/ser/modules/sl.so" loadmodule "/usr/local/lib/ser/modules/tm.so" loadmodule "/usr/local/lib/ser/modules/rr.so" loadmodule "/usr/local/lib/ser/modules/maxfwd.so" # loadmodule "/usr/local/lib/ser/modules/mysql.so" loadmodule "/usr/local/lib/ser/modules/usrloc.so" loadmodule "/usr/local/lib/ser/modules/registrar.so" loadmodule "/usr/local/lib/ser/modules/group.so" # User authentication modules. loadmodule "/usr/local/lib/ser/modules/auth.so" # Uncomment next line for authentication via MySQL. Must load DB module first. loadmodule "/usr/local/lib/ser/modules/auth_db.so" # Uncomment next line for authentication via Radius. #loadmodule "/usr/local/lib/ser/modules/auth_radius.so" # Multi domain support loadmodule "/usr/local/lib/ser/modules/domain.so" # Other functions. loadmodule "/usr/local/lib/ser/modules/uri.so" loadmodule "/usr/local/lib/ser/modules/uri_db.so" #loadmodule "/usr/local/lib/ser/modules/uri_radius.so" loadmodule "/usr/local/lib/ser/modules/acc.so" #loadmodule "/usr/local/lib/ser/modules/vm.so" #loadmodule "/usr/local/lib/ser/modules/nathelper.so" loadmodule "/usr/local/lib/ser/modules/textops.so" loadmodule "/usr/local/lib/ser/modules/xlog.so" #loadmodule "/usr/local/lib/ser/modules/exec.so" #loadmodule "/usr/local/lib/ser/modules/options.so" # ----------------- setting module-specific parameters --------------- # -- tm params -- #modparam("tm", "fr_timer", 30) modparam("tm", "fr_inv_timer", 90) #modparam("tm", "wt_timer", 5) #modparam("tm", "delete_timer", 5) #modparam("tm", "retr_timer1p1", 1) /* default 1 */ #modparam("tm", "retr_timer1p2", 2) /* default timer1p1 * 2 */ #modparam("tm", "retr_timer1p3", 4) /* default timer1p1 * 4 */ #modparam("tm", "retr_timer2", 4) /* default 4 */ #modparam("tm", "noisy_ctimer", 0) /* default 0 (false) */ #modparam("tm", "ruri_matching", 1) /* default 1 (false) */ #modparam("tm", "via1_matching", 1) /* default 1 (false) */ #modparam("tm", "uac_from", "sipmaster@sip.domain") # -- rr params -- #modparam("rr", "append_fromtag", yes) #modparam("rr", "enable_double_rr", no) modparam("rr", "enable_full_lr", yes) # -- usrloc params -- #modparam("usrloc", "db_url", "mysql://ser:heslo@localhost/ser"); #modparam("usrloc", "db_mode", 0) /* Disable database support */ modparam("usrloc", "db_mode", 1) /* Write-Through mode */ #modparam("usrloc", "db_mode", 2) /* Write-Back mode */ modparam("usrloc", "use_domain", yes) #modparam("usrloc", "timer_interval", 60); # -- register params -- #modparam("registrar", "default_expires", 3600) #modparam("registrar", "default_q", 0) #modparam("registrar", "append_branches", yes) #modparam("registrar", "case_sensitive", no) #modparam("registrar", "desc_time_order", 0) modparam("registrar", "nat_flag", 5) #modparam("registrar", "min_expires", 60) # -- group params -- #modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "use_domain", yes) # -- exec params -- #modparam("exec", "time_to_kill", 15); #modparam("exec", "setvars", 1); # -- auth params -- #modparam("auth", "secret", "") /* default randomly generated */ #modparam("auth", "none_expire", 300) /* default 300s */ #modparam("auth", "rpid_prefix", "") /* default "" */ #modparam("auth", "rpid_suffix", "") /* default ";party=calling;id-type=subscriber;screen=yes" */ # # -- auth_db params -- #modparam("auth_db", "db_url", "mysql://ser:heslo@localhost/ser"); #modparam("auth_db", "calculate_ha1", no) /* default no */ #modparam("auth_db", "use_domain", yes) /* default yes */ #modparam("auth_db", "use_rpid", yes) /* default no */ # -- acc params -- modparam("acc", "report_cancels", no) /* default no */ modparam("acc", "report_ack", no) /* default yes */ #modparam("acc", "early_media", no) /* default no */ modparam("acc", "db_flag", 1) modparam("acc", "db_missed_flag", 1) # -- uri_db params -- #modparam("uri_db", "use_uri_table", 1) modparam("uri_db", "use_domain", yes) # -- domain params -- modparam("domain", "db_mode", 1) # -- vm params -- #modparam("voicemail", "use_domain", 1) # -- nathelper params -- modparam("nathelper", "ping_nated_only", 1) modparam("nathelper", "natping_interval", 55) modparam("nathelper", "rtpproxy_sock", "unix:/var/run/ser/rtpproxy.sock") # ------------------------- request routing logic ------------------- # main routing logic route{ xlog("L_NOTICE", "Message from [%is]: %rm <%ru> - From:<%fu> To:<%tu> Contact:%ct\n"); # 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()) { if (method=="INVITE" || method=="BYE") setflag(1); if (!t_relay()) { sl_reply_error(); }; break; }; if (method=="REGISTER") { if (!save("location")) { xlog("L_ERR", "REGISTER: Failed\n"); sl_reply_error(); }; break; }; /* Make sure all signallings go through us */ record_route(); if (is_uri_host_local()) { /* Request for user in our domain */ lookup("aliases"); if (!does_uri_exist()) { sl_send_reply("404", "User Not Found"); break; }; if (is_user_in("Request-URI", "voicemail")) { setflag(6); }; if (!lookup("location")) { if (method=="INVITE") acc_db_request("480 User Not Logon", "missed_calls"); if (method=="INVITE" && isflagset(6)) { xlog("L_NOTICE", "%rm: User not online, try vm\n"); route(2); break; } else { sl_send_reply("480", "User Not Logon"); break; }; }; }; t_on_reply("1"); /* Account Start (INVITE) and End (BYE) of calls */ if (method=="INVITE" || method=="BYE") { setflag(1); }; if (method=="INVITE" && isflagset(6)) { t_on_failure("2"); } else { t_on_failure("1"); }; xlog("L_NOTICE", "Forwarding message %rm <%ru> - From:<%fu> To:<%tu> Contact:%ct\n"); if (!t_relay()) { sl_reply_error(); }; } /* Voicemail Routine */ route[2] { sl_send_reply("181", "Forward to Voicemail"); rewriteport("5090"); if (!t_relay_to_tcp("192.168.1.45","5090")) { xlog("L_ERR", "Cannot contact Voicemail Server\n"); sl_reply_error(); }; } /* Normal Reply */ onreply_route[1] { xlog("L_NOTICE", "Reply from %is: Reply status %rs, Reply reason %rr - From:%fu To:%tu Contact:%ct\n"); } failure_route[1] { xlog("L_NOTICE", "Callee busy or DND, giving up\n"); } failure_route[2] { xlog("L_NOTICE", "Callee busy or DND, forwarding to voicemail\n"); revert_uri(); lookup("aliases"); rewriteport("5090"); append_branch(); t_relay_to_udp("192.168.1.45", "5090"); }