the script didn't fit, here it is:<br><br>#<br># $Id: openser.cfg 1676 2007-02-21 13:16:34Z bogdan_iancu $<br>#<br># simple quick-start config script<br># Please refer to the Core CookBook at <a href="http://www.openser.org/dokuwiki/doku.php">http://www.openser.org/dokuwiki/doku.php</a><br>
# for a explanation of possible statements, functions and parameters.<br>#<br><br># ----------- global configuration parameters ------------------------<br><br>debug=3 # debug level (cmd line: -dddddddddd)<br>fork=yes<br>
log_stderror=no # (cmd line: -E)<br>children=10<br>port=5060<br>listen=<a href="http://MY.OPENSER.IP.COM">MY.OPENSER.IP.COM</a><br>disable_dns_blacklist=true<br><br># ------------------ module loading ----------------------------------<br>
#set module path<br>mpath="//lib/openser/modules/"<br><br># Uncomment this if you want to use SQL database<br>#loadmodule "mysql.so"<br><br>loadmodule "mysql.so"<br>loadmodule "sl.so"<br>
loadmodule "tm.so"<br>loadmodule "rr.so"<br>loadmodule "maxfwd.so"<br>loadmodule "usrloc.so"<br>loadmodule "registrar.so"<br>loadmodule "textops.so"<br>loadmodule "uri.so"<br>
loadmodule "uri_db.so"<br>loadmodule "domain.so"<br>loadmodule "permissions.so"<br>#loadmodule "group.so"<br>loadmodule "mi_fifo.so"<br>loadmodule "lcr.so"<br>loadmodule "avpops.so"<br>
loadmodule "xlog.so"<br>loadmodule "mediaproxy.so"<br>loadmodule "acc.so"<br><br># Uncomment this if you want digest authentication<br># mysql.so must be loaded !<br>loadmodule "auth.so"<br>
loadmodule "auth_db.so"<br><br># ----------------- setting module-specific parameters ---------------<br><br>modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")<br><br>modparam("registrar", "received_avp", "$avp(i:42)")<br>
<br>modparam("usrloc", "db_mode", 2)<br>modparam("usrloc", "nat_bflag", 4) <br><br>modparam("auth_db", "calculate_ha1", 1)<br>modparam("auth_db", "password_column", "password")<br>
<br>modparam("rr", "enable_full_lr", 1)<br><br>#modparam("auth_db|permissions|uri_db|usrloc","db_url","mysql://openser:openserrw@localhost/openser")<br>modparam("auth_db|permissions|usrloc|uri_db|domain|lcr|avpops|avp_url","db_url","mysql://openser:password@localhost/openser")<br>
<br>modparam("permissions", "db_mode", 1)<br>modparam("permissions", "trusted_table", "trusted")<br><br>modparam("avpops", "avp_table", "usr_preferences")<br>
<br>modparam("mediaproxy","natping_interval",20)<br>modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy/mediaproxy.sock")<br>modparam("mediaproxy","sip_asymmetrics","/etc/openser/sip-clients")<br>
modparam("mediaproxy","rtp_asymmetrics","/ect/openser/rtp-clients")<br><br>modparam("lcr", "contact_avp", "$avp(i:711)")<br>modparam("lcr|tm", "fr_inv_timer_avp", "$avp(i:704)")<br>
modparam("lcr", "gw_uri_avp", "$avp(i:709)")<br>modparam("^auth$|lcr", "rpid_avp", "$avp(i:302)")<br>modparam("lcr", "ruri_user_avp", "$avp(i:500)")<br>
modparam("lcr", "dm_flag", 25)<br><br>modparam("acc", "radius_config", "/etc/radiusclient-ng/radiusclient.conf")<br>modparam("acc", "radius_flag", 2)<br>
modparam("acc", "radius_missed_flag", 3)<br>modparam("acc", "radius_extra", "User-Name=$Au;Calling-Station-Id=$from;Called-Station-Id=$to;Sip-Translated-Request-URI=$ruri;Sip-RPid=$avp(s:rpid);Source-IP=$si;Source-Port=$sp;Canonical-URI=$avp(s:can_uri);Billing-Party=$avp(s:billing_party);Divert-Reason=$avp(s:divert_reason);X-RTP-Stat=$hdr(X-RTP-Stat);Contact=$hdr(contact);Event=$hdr(event);SIP-Proxy-IP=$avp(s:sip_proxy_ip);ENUM-TLD=$avp(s:enum_tld)")<br>
# ------------------------- request routing logic -------------------<br><br># main routing logic<br><br>route{<br><br> #<br> # -- 1 -- Request Validation <br> #<br> if (!mf_process_maxfwd_header("10")) {<br>
sl_send_reply("483","Too Many Hops");<br> exit;<br> };<br><br> if (msg:len >= 2048 ) {<br> sl_send_reply("513", "Message too big");<br> exit;<br>
};<br><br> #<br> # -- 2 -- Routing Preprocessing<br> #<br> ## Record-route all except Register<br> ## Mark packets with nat=yes<br> ## This mark will be used to identify the request in the loose <br>
## route section<br> if(!is_method("REGISTER")){<br> record_route(";nat=yes");<br> };<br><br> ##Loose_route packets<br> if (has_totag()) {<br> #sequential request withing a dialog should<br>
# take the path determined by record-routing<br> if (loose_route()) {<br> if(method=="BYE") {<br> #Account BYE transactions<br> setflag(2);<br>
};<br> <br> #Check authentication of re-invites<br> if(method=="INVITE" && (!allow_trusted())) { <br> if (!proxy_authorize("","subscriber")) {<br>
proxy_challenge("","1");<br> exit;<br> } else if (!check_from()) {<br> sl_send_reply("403", "Forbidden, use From=ID");<br>
exit;<br> };<br> };<br> if(method=="BYE" || method=="CANCEL") {<br> end_media_session();<br> };<br><br> ##Detect requests in the dialog behind NAT and flag with 6<br>
route(1);<br> } else {<br> sl_send_reply("404","Not here");<br> }<br> exit;<br> }<br><br> #CANCEL processing<br> if (is_method("CANCEL")) {<br>
if (t_check_trans()) {<br> end_media_session(); <br> t_relay();<br> }; <br> exit;<br> }<br><br> t_check_trans();<br> # <br> # -- 3 -- Determine Request Target<br>
#<br> if (method=="REGISTER") {<br> route(2);<br> } else {<br> route(3);<br> };<br>}<br><br><br>route[1] {<br> #<br> # -- 4 -- Forward request to target<br> #<br> # Forward statefully<br>
t_on_reply("1");<br> t_on_failure("1");<br> if (!t_relay()) {<br> sl_reply_error();<br> };<br> exit;<br>}<br><br>route[2] {<br> ## Register request handler<br> if (is_uri_host_local()) {<br>
if (!www_authorize("", "subscriber")) {<br> www_challenge("", "1");<br> exit;<br> };<br><br> if (!check_to()) {<br> sl_send_reply("403", "Forbidden");<br>
exit;<br> };<br><br> setbflag(6);<br> force_rport();<br> save("location");<br> exit;<br><br> } else if {<br><br> sl_send_reply("403", "Forbidden");<br>
<br> };<br>}<br><br>route[3] {<br> ## Requests handler <br><br> if (method=="INVITE") {<br> # Account INVITE packets<br> setflag(2);<br> # Account Missed calls<br> setflag(3);<br>
# Radius Extra<br> $avp(s:sip_proxy_ip)="<a href="http://MY.OPENSER.IP.COM">MY.OPENSER.IP.COM</a>";<br> };<br><br> if (is_from_local()){<br> # From an internal domain -> check the credentials and the FROM<br>
if(!allow_trusted()){<br> if (!proxy_authorize("","subscriber")) {<br> proxy_challenge("","0");<br> exit;<br> } else if(!check_from()) {<br>
sl_send_reply("403", "Forbidden, use From=ID");<br> exit;<br> }; <br> };<br><br> #unconditional call forward<br> if(avp_db_load("$ru/username","$avp(s:callfwd)")) {<br>
avp_pushto("$ru", "$avp(s:callfwd)");<br> route(1);<br> exit;<br> }<br> <br> consume_credentials();<br> <br> #verify aliases, if found replace R-URI. <br>
lookup("aliases");<br> <br> if (is_uri_host_local()) {<br> # -- Inbound to Inbound<br> xlog("L_INFO","OPENSER: INBOUND -> INBOUND ($tU)");<br>
route(10);<br> } else {<br> # -- Inbound to outbound<br> xlog("L_INFO","OPENSER: INBOUND -> OUTBOUND ($tU)");<br> route(11);<br> };<br><br>
} else {<br><br> #From an external domain ->do not check credentials<br> #Verify aliases, if found replace R-URI. <br> lookup("aliases");<br> if (is_uri_host_local()) {<br>
xlog("L_INFO","OPENSER: OUTBOUND -> INBOUND ($tU)");<br> #-- Outbound to inbound<br> route(12);<br> } else {<br> xlog("L_INFO","OPENSER: OUTBOUND -> OUTBOUND ($tU)");<br>
# -- Outbound to outbound<br> route(13);<br> };<br> };<br>}<br><br>route[4] {<br> # routing to the public network<br> if (!load_gws()) {<br> sl_send_reply("503", "Unable to load gateways");<br>
exit;<br> }<br> <br> if(!next_gw()){<br> sl_send_reply("503", "Unable to find a gateway");<br> exit;<br> }<br> t_on_failure("2");<br> if (!t_relay()) {<br>
sl_reply_error();<br> };<br> exit;<br>}<br><br>route[6] {<br> #<br> # -- NAT handling --<br> #<br> append_hf("P-hint: Route[6]: mediaproxy \r\n");<br> use_media_proxy();<br>}<br><br>
route[10] {<br> #from an internal domain -> inbound<br> #Native SIP destinations are handled using the location table<br> #Gateway destinations are handled by regular expressions<br> append_hf("P-hint: inbound->inbound \r\n");<br>
<br> xlog("L_INFO","LOOKING FOR: $tU");<br> if (uri=~"^sip:55613") { # ECHO TEST<br> xlog("L_INFO","IN ROUTE 613");<br> route(6);<br> rewritehostport("<a href="http://fwdnat2.pulver.com:5060">fwdnat2.pulver.com:5060</a>");<br>
if (!t_relay()) {<br> sl_reply_error();<br> };<br> exit;<br> };<br><br> if (uri=~"^sip:301") { # ECHO TEST<br> route(6);<br> rewritehostport("<a href="http://blueface.ie">blueface.ie</a>");<br>
if (!t_relay()) {<br> sl_reply_error();<br> };<br> exit;<br> };<br><br>#<br># if (uri=~"^sip:1[2-9][0-9]{9}@") {<br># if (is_user_in("credentials","ld")) {<br>
# strip(1);<br># prefix("+1");<br># route(6);<br># route(4);<br># exit;<br># } else {<br># sl_send_reply("403", "No permissions for long distance");<br>
# exit;<br># };<br># };<br>#<br># if (uri=~"^sip:011[0-9]*@") {<br># if (is_user_in("credentials","int")) {<br># strip(3);<br># prefix("+");<br>
# route(6);<br># route(4);<br># exit;<br># } else {<br># sl_send_reply("403", "No permissions for international calls");<br># };<br># };<br>
<br> if (!lookup("location")) {<br> if (does_uri_exist()) {<br> ## User not registered at this time.<br> ## Use the IP Address of your e-mail server<br> revert_uri();<br>
prefix("u");<br> rewritehostport("<a href="http://192.168.1.171">192.168.1.171</a>"); #Use the IP address of your voicemail server<br> route(6);<br> route(1);<br>
} else {<br> sl_send_reply("404", "Not Found");<br> exit;<br> } <br> sl_send_reply("404", "Not Found");<br> exit;<br> };<br> route(6); <br>
route(1);<br>}<br><br>route[11] {<br> # from an internal domain -> outbound<br> # Simply route the call outbound using DNS search<br> append_hf("P-hint: inbound->outbound \r\n");<br> route(1);<br>
}<br><br>route[12] {<br> # From an external domain -> inbound<br> # Verify aliases, if found replace R-URI.<br> lookup("aliases");<br> if (!lookup("location")) {<br> sl_send_reply("404", "Not Found");<br>
exit;<br> };<br> route(1);<br>}<br><br>route[13] {<br> #From an external domain outbound<br> #we are not accepting these calls<br> append_hf("P-hint: outbound->inbound \r\n");<br>
sl_send_reply("403", "Forbidden");<br> exit;<br>}<br><br>failure_route[1] {<br> ##--<br> ##-- If cancelled, exit. <br> ##--<br> if (t_was_cancelled()) {<br> exit;<br> };<br>
##--<br> ##-- If busy send to the e-mail server, prefix the "b"<br> ##-- character to indicate busy. <br> ##--<br> if (t_check_status("486")) {<br> revert_uri();<br> prefix("b");<br>
rewritehostport("<a href="http://192.168.1.171">192.168.1.171</a>");<br> append_branch();<br> route(1);<br> exit;<br> };<br> ##--<br> ##-- If timeout (408) or unavailable temporarily (480),<br>
##-- prefix the uri with the "u"character to indicate <br> ##-- unanswered and send to the e-mail<br> ##-- sever<br> ##--<br> if (t_check_status("408") || t_check_status("480")) {<br>
revert_uri();<br> prefix("u");<br> rewritehostport("<a href="http://192.168.1.171">192.168.1.171</a>");<br> append_branch();<br> route(1);<br> exit;<br> };<br>
}<br><br>failure_route[2] {<br> if(!next_gw()) {<br> t_reply("503", "Service not available, no more gateways");<br> exit;<br> };<br> t_on_failure("2");<br> t_relay();<br>
}<br><br><br>onreply_route[1] {<br>#<br>#-- On-replay block routing --<br>#<br> append_hf("P-hint: onreply_route|usemediaproxy \r\n");<br> use_media_proxy();<br> exit;<br>}<br><br><br><br><br>