<div>Hi all,</div>  <div>I am trying to implement simple call forwarding in my script. The problem is when the call is forwarded to a another registered user and if the user is not in the location table, the message is correctly returned as "User Not Found". </div>  <div>But if the user is present in the location table, the call does not get forwarded and invite comes to the same number again. This happens when the call is forwarded on no answer. I try to do serial forking using avp_pushto() but it does'nt seem to work.</div>  <div>Can someone please help me out. The blind forwarding works perfectly.</div>  <div>Here is my script:</div>  <div><BR>debug=3<BR>fork=yes<BR>log_stderror=no</div>  <div>listen=202.XX.61.XX&nbsp;&nbsp;# INSERT YOUR IP ADDRESS HERE<BR>port=5060<BR>children=4</div>  <div>dns=no<BR>rev_dns=no<BR>fifo="/tmp/openser_fifo"<BR>fifo_db_url="mysql://openser:openserrw@localhost/openser"</div>  <div>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/mediaproxy.so"<BR>loadmodule "/usr/local/lib/openser/modules/nathelper.so"<BR>loadmodule "/usr/local/lib/openser/modules/textops.so"<BR>loadmodule "/usr/local/lib/openser/modules/avpops.so"<BR>loadmodule "/usr/local/lib/openser/modules/domain.so"<BR>loadmodule "/usr/local/lib/openser/modules/permissions.so"</div> 
 <div>modparam("auth_db|permissions|uri_db|usrloc", <BR>&nbsp;"db_url", "mysql://openser:openserrw@localhost/openser")<BR>modparam("auth_db", "calculate_ha1", 1)<BR>modparam("auth_db", "password_column", "password")</div>  <div>modparam("nathelper", "rtpproxy_disable", 1)<BR>modparam("nathelper", "natping_interval", 0)</div>  <div>modparam("mediaproxy","natping_interval", 30)<BR>modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock")<BR>modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients")<BR>modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients")</div>  <div>modparam("usrloc", "db_mode", 2)<BR>modparam("usrloc", "use_domain", 1)</div>  <div>modparam("registrar", "nat_flag", 6)<BR>modparam("registrar", "use_domain", 1)</div>  <div>modparam("rr", "enable_full_lr", 1)</div>  <div>modparam("tm", "fr_inv_timer", 27)<BR>modparam("tm", "fr_inv_timer_avp", "inv_timeout")</div>  <div>modparam("permissions", "db_mode",
 1)<BR>modparam("permissions", "trusted_table", "trusted")</div>  <div>modparam("avpops", "avp_url", "mysql://openser:openserrw@localhost/openser")<BR>modparam("avpops", "avp_table", "usr_preferences")</div>  <div>route {</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# Sanity Check Section<BR>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;if (!mf_process_maxfwd_header("10")) {<BR>&nbsp;&nbsp;sl_send_reply("483", "Too Many Hops");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (msg:len &gt; max_len) {<BR>&nbsp;&nbsp;sl_send_reply("513", "Message Overflow");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# Record Route Section<BR>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;if (method=="INVITE" &amp;&amp; client_nat_test("3")) {<BR>&nbsp;&nbsp;# INSERT YOUR IP
 ADDRESS HERE<BR>&nbsp;&nbsp;record_route_preset("202.XX.61.XX:5060;nat=yes");<BR>&nbsp;} else if (method!="REGISTER") {&nbsp;<BR>&nbsp;&nbsp;record_route();&nbsp;<BR>&nbsp;};</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# Call Tear Down Section<BR>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;if (method=="BYE" || method=="CANCEL") {<BR>&nbsp;&nbsp;end_media_session();<BR>&nbsp;};</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# Loose Route Section<BR>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;if (loose_route()) {</div>  <div>&nbsp;&nbsp;if (has_totag() &amp;&amp; (method=="INVITE" || method=="ACK")) {</div>  <div>&nbsp;&nbsp;&nbsp;if
 (client_nat_test("3")||search("^Route:.*;nat=yes")){<BR>&nbsp;&nbsp;&nbsp;&nbsp;setflag(6);<BR>&nbsp;&nbsp;&nbsp;&nbsp;use_media_proxy();<BR>&nbsp;&nbsp;&nbsp;};<BR>&nbsp;&nbsp;};</div>  <div>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# Call Type Processing Section<BR>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;if (!is_uri_host_local()) {<BR>&nbsp;&nbsp;if (is_from_local() || allow_trusted()) {<BR>&nbsp;&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;} else {<BR>&nbsp;&nbsp;&nbsp;sl_send_reply("403", "Forbidden");<BR>&nbsp;&nbsp;};<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (method=="CANCEL") {<BR>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;return;<BR>&nbsp;} else if (method=="INVITE") {<BR>&nbsp;&nbsp;route(3);<BR>&nbsp;&nbsp;return;<BR>&nbsp;} else &nbsp;if (method=="REGISTER")
 {<BR>&nbsp;&nbsp;route(2);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;lookup("aliases");<BR>&nbsp;if (uri!=myself) {<BR>&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (!lookup("location")) {<BR>&nbsp;&nbsp;sl_send_reply("404", "User Not Found");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;route(1);<BR>}</div>  <div>route[1] {</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# Default Message Handler<BR>&nbsp;# -----------------------------------------------------------------</div>  <div>&nbsp;t_on_reply("1");</div>  <div>&nbsp;if (!t_relay()) {</div>  <div>&nbsp;&nbsp;if (method=="INVITE" || method=="ACK") {<BR>&nbsp;&nbsp;&nbsp;end_media_session();<BR>&nbsp;&nbsp;};</div>  <div>&nbsp;&nbsp;sl_reply_error();<BR>&nbsp;};<BR>}</div>  <div>route[2] {</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# REGISTER
 Message Handler<BR>&nbsp;# -----------------------------------------------------------------</div>  <div>&nbsp;sl_send_reply("100", "Trying");</div>  <div>&nbsp;if (!search("^Contact:[ ]*\*") &amp;&amp; client_nat_test("7")) {<BR>&nbsp;&nbsp;setflag(6);<BR>&nbsp;&nbsp;fix_nated_register();<BR>&nbsp;&nbsp;force_rport();<BR>&nbsp;};</div>  <div>&nbsp;if (!www_authorize("","subscriber")) {<BR>&nbsp;&nbsp;www_challenge("","0");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (!check_to()) {<BR>&nbsp;&nbsp;sl_send_reply("401", "Unauthorized");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;consume_credentials();</div>  <div>&nbsp;if (!save("location")) {<BR>&nbsp;&nbsp;sl_reply_error();<BR>&nbsp;};<BR>}</div>  <div>route[3] {</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# INVITE Message Handler<BR>&nbsp;# -----------------------------------------------------------------</div>  <div>&nbsp;if (!allow_trusted())
 {</div>  <div>&nbsp;&nbsp;if (!proxy_authorize("","subscriber")) {<BR>&nbsp;&nbsp;&nbsp;proxy_challenge("","0");<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;} else if (!check_from()) {<BR>&nbsp;&nbsp;&nbsp;sl_send_reply("403", "Use From=ID");<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;};</div>  <div>&nbsp;&nbsp;consume_credentials();<BR>&nbsp;};</div>  <div>&nbsp;if (client_nat_test("3")) {<BR>&nbsp;&nbsp;setflag(7);<BR>&nbsp;&nbsp;force_rport();<BR>&nbsp;&nbsp;fix_nated_contact();<BR>&nbsp;};</div>  <div>&nbsp;if (uri=~"^sip:1[0-9]{10}@") {<BR>&nbsp;&nbsp;strip(1);<BR>&nbsp;};</div>  <div>&nbsp;lookup("aliases");<BR>&nbsp;if (uri!=myself) {<BR>&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (uri=~"^sip:011[0-9]*@") {<BR>&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;route(5);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (avp_db_load("$ruri/username", "$avp(s:callfwd)"))
 {<BR>&nbsp;&nbsp;setflag(22);<BR>&nbsp;&nbsp;avp_pushto("$ruri", "$avp(s:callfwd)");<BR>&nbsp;&nbsp;route(6);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (!lookup("location")) {</div>  <div>&nbsp;&nbsp;/*if (uri=~"^sip:[0-9]{10}@") {<BR>&nbsp;&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;&nbsp;route(5);<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;};*/</div>  <div>&nbsp;&nbsp;sl_send_reply("404", "User Not Found");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (avp_db_load("$ruri/username", "$avp(s:fwdbusy)")) {<BR>&nbsp;&nbsp;if (!avp_check("$avp(s:fwdbusy)", "eq/$ruri/i")) {<BR>&nbsp;&nbsp;&nbsp;setflag(26);<BR>&nbsp;&nbsp;};<BR>&nbsp;};</div>  <div>&nbsp;if (avp_db_load("$ruri/username", "$avp(s:fwdnoanswer)")) {<BR>&nbsp;&nbsp;if (!avp_check("$avp(s:fwdnoanswer)", "eq/$ruri/i")) {<BR>&nbsp;&nbsp;&nbsp;setflag(27);<BR>&nbsp;&nbsp;};<BR>&nbsp;};</div>  <div>&nbsp;t_on_failure("1");</div>  <div>&nbsp;route(4);<BR>&nbsp;route(1);<BR>}</div>  <div>route[4]
 {</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# NAT Traversal Section<BR>&nbsp;# -----------------------------------------------------------------</div>  <div>&nbsp;if (isflagset(6) || isflagset(7)) {<BR>&nbsp;&nbsp;if (!isflagset(8)) {<BR>&nbsp;&nbsp;&nbsp;setflag(8);<BR>&nbsp;&nbsp;&nbsp;use_media_proxy();<BR>&nbsp;&nbsp;};<BR>&nbsp;};<BR>}</div>  <div>route[5] {</div>  <div>&nbsp;# -----------------------------------------------------------------<BR>&nbsp;# PSTN Handler<BR>&nbsp;# -----------------------------------------------------------------</div>  <div>&nbsp;rewritehost("216.168.162.97"); # INSERT YOUR PSTN GATEWAY IP ADDRESS</div>  <div>&nbsp;avp_write("i:45", "$avp(s:inv_timeout)");</div>  <div>&nbsp;t_on_failure("1");</div>  <div>&nbsp;route(4);<BR>&nbsp;route(1);<BR>}</div>  <div>route[6] {</div>  <div>&nbsp;# ------------------------------------------------------------------------<BR>&nbsp;# Call Forwarding
 Reply Route Handler<BR>&nbsp;#<BR>&nbsp;# This must be done as a route block because sl_send_reply() cannot be<BR>&nbsp;# called from the failure_route block<BR>&nbsp;# ------------------------------------------------------------------------</div>  <div>&nbsp;if (uri=~"^sip:1[0-9]{10}@") {<BR>&nbsp;&nbsp;strip(1);<BR>&nbsp;};</div>  <div>&nbsp;lookup("aliases");</div>  <div>&nbsp;if (!isflagset(22)) {<BR>&nbsp;&nbsp;append_branch();<BR>&nbsp;};<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;if (uri!=myself) {</div>  <div>&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (uri=~"^sip:011[0-9]*@") {<BR>&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;route(5);<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (!lookup("location")) {</div>  <div>&nbsp;&nbsp;/*if (uri=~"^sip:[0-9]{10}@") {<BR>&nbsp;&nbsp;&nbsp;route(4);<BR>&nbsp;&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;};*/</div>  <div>&nbsp;&nbsp;sl_send_reply("404",
 "User Not Found");<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;route(4);<BR>&nbsp;route(1);<BR>}</div>  <div>onreply_route[1] {</div>  <div>&nbsp;if ((isflagset(6) || isflagset(7)) &amp;&amp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; (status=~"(180)|(183)|2[0-9][0-9]")) {</div>  <div>&nbsp;&nbsp;if (!search("^Content-Length:[ ]*0")) {<BR>&nbsp;&nbsp;&nbsp;use_media_proxy();<BR>&nbsp;&nbsp;};<BR>&nbsp;};</div>  <div>&nbsp;if (client_nat_test("1")) {<BR>&nbsp;&nbsp;fix_nated_contact();<BR>&nbsp;};<BR>}</div>  <div>failure_route[1] {</div>  <div>&nbsp;if (t_check_status("487")) {<BR>&nbsp;&nbsp;return;<BR>&nbsp;};</div>  <div>&nbsp;if (isflagset(26) &amp;&amp; t_check_status("486")) {<BR>&nbsp;&nbsp;if (avp_pushto("$ruri", "$avp(s:fwdbusy)")) {<BR>&nbsp;&nbsp;&nbsp;avp_delete("$avp(s:fwdbusy)");<BR>&nbsp;&nbsp;&nbsp;resetflag(26);<BR>&nbsp;&nbsp;&nbsp;route(6);<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;};<BR>&nbsp;};</div>  <div>&nbsp;if (isflagset(27) &amp;&amp;
 t_check_status("408")) {<BR>&nbsp;&nbsp;if (avp_pushto("$ruri", "$avp(s:fwdnoanswer)")) {<BR>&nbsp;&nbsp;&nbsp;avp_delete("$avp(s:fwdnoanswer)");<BR>&nbsp;&nbsp;&nbsp;resetflag(27);<BR>&nbsp;&nbsp;&nbsp;route(6);<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;};<BR>&nbsp;};</div>  <div>&nbsp;end_media_session();<BR>}</div>  <div>&nbsp;</div><p>
        

        
                <hr size=1> 
Jiyo cricket on <a href="http://us.rd.yahoo.com/mail/in/mailcricket/*http://in.sports.yahoo.com/cricket/">Yahoo! India cricket</a><br>
<a href="http://us.rd.yahoo.com/mail/in/mailmobilemessenger/*http://in.mobile.yahoo.com/new/messenger/">Yahoo! Messenger Mobile</a> Stay in touch with your buddies all the time.