# # $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $ # # simple quick-start config script # # ----------- global configuration parameters ------------------------ debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E) check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4 unix_sock="/tmp/ser_sock" # ------------------ module loading ---------------------------------- loadmodule "modules/sl/sl.so" loadmodule "modules/tm/tm.so" loadmodule "modules/rr/rr.so" loadmodule "modules/maxfwd/maxfwd.so" loadmodule "modules/textops/textops.so" #loadmodule "modules/registrar/registrar.so" #loadmodule "modules/usrloc/usrloc.so" #loadmodule "modules/mysql/mysql.so" loadmodule "modules/avp/avp.so" loadmodule "modules/avpops/avpops.so" # ----------------- setting module-specific parameters --------------- # add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 1) #modparam( "avpops", "avp_url", "mysql://ser:heslo@localhost/ser" ) #modparam( "avpops", "avp_table", "subscriber" ) #modparam( "avpops", "uuid_column", "id" ) modparam( "avpops", "avp_aliases", "email=i:67" ) #modparam( "avpops", "db_scheme", "email_scheme:table=subscriber;value_col=email_address;value_type=string") # configure tm to append this when tw_appent voicemail_headers is used modparam("tm", "tw_append", "voicemail_headers:hdr[User-Agent];P-Email-Address=avp[$email]") modparam("tm", "pass_provisional_replies", 1) #modparam("usrloc", "db_mode", 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 >= 2048 ) { sl_send_reply("513", "Message too big"); break; }; # we record-route all messages -- to make sure that # subsequent messages will go through our proxy; that's # particularly good if upstream and downstream entities # use different transport protocol if (!method=="REGISTER") record_route(); # subsequent messages withing a dialog should take the # path determined by record-routing if (loose_route()) { # mark routing logic in request append_hf("P-hint: rr-enforced\r\n"); route(1); break; }; #if (!uri==myself) { # mark routing logic in request #append_hf("P-hint: outbound\r\n"); #route(1); #break; #}; # if the request is for other domain use UsrLoc # (in case, it does not work, use the following command # with proper names and addresses in it) #if (uri==myself) { if (method=="REGISTER") { sl_send_reply("200", "OK"); break; }; #lookup("aliases"); if (method != "ACK" && method != "INVITE" && method != "BYE" && method != "CANCEL"){ log("unsupported method\n"); sl_send_reply("500","unsupported method"); break; } if (!t_newtran()){ log("could not create transaction\n"); sl_send_reply("500","could not create transaction"); break; } # actively absorb ACKs if (method == "ACK") { t_relay(); break; } if (method == "INVITE" || method == "BYE" || method == "CANCEL") { if (uri =~ "sip:100.*@"){ rewriteuser("test"); if(!t_write_unix("/tmp/sems_sock", "ivr")){ t_reply("500", "error contacting sems"); } break; } if (uri =~ "sip:200.*@"){ if(!t_write_unix("/tmp/sems_sock", "announcement")){ t_reply("500", "error contacting sems"); } break; } if (uri =~ "sip:500.*@"){ if (!t_write_unix("/tmp/sems_sock", "echo")){ t_reply("500", "error contacting sems"); } break; } #avp_db_load( "$ruri", "$email/$email_scheme"); #if (!t_write_unix("/tmp/sems_sock","voicemail/voicemail_headers")){ # log("could not contact voicemail server\n"); # sl_send_reply("500","could not contact voicemail server"); # break; #} if (!t_write_unix("/tmp/sems_sock","ann_b2b")){ log("could not contact ann_b2b server\n"); sl_send_reply("500","could not contact voicemail server"); break; } } break; #}; #route(1); } route[1] { # send it out now; use stateful forwarding as it works reliably # even for UDP2TCP if (!t_relay()) { sl_reply_error(); }; } #onreply_route[1] { #if (status=~"2[0-9][0-9]"){ #force_rtp_proxy('r'); #} #}