Hi all, 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". 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. Can someone please help me out. The blind forwarding works perfectly. Here is my script:
debug=3 fork=yes log_stderror=no listen=202.XX.61.XX # INSERT YOUR IP ADDRESS HERE port=5060 children=4 dns=no rev_dns=no fifo="/tmp/openser_fifo" fifo_db_url="mysql://openser:openserrw@localhost/openser" loadmodule "/usr/local/lib/openser/modules/mysql.so" loadmodule "/usr/local/lib/openser/modules/sl.so" loadmodule "/usr/local/lib/openser/modules/tm.so" loadmodule "/usr/local/lib/openser/modules/rr.so" loadmodule "/usr/local/lib/openser/modules/maxfwd.so" loadmodule "/usr/local/lib/openser/modules/usrloc.so" loadmodule "/usr/local/lib/openser/modules/registrar.so" loadmodule "/usr/local/lib/openser/modules/auth.so" loadmodule "/usr/local/lib/openser/modules/auth_db.so" loadmodule "/usr/local/lib/openser/modules/uri.so" loadmodule "/usr/local/lib/openser/modules/uri_db.so" loadmodule "/usr/local/lib/openser/modules/mediaproxy.so" loadmodule "/usr/local/lib/openser/modules/nathelper.so" loadmodule "/usr/local/lib/openser/modules/textops.so" loadmodule "/usr/local/lib/openser/modules/avpops.so" loadmodule "/usr/local/lib/openser/modules/domain.so" loadmodule "/usr/local/lib/openser/modules/permissions.so" modparam("auth_db|permissions|uri_db|usrloc", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("auth_db", "calculate_ha1", 1) modparam("auth_db", "password_column", "password") modparam("nathelper", "rtpproxy_disable", 1) modparam("nathelper", "natping_interval", 0) modparam("mediaproxy","natping_interval", 30) modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock") modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients") modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients") modparam("usrloc", "db_mode", 2) modparam("usrloc", "use_domain", 1) modparam("registrar", "nat_flag", 6) modparam("registrar", "use_domain", 1) modparam("rr", "enable_full_lr", 1) modparam("tm", "fr_inv_timer", 27) modparam("tm", "fr_inv_timer_avp", "inv_timeout") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted") modparam("avpops", "avp_url", "mysql://openser:openserrw@localhost/openser") modparam("avpops", "avp_table", "usr_preferences") route { # ----------------------------------------------------------------- # Sanity Check Section # ----------------------------------------------------------------- if (!mf_process_maxfwd_header("10")) { sl_send_reply("483", "Too Many Hops"); return; }; if (msg:len > max_len) { sl_send_reply("513", "Message Overflow"); return; }; # ----------------------------------------------------------------- # Record Route Section # ----------------------------------------------------------------- if (method=="INVITE" && client_nat_test("3")) { # INSERT YOUR IP ADDRESS HERE record_route_preset("202.XX.61.XX:5060;nat=yes"); } else if (method!="REGISTER") { record_route(); }; # ----------------------------------------------------------------- # Call Tear Down Section # ----------------------------------------------------------------- if (method=="BYE" || method=="CANCEL") { end_media_session(); }; # ----------------------------------------------------------------- # Loose Route Section # ----------------------------------------------------------------- if (loose_route()) { if (has_totag() && (method=="INVITE" || method=="ACK")) { if (client_nat_test("3")||search("^Route:.*;nat=yes")){ setflag(6); use_media_proxy(); }; }; route(1); return; }; # ----------------------------------------------------------------- # Call Type Processing Section # ----------------------------------------------------------------- if (!is_uri_host_local()) { if (is_from_local() || allow_trusted()) { route(4); route(1); } else { sl_send_reply("403", "Forbidden"); }; return; }; if (method=="CANCEL") { route(1); return; } else if (method=="INVITE") { route(3); return; } else if (method=="REGISTER") { route(2); return; }; lookup("aliases"); if (uri!=myself) { route(4); route(1); return; }; if (!lookup("location")) { sl_send_reply("404", "User Not Found"); return; }; route(1); } route[1] { # ----------------------------------------------------------------- # Default Message Handler # ----------------------------------------------------------------- t_on_reply("1"); if (!t_relay()) { if (method=="INVITE" || method=="ACK") { end_media_session(); }; sl_reply_error(); }; } route[2] { # ----------------------------------------------------------------- # REGISTER Message Handler # ----------------------------------------------------------------- sl_send_reply("100", "Trying"); if (!search("^Contact:[ ]**") && client_nat_test("7")) { setflag(6); fix_nated_register(); force_rport(); }; if (!www_authorize("","subscriber")) { www_challenge("","0"); return; }; if (!check_to()) { sl_send_reply("401", "Unauthorized"); return; }; consume_credentials(); if (!save("location")) { sl_reply_error(); }; } route[3] { # ----------------------------------------------------------------- # INVITE Message Handler # ----------------------------------------------------------------- if (!allow_trusted()) { if (!proxy_authorize("","subscriber")) { proxy_challenge("","0"); return; } else if (!check_from()) { sl_send_reply("403", "Use From=ID"); return; }; consume_credentials(); }; if (client_nat_test("3")) { setflag(7); force_rport(); fix_nated_contact(); }; if (uri=~"^sip:1[0-9]{10}@") { strip(1); }; lookup("aliases"); if (uri!=myself) { route(4); route(1); return; }; if (uri=~"^sip:011[0-9]*@") { route(4); route(5); return; }; if (avp_db_load("$ruri/username", "$avp(s:callfwd)")) { setflag(22); avp_pushto("$ruri", "$avp(s:callfwd)"); route(6); return; }; if (!lookup("location")) { /*if (uri=~"^sip:[0-9]{10}@") { route(4); route(5); return; };*/ sl_send_reply("404", "User Not Found"); return; }; if (avp_db_load("$ruri/username", "$avp(s:fwdbusy)")) { if (!avp_check("$avp(s:fwdbusy)", "eq/$ruri/i")) { setflag(26); }; }; if (avp_db_load("$ruri/username", "$avp(s:fwdnoanswer)")) { if (!avp_check("$avp(s:fwdnoanswer)", "eq/$ruri/i")) { setflag(27); }; }; t_on_failure("1"); route(4); route(1); } route[4] { # ----------------------------------------------------------------- # NAT Traversal Section # ----------------------------------------------------------------- if (isflagset(6) || isflagset(7)) { if (!isflagset(8)) { setflag(8); use_media_proxy(); }; }; } route[5] { # ----------------------------------------------------------------- # PSTN Handler # ----------------------------------------------------------------- rewritehost("216.168.162.97"); # INSERT YOUR PSTN GATEWAY IP ADDRESS avp_write("i:45", "$avp(s:inv_timeout)"); t_on_failure("1"); route(4); route(1); } route[6] { # ------------------------------------------------------------------------ # Call Forwarding Reply Route Handler # # This must be done as a route block because sl_send_reply() cannot be # called from the failure_route block # ------------------------------------------------------------------------ if (uri=~"^sip:1[0-9]{10}@") { strip(1); }; lookup("aliases"); if (!isflagset(22)) { append_branch(); };
if (uri!=myself) { route(4); route(1); return; }; if (uri=~"^sip:011[0-9]*@") { route(4); route(5); return; }; if (!lookup("location")) { /*if (uri=~"^sip:[0-9]{10}@") { route(4); route(1); return; };*/ sl_send_reply("404", "User Not Found"); return; }; route(4); route(1); } onreply_route[1] { if ((isflagset(6) || isflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) { if (!search("^Content-Length:[ ]*0")) { use_media_proxy(); }; }; if (client_nat_test("1")) { fix_nated_contact(); }; } failure_route[1] { if (t_check_status("487")) { return; }; if (isflagset(26) && t_check_status("486")) { if (avp_pushto("$ruri", "$avp(s:fwdbusy)")) { avp_delete("$avp(s:fwdbusy)"); resetflag(26); route(6); return; }; }; if (isflagset(27) && t_check_status("408")) { if (avp_pushto("$ruri", "$avp(s:fwdnoanswer)")) { avp_delete("$avp(s:fwdnoanswer)"); resetflag(27); route(6); return; }; }; end_media_session(); }
--------------------------------- Jiyo cricket on Yahoo! India cricket Yahoo! Messenger Mobile Stay in touch with your buddies all the time.
Hello,
have a look at http://www.voice-system.ro/docs/avpops/ar01s08.html#ex_serial_forking
the example is pretty similar with what you want to achieve.
Cheers, Daniel
On 04/20/06 22:08, Jayesh Nambiar wrote:
Hi all, 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". 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. Can someone please help me out. The blind forwarding works perfectly. Here is my script:
debug=3 fork=yes log_stderror=no listen=202.XX.61.XX # INSERT YOUR IP ADDRESS HERE port=5060 children=4 dns=no rev_dns=no fifo="/tmp/openser_fifo" fifo_db_url="mysql://openser:openserrw@localhost/openser" loadmodule "/usr/local/lib/openser/modules/mysql.so" loadmodule "/usr/local/lib/openser/modules/sl.so" loadmodule "/usr/local/lib/openser/modules/tm.so" loadmodule "/usr/local/lib/openser/modules/rr.so" loadmodule "/usr/local/lib/openser/modules/maxfwd.so" loadmodule "/usr/local/lib/openser/modules/usrloc.so" loadmodule "/usr/local/lib/openser/modules/registrar.so" loadmodule "/usr/local/lib/openser/modules/auth.so" loadmodule "/usr/local/lib/openser/modules/auth_db.so" loadmodule "/usr/local/lib/openser/modules/uri.so" loadmodule "/usr/local/lib/openser/modules/uri_db.so" loadmodule "/usr/local/lib/openser/modules/mediaproxy.so" loadmodule "/usr/local/lib/openser/modules/nathelper.so" loadmodule "/usr/local/lib/openser/modules/textops.so" loadmodule "/usr/local/lib/openser/modules/avpops.so" loadmodule "/usr/local/lib/openser/modules/domain.so" loadmodule "/usr/local/lib/openser/modules/permissions.so" modparam("auth_db|permissions|uri_db|usrloc", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("auth_db", "calculate_ha1", 1) modparam("auth_db", "password_column", "password") modparam("nathelper", "rtpproxy_disable", 1) modparam("nathelper", "natping_interval", 0) modparam("mediaproxy","natping_interval", 30) modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock") modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients") modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients") modparam("usrloc", "db_mode", 2) modparam("usrloc", "use_domain", 1) modparam("registrar", "nat_flag", 6) modparam("registrar", "use_domain", 1) modparam("rr", "enable_full_lr", 1) modparam("tm", "fr_inv_timer", 27) modparam("tm", "fr_inv_timer_avp", "inv_timeout") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted") modparam("avpops", "avp_url", "mysql://openser:openserrw@localhost/openser") modparam("avpops", "avp_table", "usr_preferences") route { # ----------------------------------------------------------------- # Sanity Check Section # ----------------------------------------------------------------- if (!mf_process_maxfwd_header("10")) { sl_send_reply("483", "Too Many Hops"); return; }; if (msg:len > max_len) { sl_send_reply("513", "Message Overflow"); return; }; # ----------------------------------------------------------------- # Record Route Section # ----------------------------------------------------------------- if (method=="INVITE" && client_nat_test("3")) { # INSERT YOUR IP ADDRESS HERE record_route_preset("202.XX.61.XX:5060;nat=yes"); } else if (method!="REGISTER") { record_route(); }; # ----------------------------------------------------------------- # Call Tear Down Section # ----------------------------------------------------------------- if (method=="BYE" || method=="CANCEL") { end_media_session(); }; # ----------------------------------------------------------------- # Loose Route Section # ----------------------------------------------------------------- if (loose_route()) { if (has_totag() && (method=="INVITE" || method=="ACK")) { if (client_nat_test("3")||search("^Route:.*;nat=yes")){ setflag(6); use_media_proxy(); }; }; route(1); return; }; # ----------------------------------------------------------------- # Call Type Processing Section # ----------------------------------------------------------------- if (!is_uri_host_local()) { if (is_from_local() || allow_trusted()) { route(4); route(1); } else { sl_send_reply("403", "Forbidden"); }; return; }; if (method=="CANCEL") { route(1); return; } else if (method=="INVITE") { route(3); return; } else if (method=="REGISTER") { route(2); return; }; lookup("aliases"); if (uri!=myself) { route(4); route(1); return; }; if (!lookup("location")) { sl_send_reply("404", "User Not Found"); return; }; route(1); } route[1] { # ----------------------------------------------------------------- # Default Message Handler # ----------------------------------------------------------------- t_on_reply("1"); if (!t_relay()) { if (method=="INVITE" || method=="ACK") { end_media_session(); }; sl_reply_error(); }; } route[2] { # ----------------------------------------------------------------- # REGISTER Message Handler # ----------------------------------------------------------------- sl_send_reply("100", "Trying"); if (!search("^Contact:[ ]**") && client_nat_test("7")) { setflag(6); fix_nated_register(); force_rport(); }; if (!www_authorize("","subscriber")) { www_challenge("","0"); return; }; if (!check_to()) { sl_send_reply("401", "Unauthorized"); return; }; consume_credentials(); if (!save("location")) { sl_reply_error(); }; } route[3] { # ----------------------------------------------------------------- # INVITE Message Handler # ----------------------------------------------------------------- if (!allow_trusted()) { if (!proxy_authorize("","subscriber")) { proxy_challenge("","0"); return; } else if (!check_from()) { sl_send_reply("403", "Use From=ID"); return; }; consume_credentials(); }; if (client_nat_test("3")) { setflag(7); force_rport(); fix_nated_contact(); }; if (uri=~"^sip:1[0-9]{10}@") { strip(1); }; lookup("aliases"); if (uri!=myself) { route(4); route(1); return; }; if (uri=~"^sip:011[0-9]*@") { route(4); route(5); return; }; if (avp_db_load("$ruri/username", "$avp(s:callfwd)")) { setflag(22); avp_pushto("$ruri", "$avp(s:callfwd)"); route(6); return; }; if (!lookup("location")) { /*if (uri=~"^sip:[0-9]{10}@") { route(4); route(5); return; };*/ sl_send_reply("404", "User Not Found"); return; }; if (avp_db_load("$ruri/username", "$avp(s:fwdbusy)")) { if (!avp_check("$avp(s:fwdbusy)", "eq/$ruri/i")) { setflag(26); }; }; if (avp_db_load("$ruri/username", "$avp(s:fwdnoanswer)")) { if (!avp_check("$avp(s:fwdnoanswer)", "eq/$ruri/i")) { setflag(27); }; }; t_on_failure("1"); route(4); route(1); } route[4] { # ----------------------------------------------------------------- # NAT Traversal Section # ----------------------------------------------------------------- if (isflagset(6) || isflagset(7)) { if (!isflagset(8)) { setflag(8); use_media_proxy(); }; }; } route[5] { # ----------------------------------------------------------------- # PSTN Handler # ----------------------------------------------------------------- rewritehost("216.168.162.97"); # INSERT YOUR PSTN GATEWAY IP ADDRESS avp_write("i:45", "$avp(s:inv_timeout)"); t_on_failure("1"); route(4); route(1); } route[6] {
#
# Call Forwarding Reply Route Handler # # This must be done as a route block because sl_send_reply() cannot be # called from the failure_route block
#
if (uri=~"^sip:1[0-9]{10}@") { strip(1); }; lookup("aliases"); if (!isflagset(22)) { append_branch(); };
if (uri!=myself) { route(4); route(1); return; }; if (uri=~"^sip:011[0-9]*@") { route(4); route(5); return; }; if (!lookup("location")) { /*if (uri=~"^sip:[0-9]{10}@") { route(4); route(1); return; };*/ sl_send_reply("404", "User Not Found"); return; }; route(4); route(1); } onreply_route[1] { if ((isflagset(6) || isflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) { if (!search("^Content-Length:[ ]*0")) { use_media_proxy(); }; }; if (client_nat_test("1")) { fix_nated_contact(); }; } failure_route[1] { if (t_check_status("487")) { return; }; if (isflagset(26) && t_check_status("486")) { if (avp_pushto("$ruri", "$avp(s:fwdbusy)")) { avp_delete("$avp(s:fwdbusy)"); resetflag(26); route(6); return; }; }; if (isflagset(27) && t_check_status("408")) { if (avp_pushto("$ruri", "$avp(s:fwdnoanswer)")) { avp_delete("$avp(s:fwdnoanswer)"); resetflag(27); route(6); return; }; }; end_media_session(); }
Jiyo cricket on Yahoo! India cricket http://us.rd.yahoo.com/mail/in/mailcricket/*http://in.sports.yahoo.com/cricket/ Yahoo! Messenger Mobile http://us.rd.yahoo.com/mail/in/mailmobilemessenger/*http://in.mobile.yahoo.com/new/messenger/ Stay in touch with your buddies all the time.
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Hi Daniel, Thanks for your response. My configuration was OK. My problem got solved after I removed the function consume_credentials() from route(3). After the forwarding, the openser used to ask for proxy authentication again. This was the problem. I was also trying to implement forwarding if the user is not registered. My config seemed to be ok, but when I tried testing this feature, openser gives me a message saying: 513-message too big. Can someone please explain me what this means and how to rectify this problem.
Thanks in advance
w/regards, jayesh..
Daniel-Constantin Mierla daniel@voice-system.ro wrote: Hello,
have a look at http://www.voice-system.ro/docs/avpops/ar01s08.html#ex_serial_forking
the example is pretty similar with what you want to achieve.
Cheers, Daniel
On 04/20/06 22:08, Jayesh Nambiar wrote:
Hi all, 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". 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. Can someone please help me out. The blind forwarding works perfectly. Here is my script:
debug=3 fork=yes log_stderror=no listen=202.XX.61.XX # INSERT YOUR IP ADDRESS HERE port=5060 children=4 dns=no rev_dns=no fifo="/tmp/openser_fifo" fifo_db_url="mysql://openser:openserrw@localhost/openser" loadmodule "/usr/local/lib/openser/modules/mysql.so" loadmodule "/usr/local/lib/openser/modules/sl.so" loadmodule "/usr/local/lib/openser/modules/tm.so" loadmodule "/usr/local/lib/openser/modules/rr.so" loadmodule "/usr/local/lib/openser/modules/maxfwd.so" loadmodule "/usr/local/lib/openser/modules/usrloc.so" loadmodule "/usr/local/lib/openser/modules/registrar.so" loadmodule "/usr/local/lib/openser/modules/auth.so" loadmodule "/usr/local/lib/openser/modules/auth_db.so" loadmodule "/usr/local/lib/openser/modules/uri.so" loadmodule "/usr/local/lib/openser/modules/uri_db.so" loadmodule "/usr/local/lib/openser/modules/mediaproxy.so" loadmodule "/usr/local/lib/openser/modules/nathelper.so" loadmodule "/usr/local/lib/openser/modules/textops.so" loadmodule "/usr/local/lib/openser/modules/avpops.so" loadmodule "/usr/local/lib/openser/modules/domain.so" loadmodule "/usr/local/lib/openser/modules/permissions.so" modparam("auth_db|permissions|uri_db|usrloc", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("auth_db", "calculate_ha1", 1) modparam("auth_db", "password_column", "password") modparam("nathelper", "rtpproxy_disable", 1) modparam("nathelper", "natping_interval", 0) modparam("mediaproxy","natping_interval", 30) modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock") modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients") modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients") modparam("usrloc", "db_mode", 2) modparam("usrloc", "use_domain", 1) modparam("registrar", "nat_flag", 6) modparam("registrar", "use_domain", 1) modparam("rr", "enable_full_lr", 1) modparam("tm", "fr_inv_timer", 27) modparam("tm", "fr_inv_timer_avp", "inv_timeout") modparam("permissions", "db_mode", 1) modparam("permissions", "trusted_table", "trusted") modparam("avpops", "avp_url", "mysql://openser:openserrw@localhost/openser") modparam("avpops", "avp_table", "usr_preferences") route { # ----------------------------------------------------------------- # Sanity Check Section # ----------------------------------------------------------------- if (!mf_process_maxfwd_header("10")) { sl_send_reply("483", "Too Many Hops"); return; }; if (msg:len > max_len) { sl_send_reply("513", "Message Overflow"); return; }; # ----------------------------------------------------------------- # Record Route Section # ----------------------------------------------------------------- if (method=="INVITE" && client_nat_test("3")) { # INSERT YOUR IP ADDRESS HERE record_route_preset("202.XX.61.XX:5060;nat=yes"); } else if (method!="REGISTER") { record_route(); }; # ----------------------------------------------------------------- # Call Tear Down Section # ----------------------------------------------------------------- if (method=="BYE" || method=="CANCEL") { end_media_session(); }; # ----------------------------------------------------------------- # Loose Route Section # ----------------------------------------------------------------- if (loose_route()) { if (has_totag() && (method=="INVITE" || method=="ACK")) { if (client_nat_test("3")||search("^Route:.*;nat=yes")){ setflag(6); use_media_proxy(); }; }; route(1); return; }; # ----------------------------------------------------------------- # Call Type Processing Section # ----------------------------------------------------------------- if (!is_uri_host_local()) { if (is_from_local() || allow_trusted()) { route(4); route(1); } else { sl_send_reply("403", "Forbidden"); }; return; }; if (method=="CANCEL") { route(1); return; } else if (method=="INVITE") { route(3); return; } else if (method=="REGISTER") { route(2); return; }; lookup("aliases"); if (uri!=myself) { route(4); route(1); return; }; if (!lookup("location")) { sl_send_reply("404", "User Not Found"); return; }; route(1); } route[1] { # ----------------------------------------------------------------- # Default Message Handler # ----------------------------------------------------------------- t_on_reply("1"); if (!t_relay()) { if (method=="INVITE" || method=="ACK") { end_media_session(); }; sl_reply_error(); }; } route[2] { # ----------------------------------------------------------------- # REGISTER Message Handler # ----------------------------------------------------------------- sl_send_reply("100", "Trying"); if (!search("^Contact:[ ]**") && client_nat_test("7")) { setflag(6); fix_nated_register(); force_rport(); }; if (!www_authorize("","subscriber")) { www_challenge("","0"); return; }; if (!check_to()) { sl_send_reply("401", "Unauthorized"); return; }; consume_credentials(); if (!save("location")) { sl_reply_error(); }; } route[3] { # ----------------------------------------------------------------- # INVITE Message Handler # ----------------------------------------------------------------- if (!allow_trusted()) { if (!proxy_authorize("","subscriber")) { proxy_challenge("","0"); return; } else if (!check_from()) { sl_send_reply("403", "Use From=ID"); return; }; consume_credentials(); }; if (client_nat_test("3")) { setflag(7); force_rport(); fix_nated_contact(); }; if (uri=~"^sip:1[0-9]{10}@") { strip(1); }; lookup("aliases"); if (uri!=myself) { route(4); route(1); return; }; if (uri=~"^sip:011[0-9]*@") { route(4); route(5); return; }; if (avp_db_load("$ruri/username", "$avp(s:callfwd)")) { setflag(22); avp_pushto("$ruri", "$avp(s:callfwd)"); route(6); return; }; if (!lookup("location")) { /*if (uri=~"^sip:[0-9]{10}@") { route(4); route(5); return; };*/ sl_send_reply("404", "User Not Found"); return; }; if (avp_db_load("$ruri/username", "$avp(s:fwdbusy)")) { if (!avp_check("$avp(s:fwdbusy)", "eq/$ruri/i")) { setflag(26); }; }; if (avp_db_load("$ruri/username", "$avp(s:fwdnoanswer)")) { if (!avp_check("$avp(s:fwdnoanswer)", "eq/$ruri/i")) { setflag(27); }; }; t_on_failure("1"); route(4); route(1); } route[4] { # ----------------------------------------------------------------- # NAT Traversal Section # ----------------------------------------------------------------- if (isflagset(6) || isflagset(7)) { if (!isflagset(8)) { setflag(8); use_media_proxy(); }; }; } route[5] { # ----------------------------------------------------------------- # PSTN Handler # ----------------------------------------------------------------- rewritehost("216.168.162.97"); # INSERT YOUR PSTN GATEWAY IP ADDRESS avp_write("i:45", "$avp(s:inv_timeout)"); t_on_failure("1"); route(4); route(1); } route[6] {
#
# Call Forwarding Reply Route Handler # # This must be done as a route block because sl_send_reply() cannot be # called from the failure_route block
#
if (uri=~"^sip:1[0-9]{10}@") { strip(1); }; lookup("aliases"); if (!isflagset(22)) { append_branch(); };
if (uri!=myself) { route(4); route(1); return; }; if (uri=~"^sip:011[0-9]*@") { route(4); route(5); return; }; if (!lookup("location")) { /*if (uri=~"^sip:[0-9]{10}@") { route(4); route(1); return; };*/ sl_send_reply("404", "User Not Found"); return; }; route(4); route(1); } onreply_route[1] { if ((isflagset(6) || isflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) { if (!search("^Content-Length:[ ]*0")) { use_media_proxy(); }; }; if (client_nat_test("1")) { fix_nated_contact(); }; } failure_route[1] { if (t_check_status("487")) { return; }; if (isflagset(26) && t_check_status("486")) { if (avp_pushto("$ruri", "$avp(s:fwdbusy)")) { avp_delete("$avp(s:fwdbusy)"); resetflag(26); route(6); return; }; }; if (isflagset(27) && t_check_status("408")) { if (avp_pushto("$ruri", "$avp(s:fwdnoanswer)")) { avp_delete("$avp(s:fwdnoanswer)"); resetflag(27); route(6); return; }; }; end_media_session(); }
Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile
Stay in touch with your buddies all the time.
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
--------------------------------- Jiyo cricket on Yahoo! India cricket Yahoo! Messenger Mobile Stay in touch with your buddies all the time.