# # $Id: openser.cfg,v 1.6 2006/02/15 18:23:46 bogdan_iancu Exp $ # # simple quick-start config script # # ----------- global configuration parameters ------------------------ debug=3 # debug level (cmd line: -dddddddddd) fork=yes # Set to no to enter debugging mode log_stderror=no # (cmd line: -E) Set to yes to enter debugging mode log_facility=LOG_LOCAL0 check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) listen=212.249.15.4 listen=195.129.125.74 port=5060 children=4 ###fifo="/tmp/openser_fifo" mpath="/usr/lib/openser/modules/" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so"# loadmodule "registrar.so"# loadmodule "textops.so" loadmodule "xlog.so" # loadmodule "dispatcher.so" loadmodule "mysql.so" loadmodule "acc.so" loadmodule "statistics.so" loadmodule "dialog.so" # loadmodule "pdt.so" ##########loadmodule "domain.so" ##########loadmodule "mediaproxy.so" modparam("tm", "fr_timer", 30) # timer if no reply for SIP request modparam("acc", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("acc", "db_flag", 1) # destination for accounting ("acc" table) modparam("acc", "db_missed_flag", 2) # destination for missed calls ("missed_calls" table) modparam("acc", "log_level", 1) # enable syslog output ##TODOmodparam("acc", "db_localtime", 1) # log GMT time #modparam("pdt", "db_url", "mysql://openser:openserrw@localhost/pdt") #modparam("pdt", "db_table", "pd_multidomain") ##########modparam("mediaproxy", "mediaproxy_socket", "/var/run/proxydispatcher.sock") #voir utilité #modparam("dispatcher", "list_file", "/etc/openser/dispatch.list") #modparam("dispatcher", "flags", 2) modparam("usrloc", "db_mode", 0) modparam("rr", "enable_full_lr", 1) # add value to ;lr param to make some broken UAs happy modparam("rr", "add_username", 1) # add username in record-route URI modparam("dialog", "dlg_flag", 2) #modparam("dialog", "use_tight_match", 1) route{ xlog("L_INFO","\n\n$Cbg [ $rm from $si:$sp ] $Cxx\n$mb\n$Cbg [ End of Request ] $Cxx\n\n"); #xlog("L_INFO", "$Cbx$rm\n"); t_on_reply("1"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }; if (msg:len >= 2048) { sl_send_reply("513", "Message too big"); exit; }; if(method=="REGISTER") { save("location"); exit; } if(method=="INVITE") { record_route(); } # Incoming calls if(to_uri=~"sip:\+4121550.*" || to_uri=~"sip:\+4122550.*" && !(to_uri=~"sip:.*5501122.*")) { xlog("L_ERROR","Incoming\n"); if(loose_route()) { xlog("L_NOTICE","$CrxLoose Route$Cxx\n"); t_relay(); exit; } xlog("L_NOTICE","$CrxRelaying$Cxx\n"); subst_uri("/^sip:\+/sip:/i"); rewritehost("128.179.67.35"); force_send_socket("212.249.15.4"); t_relay(); } # Outgoing calls (to fix) else { if(loose_route()) { xlog("L_NOTICE","$CrxLoose Route$Cxx\n"); if(method=="BYE" && (from_uri=~".*@212.190.89.137" || from_uri=~".*@62.189.34.7")) { xlog("L_NOTICE","$CrxBye discarded$Cxx\n"); exit; } } xlog("L_NOTICE","$CrxRelaying$Cxx\n"); subst_uri("/^sip:41([1-9][0-9]*)@.*/sip:+41\1@212.190.89.137/i"); subst("/^To:(.*)sip:41([1-9][0-9]*)@[0-9.]*/To:\1sip:+41\2@212.190.89.137/i"); force_send_socket("195.129.125.74"); t_relay(); } ########## /* if(client_nat_test("3")) { xlog("L_INFO", "$CyxClient on NAT$Cxx\n"); fix_contact(); } # 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(); if(method=="BYE" || method=="CANCEL") { xlog("L_INFO", "$CyxProxy session terminated$Cxx\n"); end_media_session(); } else { use_media_proxy(); if(retcode==-1) xlog("L_ERR", "$CyxProxying: Failed$Cxx\n"); } setflag(1); # 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"); xlog("L_INFO", "From: $fu\n"); xlog("L_INFO", "Original Dest: $tu\n"); xlog("L_INFO", "New Dest: $ruri\n"); route(1); } else route(2); */ ########## } ########## /* route[1] { # send it out now; use stateful forwarding as it works reliably # even for UDP2TCP if (!t_relay()) { xlog("L_ERR", "$CrxRelaying error!!$Cxx\n"); sl_reply_error(); } exit; } route[2] { setflag(1); t_on_reply("1"); if(method=="INVITE") { if(to_uri=~"sip:4121550*") { t_on_failure("9"); rewritehost("128.179.67.35"); xlog("L_INFO", "$CwbIncoming Call$Cxx\n"); } else { t_on_failure("1"); #rewritehost("212.203.71.228"); rewritehost("62.189.34.7"); xlog("L_INFO", "$CwbOutgoing Call$Cxx\n"); } #rewritehost("212.203.71.256"); #rewritehost("212.203.71.228"); #rewritehost("204.8.108.34"); #prefix("9950011"); } # replace domain according to prefix DB #prefix2domain("2"); xlog("L_INFO", "From: $Cbx$fu$Cxx\n"); xlog("L_INFO", "Original Dest: $Cbx$tu$Cxx\n"); xlog("L_INFO", "New Dest: $Cbx$ruri$Cxx\n"); if(!t_relay()) { sl_reply_error(); } exit; } */ ########## ########## /* failure_route[1] { setflag(2); #TODO plutot mettre tout ca dans onreply ?? organiser en tout cas if(t_check_status("488")) { xlog("Requested codecs:\n"); if(search("a=rtpmap:4 G723")) xlog("L_ERR", "G723\n"); if(search("a=rtpmap:18 G729")) xlog("L_ERR", "G729\n"); if(search("a=rtpmap:0 PCMU")) xlog("L_ERR", "PCMU\n"); if(search("a=rtpmap:8 PCMA")) xlog("L_ERR", "PCMA\n"); if(search("a=rtpmap:97 iLBC")) xlog("L_ERR", "iLBC\n"); if(search("a=rtpmap:2 G726")) xlog("L_ERR", "G726\n"); } #For some error types, don't retry but discard the call if ( t_check_status("404") || #404 Not Found t_check_status("484") || #484 Address Incomplete t_check_status("487") #487 Request Terminated ) { xlog("L_ERR", "Not retrying\n"); exit; } #Else, route the call to a different host xlog("L_ERR", "$CwrFailure Route 1 (Verizon)$Cxx\n"); t_on_failure("2"); #ds_next_domain(); #rewritehost("212.203.71.229"); rewritehost("212.190.89.137"); append_branch(); t_relay(); } failure_route[2] { if(t_check_status("488")) { xlog("Requested codecs:\n"); if(search("a=rtpmap:4 G723")) xlog("L_ERR", "G723\n"); if(search("a=rtpmap:18 G729")) xlog("L_ERR", "G729\n"); if(search("a=rtpmap:0 PCMU")) xlog("L_ERR", "PCMU\n"); if(search("a=rtpmap:8 PCMA")) xlog("L_ERR", "PCMA\n"); if(search("a=rtpmap:97 iLBC")) xlog("L_ERR", "iLBC\n"); if(search("a=rtpmap:2 G726")) xlog("L_ERR", "G726\n"); } #For some error types, don't retry but discard the call if ( t_check_status("404") || #404 Not Found t_check_status("484") || #484 Address Incomplete t_check_status("487") #487 Request Terminated ) { xlog("L_ERR", "Not retrying\n"); exit; } xlog("L_ERR", "$CwrFailure Route 2 (Arbinet)$Cxx\n"); setflag(2); t_on_failure("3"); rewritehost("204.8.108.34"); prefix("9950011"); append_branch(); t_relay(); } failure_route[3] { xlog("L_ERR", "$CwrFailure Route 3 (Arbinet)$Cxx\n"); setflag(2); t_on_failure("4"); rewritehost("204.8.108.37"); prefix("9950011"); append_branch(); t_relay(); } failure_route[4] { xlog("L_ERR", "$CwrFailure Route 4 (Arbinet)$Cxx\n"); setflag(2); t_on_failure("5"); rewritehost("204.8.108.42"); prefix("9950011"); append_branch(); t_relay(); } failure_route[5] { xlog("L_ERR", "$CwrFailure Route 5 (Arbinet)$Cxx\n"); setflag(2); t_on_failure("6"); rewritehost("204.8.108.43"); prefix("9950011"); append_branch(); t_relay(); } failure_route[6] { xlog("L_ERR", "$CwrFailure Route 6 (Arbinet)$Cxx\n"); setflag(2); t_on_failure("7"); rewritehost("204.8.108.30"); prefix("9950011"); append_branch(); t_relay(); } failure_route[7] { xlog("L_ERR", "$CwrFailure Route 7 (COLT)$Cxx\n"); setflag(2); t_on_failure("8"); rewritehost("212.203.71.229"); append_branch(); t_relay(); } failure_route[8] { setflag(2); xlog("L_ERR", "$CwrNot retrying$Cxx\n"); end_media_session(); exit(); } failure_route[9] { setflag(2); xlog("L_ERR", "$CwrNot retrying$Cxx\n"); end_media_session(); exit(); } */ ########## onreply_route[1] { xlog("L_INFO", "$Cpx[ $rr ($rs) from $si:$sp concerning $rm ]$Cxx\n"); #xlog("L_INFO", "$Cxx\n$mb\n$Cbc [ End of Reply ] $Cxx\n\n"); ########## /* if(client_nat_test("3")) { xlog("L_INFO", "$CyxClient on NAT$Cxx\n"); fix_contact(); } use_media_proxy(); if(retcode==-1) xlog("L_ERR", "$CyxProxying: Failed$Cxx\n"); */ ########## }