Hi everybody,<br><br>I'm having problems rewritehostport to PSTN gateway. It gives me the 403 Forbidden error. Here is the error:<br><br>SEND TIME: 130027089<br>SEND >> <br>ACK sip:0013373038435@test.com SIP/2.0<br>Via: SIP/2.0/UDP70.xxx.xxx.xxx:5060;rport;branch=z9hG4bK437FA12BFB124DA68EB569C02212327D<br>From: Kenny <sip:200@test.com>;tag=1187743606<br>To: <sip:0013373038435@test.com>;tag=eb9822f1ed1b15a932bf98c097b3aaca.befd<br>Contact: <sip:200@70.xxx.xxx.xxx:5060><br>Call-ID: 67A1BB1A-C737-4C24-B7AF-19E9C92C2B47@192.168.1.30<br>CSeq: 9401 ACK<br>Max-Forwards: 70<br>Content-Length: 0<br><br><br>SEND TIME: 130027095<br>SEND >> 70.xxx.xxx.xxx:5060<br>INVITE sip:0013373038435@test.com SIP/2.0<br>Via: SIP/2.0/UDP70.xxx.xxx.xxx:5060;rport;branch=z9hG4bKF16D7EAC63D6463A8624A802F5BB4908<br>From: Kenny <sip:200@test.com>;tag=1187743606<br>To: <sip:0013373038435@test.com><br>Contact: <sip:200@70.xxx.xxx.xxx:5060><br>Call-ID:
67A1BB1A-C737-4C24-B7AF-19E9C92C2B47@192.168.1.30<br>CSeq: 9402 INVITE<br>Proxy-Authorization: Digest username="200",realm="test.com",nonce="44a21eb77c572fc09155f89521700490cb8a87ef",response="75921f5f225efeaeb0177e3353769190",uri="sip:0013373038435@test.com"<br>Max-Forwards: 70<br>Content-Type: application/sdp<br>User-Agent: X-Lite release 1105x<br>Content-Length: 308<br><br>v=0<br>o=200 130026958 130027078 IN IP470.xxx.xxx.xxx<br>s=X-Lite<br>c=IN IP4 70.xxx.xxx.xxx<br>t=0 0<br>m=audio 8000 RTP/AVP 0 8 3 98 97 101<br>a=rtpmap:0 pcmu/8000<br>a=rtpmap:8 pcma/8000<br>a=rtpmap:3 gsm/8000<br>a=rtpmap:98 iLBC/8000<br>a=rtpmap:97 speex/8000<br>a=rtpmap:101 telephone-event/8000<br>a=fmtp:101 0-15<br>a=sendrecv<br><br>RECEIVE TIME: 130027172<br>RECEIVE << 70.xxx.xxx.xxx:5060<br>SIP/2.0 100 trying -- your call is important to us<br>Via: SIP/2.0/UDP 70.xxx.xxx.xxx:5060;rport=5060;branch=z9hG4bKF16D7EAC63D6463A8624A802F5BB4908;received=192.168.1.1<br>From: Kenny
<sip:200@test.com>;tag=1187743606<br>To: <sip:0013373038435@test.com><br>Call-ID: 67A1BB1A-C737-4C24-B7AF-19E9C92C2B47@192.168.1.30<br>CSeq: 9402 INVITE<br>Server: OpenSer (1.0.1 (i386/linux))<br>Content-Length: 0<br>Warning: 392 192.168.1.6:5060 "Noisy feedback tells: pid=4989 req_src_ip=192.168.1.1 req_src_port=5060 in_uri=sip:0013373038435@test.com out_uri=sip:13373038435@pstn.gateway:5060 via_cnt==1"<br><br><br>RECEIVE TIME: 130027371<br>RECEIVE << 70.xxx.xxx.xxx:5060<br>SIP/2.0 403 Forbidden<br>To: <sip:0013373038435@test.com>;tag=3360460030-876466<br>From: Kenny <sip:200@test.com>;tag=1187743606<br>Call-ID: 67A1BB1A-C737-4C24-B7AF-19E9C92C2B47@192.168.1.30<br>CSeq: 9402 INVITE<br>Contact: sip:13373038435@65.xxx.xxx.xxx:5060<br>Via: SIP/2.0/UDP 70.xxx.xxx.xxx:5060;received=192.168.1.1;rport=5060;branch=z9hG4bKF16D7EAC63D6463A8624A802F5BB4908<br>Content-Length: 0<br><br><br>SEND TIME: 130027372<br>SEND
>>70.xxx.xxx.xxx:5060<br>ACK sip:0013373038435@test.comSIP/2.0<br>Via: SIP/2.0/UDP 70.xxx.xxx.xxx:5060;rport;branch=z9hG4bKF16D7EAC63D6463A8624A802F5BB4908<br>From: Kenny <sip:200@test.com>;tag=1187743606<br>To: <sip:0013373038435@test.com>;tag=3360460030-876466<br>Contact: <sip:200@70.xxx.xxx.xxx:5060><br>Call-ID: 67A1BB1A-C737-4C24-B7AF-19E9C92C2B47@192.168.1.30<br>CSeq: 9402 ACK<br>Max-Forwards: 70<br>Content-Length: 0<br><br><br>********************************Openser.cfg********************************************<br><br><br>debug=3<br>fork=yes<br>log_stderror=no<br><br>listen=192.168.1.6 <br>alias=test.com<br>port=5060<br>children=32<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> xlog("Does not have to tag, FORBIDDEN\n");<br> sl_send_reply("403", "Forbidden");<br> exit;<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>
exit;<br> };<br> consume_credentials();<br><br> if (nat_uac_test("19")) {<br> setflag(6);<br> force_rport();<br> xlog("Forcing rtpport\n");<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> xlog("Unforce RTP proxy2\n");<br> };<br> xlog("Dunno why forbidden\n");<br> sl_reply_error();<br> xlog("Forbidden4\n");<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> exit;<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("pstn.gateway:5060"); <br> <br> avp_write("i:45", "inv_timeout");<br><br> route(1);<br> xlog("Routed to PSTN gateway\n");<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><p> 
                <hr size=1>Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. <a href="http://us.rd.yahoo.com/mail_us/taglines/postman7/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com"> Great rates starting at 1¢/min.