Hi Bogdan,<br> Thanks for the reply. I'm still somewhat lost on the second point you told me.<br> <br> <pre><tt>>Second, BYE is an within the dialog request so you need to do <br>>loose_route() for it, Just relaying it based on RURI is not correct at <br>>all.<br><br><br>Does that mean in my loose route I have to have something like this:<br><br>If(method=="BYE")<br>{<br> route(1);<br> exit;<br>}<br><br>Here is my updated openser.cfg. Also, am I suppose to exit after<br>a forbidden meesage or error messages? <br>Or should I return? Please advise me. Thank you.<br><br>debug=3<br>fork=yes<br>log_stderror=no<br><br>listen=192.168.1.5 # INSERT YOUR IP ADDRESS HERE<br>alias=test.com<br>port=5060<br>children=4<br><br>dns=no<br>rev_dns=no<br>fifo="/tmp/openser_fifo"<br>fifo_db_url="mysql://openser:openserrw@localhost/openser"<br><br>loadmodule "/usr/local/lib/openser/modules/mysql.so"<br>loadmodule "/usr/local/lib/openser/modules/sl.so"<br>loadmodule
"/usr/local/lib/openser/modules/tm.so"<br>loadmodule "/usr/local/lib/openser/modules/rr.so"<br>loadmodule "/usr/local/lib/openser/modules/maxfwd.so"<br>loadmodule "/usr/local/lib/openser/modules/usrloc.so"<br>loadmodule "/usr/local/lib/openser/modules/registrar.so"<br>loadmodule "/usr/local/lib/openser/modules/auth.so"<br>loadmodule "/usr/local/lib/openser/modules/auth_db.so"<br>loadmodule "/usr/local/lib/openser/modules/uri.so"<br>loadmodule "/usr/local/lib/openser/modules/uri_db.so"<br>loadmodule "/usr/local/lib/openser/modules/nathelper.so"<br>loadmodule "/usr/local/lib/openser/modules/avpops.so"<br>loadmodule "/usr/local/lib/openser/modules/textops.so"<br>loadmodule "/usr/local/lib/openser/modules/xlog.so"<br><br>modparam("auth_db|uri_db|usrloc", "db_url",<br> "mysql://openser:openserrw@localhost/openser")<br>modparam("auth_db", "calculate_ha1", 1)<br>modparam("auth_db", "password_column", "password")<br><br>modparam("nathelper", "natping_interval", 30)
<br>modparam("nathelper", "ping_nated_only", 1) <br>modparam("nathelper", "rtpproxy_sock", "/var/run/rtpproxy.sock")<br><br>modparam("usrloc", "db_mode", 2)<br><br>modparam("registrar", "nat_flag", 6)<br><br>modparam("rr", "enable_full_lr", 1)<br><br>modparam("tm", "fr_inv_timer", 27)<br>modparam("tm", "fr_inv_timer_avp", "inv_timeout")<br><br>route {<br><br> # -----------------------------------------------------------------<br> # Sanity Check Section<br> # -----------------------------------------------------------------<br> if (!mf_process_maxfwd_header("10")) {<br> sl_send_reply("483", "Too Many Hops");<br> exit;<br> };<br><br> if (msg:len > max_len) {<br> sl_send_reply("513", "Message Overflow");<br> exit;<br> };<br><br> # -----------------------------------------------------------------<br> # Record Route Section<br> # -----------------------------------------------------------------<br> if (method!="REGISTER") {<br> record_route();<br> };<br><br> if
(method=="BYE" || method=="CANCEL") {<br> unforce_rtp_proxy();<br> t_relay();<br> exit;<br> } <br><br> # -----------------------------------------------------------------<br> # Loose Route Section<br> # -----------------------------------------------------------------<br> if (loose_route()) {<br><br> if ((method=="INVITE" || method=="REFER") && !has_totag()) {<br> sl_send_reply("403", "Forbidden");<br> return;<br> };<br><br> if (method=="INVITE") {<br><br> if (!proxy_authorize("","subscriber")) {<br> proxy_challenge("","0");<br> exit;<br> } else if (!check_from()) {<br> sl_send_reply("403", "Use From=ID");<br> return;<br> };<br> consume_credentials();<br><br> if (nat_uac_test("19")) {<br> setflag(6);<br> force_rport();<br> fix_nated_contact();<br> };<br> force_rtp_proxy("l");<br> };<br> route(1);<br> return;<br> };<br><br> # -----------------------------------------------------------------<br> # Call Type Processing
Section<br> # -----------------------------------------------------------------<br> if (uri!=myself) {<br> route(4);<br> route(1);<br> return;<br> };<br><br> if (method=="ACK") {<br> route(1);<br> return;<br> } else if (method=="CANCEL") {<br> route(1);<br> return;<br> } else if (method=="INVITE") {<br> route(3);<br> return;<br> } else if (method=="REGISTER") {<br> route(2);<br> return;<br> };<br><br> lookup("aliases");<br> if (uri!=myself) {<br> route(4);<br> route(1);<br> return;<br> };<br><br> if (!lookup("location")) {<br> sl_send_reply("404", "User Not Found");<br> return;<br> };<br><br> route(1);<br>}<br><br>route[1] {<br><br> # -----------------------------------------------------------------<br> # Default Message Handler<br> # -----------------------------------------------------------------<br><br> t_on_reply("1");<br><br> if (!t_relay()) {<br> if (method=="INVITE" && isflagset(6)) {<br> unforce_rtp_proxy();<br> };<br>
sl_reply_error();<br> <br> };<br>}<br><br>route[2] {<br><br> # -----------------------------------------------------------------<br> # REGISTER Message Handler<br> # ----------------------------------------------------------------<br><br> if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {<br> setflag(6);<br> fix_nated_register();<br> force_rport();<br> };<br><br> sl_send_reply("100", "Trying");<br><br> if (!www_authorize("","subscriber")) {<br> www_challenge("","0");<br> exit;<br> };<br><br> if (!check_to()) {<br> sl_send_reply("401", "Unauthorized");<br> return;<br> };<br><br> consume_credentials();<br><br> if (!save("location")) {<br> sl_reply_error();<br> };<br>}<br><br>route[3] {<br><br> # -----------------------------------------------------------------<br> # INVITE Message Handler<br> # -----------------------------------------------------------------<br><br> if (!proxy_authorize("","subscriber")) {<br> proxy_challenge("","0");<br> exit;<br> }
else if (!check_from()) {<br> sl_send_reply("403", "Use From=ID");<br> return;<br> };<br><br> consume_credentials();<br><br> if (nat_uac_test("19")) {<br> setflag(6);<br> xlog("Setflag cos behind NAT\n");<br> }<br> <br> <br> <br> lookup("aliases");<br> if (uri!=myself) {<br> route(4);<br> route(1);<br> return;<br> };<br> <br> if (uri=~"^sip:00[0-9]*@") { # International PSTN<br> xlog("International PSTN\n");<br> strip(2);<br> route(4);<br> route(5);<br> return;<br> };<br> <br><br> if (!lookup("location")) {<br> sl_send_reply("404", "User Not Found");<br> return;<br> };<br><br> route(4);<br> route(1);<br>}<br><br>route[4] {<br><br> # -----------------------------------------------------------------<br> # NAT Traversal Section<br> # -----------------------------------------------------------------<br><br> if (isflagset(6)) {<br> force_rport();<br> fix_nated_contact();<br> force_rtp_proxy();<br> xlog("NAT Traversal Section\n");<br> }<br>}<br><br>route[5]
{<br><br> # -----------------------------------------------------------------<br> # PSTN Handler<br> # -----------------------------------------------------------------<br> xlog("Routing to PSTN gateway\n");<br> rewritehostport("psnt.com:5060"); <br><br> avp_write("i:45", "inv_timeout");<br><br> route(1);<br>}<br><br><br>onreply_route[1] {<br><br> if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {<br> if (!search("^Content-Length:[ ]*0")) {<br> force_rtp_proxy();<br> };<br> };<br><br> if (nat_uac_test("1")) {<br> fix_nated_contact();<br> };<br>}<br><br><br></tt></pre> <br> <p> __________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com