Hi Jan,
I attached my ser.cfg.
Thanks,
Ryan
#sem.cfg for philonline
#created by rpagquil
#aug. 16, 2005
debug=8
fork=yes
log_stderror=yes
listen=202.84.24.107
port=5060
children=4
dns=yes
rev_dns=yes
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"
alias=sip.philonline.com
#load module part
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/permissions.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
loadmodule "/usr/local/lib/ser/modules/group.so"
#module parameter setup
modparam("rr", "enable_full_lr", 1)
modparam("auth_db|uri_db|usrloc|domain|permissions|group", "db_url",
"mysql://ser:heslo@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "use_domain", 0)
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("registrar", "nat_flag", 6)
modparam("registrar", "use_domain", 0)
modparam("acc", "log_level", 2)
modparam("acc", "log_fmt", "cdfimorstup")
modparam("acc", "report_ack", 1)
#modparam("acc", "failed_transactions", 1)
modparam("acc", "log_flag", 1)
#modparam("acc", "report_cancels", 1)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 3)
modparam("acc", "db_url",
"mysql://ser:heslo@localhost/ser")
modparam("uri_db", "uri_table", "uri")
modparam("uri_db", "uri_user_column", "username")
modparam("uri_db", "uri_domain_column", "domain")
modparam("uri_db", "use_domain", 1)
modparam("uri_db", "use_uri_table", 1)
modparam("uri_db", "subscriber_domain_column", "domain")
modparam("uri_db", "subscriber_user_column", "username")
modparam("uri_db", "subscriber_table", "subscriber")
modparam("uri_db", "uri_uriuser_column", "uri_user")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")
modparam("permissions", "default_allow_file",
"/usr/local/etc/ser/allow.permissions")
modparam("permissions", "default_deny_file",
"/usr/local/etc/ser/deny.permissions")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("avpops", "avp_url",
"mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences" )
#modparam("avpops", "uuid_column", "id" )
#modparam("avpops", "avp_aliases", "email=i:67" )
#modparam("avpops",
"db_scheme","email_scheme:table=subscriber;value_col=email_address;value_type=string")
##modparam("avpops",
"db_scheme","language_scheme:table=subscriber;value_col=language;value_type=string")
#modparam("tm",
"tw_append","voicemail_headers:hdr[User-Agent];P-Email-Address=avp[$email]")
modparam("tm","fr_inv_timer", 27)
modparam("tm", "fr_inv_timer_avp", "inv_timeout")
modparam("group", "table", "grp")
modparam("group", "user_column", "username")
modparam("group", "domain_column", "domain")
modparam("group", "group_column", "grp")
modparam("group", "use_domain", 1)
#our routing logic
route {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too many hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message overflow");
break;
};
###record route####
if (method=="INVITE" && client_nat_test("3")) {
record_route_preset("202.84.24.107:5060;nat=yes");
} else if (method!="REGISTER") {
record_route();
};
###call tear down section###
if (method=="BYE" || method=="CANCEL") {
end_media_session();
};
###accounting###
if ((!has_totag() && (method=="INVITE" || method=="ACK")) ||
(method=="BYE")) {
setflag(1);
};
###loose route###
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);
break;
};
###call type processing###
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(4);
route(1);
} else {
sl_send_reply("403","Forbidden");
};
break;
};
if (method=="CANCEL") {
route(1);
break;
} else if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER") {
route(2);
break;
};
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
break;
};
if (!lookup("location")) {
sl_send_reply("404", "User not found");
break;
};
route(1);
}
##Default message handler##
route[1] {
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
##Register message handler##
route[2] {
sl_send_reply("100", "Trying");
if (!search("^Contact:\ +\*") && client_nat_test("7")) {
setflag(6);
fix_nated_register();
force_rport();
};
if (!www_authorize("sip.philonline.com","subscriber")) {
www_challenge("sip.philonline.com","0");
break;
};
if (!check_to()) {
sl_send_reply("401", "You are not authorized");
break;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
##INVITE message Handler##
route[3]
{
# if (!allow_trusted()) {
# if (!proxy_authorize("","subscriber")) {
# proxy_challenge("", "0");
# break;
# } else if (!check_from()) {
# sl_send_reply("403", "User From=ID");
# break;
# };
# consume_credentials();
# };
if (client_nat_test("3")) {
setflag(7);
force_rport();
fix_nated_contact();
};
#if (uri=~"^sip:1[0-9]@") {
# strip(1);
#};
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
break;
};
if (uri=~"^sip:011[0-9]*@") {
strip(3);
route(4);
route(5);
break;
};
if (avp_db_load("$ruri/username","s:callfwd")) {
setflag(22);
avp_pushto("$ruri", "s:callfwd");
route(6);
break;
} else if (avp_db_load("$ruri/username","s:vmail")) {
setflag(23);
avp_pushto("$ruri", "s:vmail");
route(6);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(5);
break;
};
sl_send_reply("404", "User not found");
break;
};
if (avp_db_load("$ruri/username","s:fwdbusy")) {
if (!avp_check("s:fwdbusy","eq/$ruri/i")) {
setflag(26);
};
};
if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) {
setflag(27);
};
};
if (avp_db_load("$ruri/username", "s:vmail") &&
is_user_in("To", "vmail")) {
if (!avp_check("s:vmail", "eq/$ruri/i")) {
setflag(28);
};
};
t_on_failure("1");
route(4);
route(1);
}
###NAT traversal section###
route[4] {
if (isflagset(6) || isflagset(7)) {
if (!isflagset(8)) {
setflag(8);
use_media_proxy();
};
};
}
###PSTN Handler###
route[5] {
rewritehost("202.147.52.21");
avp_write("i:45", "inv_timeout");
t_on_failure("1");
route(4);
route(1);
}
###Call forwarding handler###
route[6] {
if (uri=~"^sip:1[0-9]{10}@") {
strip(1);
};
if (uri=~"^sip:[a-z][0-9]@202.84.24.47.*$" ||
uri=~"^sip:[a-z]@202.84.24.47.*$") {
route(4);
route(7);
break;
};
lookup("aliases");
if (uri!=myself) {
if (!isflagset(22)) {
append_branch();
};
route(4);
route(1);
break;
};
if (uri=~"^sip:011[0-9]*@") {
strip(3);
route(4);
route(5);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(1);
break;
};
sl_send_reply("404", "User not found");
};
route(4);
route(1);
}
###Asterisk Handler###
route[7] {
sl_send_reply("100", "Trying");
rewritehostport("202.84.24.47:5060");
t_relay();
break;
}
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")) {
break;
};
if (isflagset(28)) {
if (t_check_status("486") || !lookup("location")) {
if (avp_pushto("$ruri", "s:vmail")) {
avp_delete("s:vmail");
resetflag(28);
route(6);
break;
};
};
};
if (isflagset(26) && t_check_status("486")) {
if (avp_pushto("$ruri", "s:fwdbusy")) {
avp_delete("s:fwdbusy");
resetflag(26);
route(6);
break;
};
};
if (isflagset(27) && t_check_status("408")) {
if (avp_pushto("$ruri", "s:fwdnoanswer")) {
avp_delete("s:fwdnoanswer");
resetflag(27);
route(6);
break;
};
};
end_media_session();
}
Jan Janak wrote:
Could you send me your configuration file, please ?
Jan.
On 29-09-2005 20:15, Ryan Pagquil wrote:
Hi Jan,
I compiled SER and made your suggestion but still not reading my
database when I restart SER. Same error "404, User not Found". What
should I do?
Thanks,
Ryan
Jan Janak wrote:
How many rows do you have in aliases table ?
Isn't ser running out of
memory upon startup (you can find out in syslog) ? If it is running out
of memory then try to increase the private memory buffer in
sip_router/config.h, look for PKG_MEM_POOL_SIZE and increase it to
32*1024*1024.
Jan.
On 29-09-2005 19:07, Ryan Pagquil wrote:
Hi Jan,
I got values in my contact field, what should I do? This is a sample
content:
| username | domain | contact | received | expires | q | callid | cseq |
last_modified | replicate | state | flags | user_agent |
+----------+--------------------+---------------------------------+----------+---------------------+------+---------------------------------------------------------------------+------+----------------+-----------+-------+-------+-------------------------+
| 123 |
sip.philonline.com | sip:user1@sip.philonline.com | NULL |
2005-09-13 15:41:20 | 1.00 |
The-Answer-To-The-Ultimate-Question-Of-Life-Universe-And-Everything | 42
| 20050913154156 | 0 | 0 | 128 | SIP Express Router FIFO |
| 108 |
sip.philonline.com | sip:rpagquil@sip.philonline.com | NULL |
2005-09-13 16:03:49 | 1.00 |
The-Answer-To-The-Ultimate-Question-Of-Life-Universe-And-Everything | 42
| 20050913160440 | 0 | 0 | 128 | SIP Express Router FIFO |
Jan, I also have a problem with contact information. All registered
users are in the location database but when I restarted SER I can't
contact any users that are currently registered. Its like the problem
with my aliases.
Thanks,
Ryan
Jan Janak wrote:
>Check the contents of aliases table. I guess you have NULL values in
>contact column.
>
>Jan.
>
>On 28-09-2005 20:52, Ryan Pagquil wrote:
>
>
>
>
>
>
>>Hi guys,
>> I got these errors whenever I restarted SER. What is the meaning
>>of these?
>>
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 123
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 108
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 100
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 130
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 104
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 124
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 118
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 128
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 112
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 111
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 110
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 109
>>0(0) preload_udomain: ERROR: skipping...
>>0(0) preload_udomain: ERROR: bad contact record in table aliases
>>0(0) preload_udomain: ERROR: for username 132
>>
>>Could this be the problem with my aliases that are not been used by SER?
>>
>>Thanks,
>>
>>--
>>Ryan Pagquil
>>Infodyne Inc. -
PhilOnline.com
>>3603 Antel Global Corporate Center
>>Do?a Julia Vargas Ave.
>>Ortigas Center Pasig City
>>Tel: 687-0715
>>Web:
www.philonline.com
>>
>>_______________________________________________
>>Serusers mailing list
>>serusers(a)lists.iptel.org
>>http://lists.iptel.org/mailman/listinfo/serusers
>>
>>
>>
>>
>>
>>
>
>
>
>
--
Ryan Pagquil
Infodyne Inc. -
PhilOnline.com
3603 Antel Global Corporate Center
Do??a Julia Vargas Ave.
Ortigas Center Pasig City
Tel: 687-0715
Web:
www.philonline.com
--
Ryan Pagquil
Infodyne Inc. -
PhilOnline.com
3603 Antel Global Corporate Center
Do??a Julia Vargas Ave.
Ortigas Center Pasig City
Tel: 687-0715
Web:
www.philonline.com
--
Ryan Pagquil
Infodyne Inc. -
PhilOnline.com
3603 Antel Global Corporate Center
Doña Julia Vargas Ave.
Ortigas Center Pasig City
Tel: 687-0715
Web:
www.philonline.com
#sem.cfg for philonline
#created by rpagquil
#aug. 16, 2005
debug=8
fork=yes
log_stderror=yes
listen=202.84.24.107
port=5060
children=4
dns=yes
rev_dns=yes
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"
alias=sip.philonline.com
#load module part
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/permissions.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
loadmodule "/usr/local/lib/ser/modules/group.so"
#module parameter setup
modparam("rr", "enable_full_lr", 1)
modparam("auth_db|uri_db|usrloc|domain|permissions|group", "db_url",
"mysql://ser:heslo@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "use_domain", 0)
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("registrar", "nat_flag", 6)
modparam("registrar", "use_domain", 0)
modparam("acc", "log_level", 2)
modparam("acc", "log_fmt", "cdfimorstup")
modparam("acc", "report_ack", 1)
#modparam("acc", "failed_transactions", 1)
modparam("acc", "log_flag", 1)
#modparam("acc", "report_cancels", 1)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 3)
modparam("acc", "db_url",
"mysql://ser:heslo@localhost/ser")
modparam("uri_db", "uri_table", "uri")
modparam("uri_db", "uri_user_column", "username")
modparam("uri_db", "uri_domain_column", "domain")
modparam("uri_db", "use_domain", 1)
modparam("uri_db", "use_uri_table", 1)
modparam("uri_db", "subscriber_domain_column", "domain")
modparam("uri_db", "subscriber_user_column", "username")
modparam("uri_db", "subscriber_table", "subscriber")
modparam("uri_db", "uri_uriuser_column", "uri_user")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")
modparam("permissions", "default_allow_file",
"/usr/local/etc/ser/allow.permissions")
modparam("permissions", "default_deny_file",
"/usr/local/etc/ser/deny.permissions")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("avpops", "avp_url",
"mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences" )
#modparam("avpops", "uuid_column", "id" )
#modparam("avpops", "avp_aliases", "email=i:67" )
#modparam("avpops",
"db_scheme","email_scheme:table=subscriber;value_col=email_address;value_type=string")
##modparam("avpops",
"db_scheme","language_scheme:table=subscriber;value_col=language;value_type=string")
#modparam("tm",
"tw_append","voicemail_headers:hdr[User-Agent];P-Email-Address=avp[$email]")
modparam("tm","fr_inv_timer", 27)
modparam("tm", "fr_inv_timer_avp", "inv_timeout")
modparam("group", "table", "grp")
modparam("group", "user_column", "username")
modparam("group", "domain_column", "domain")
modparam("group", "group_column", "grp")
modparam("group", "use_domain", 1)
#our routing logic
route {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too many hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message overflow");
break;
};
###record route####
if (method=="INVITE" && client_nat_test("3")) {
record_route_preset("202.84.24.107:5060;nat=yes");
} else if (method!="REGISTER") {
record_route();
};
###call tear down section###
if (method=="BYE" || method=="CANCEL") {
end_media_session();
};
###accounting###
if ((!has_totag() && (method=="INVITE" ||
method=="ACK")) || (method=="BYE")) {
setflag(1);
};
###loose route###
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);
break;
};
###call type processing###
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(4);
route(1);
} else {
sl_send_reply("403","Forbidden");
};
break;
};
if (method=="CANCEL") {
route(1);
break;
} else if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER") {
route(2);
break;
};
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
break;
};
if (!lookup("location")) {
sl_send_reply("404", "User not found");
break;
};
route(1);
}
##Default message handler##
route[1] {
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
##Register message handler##
route[2] {
sl_send_reply("100", "Trying");
if (!search("^Contact:\ +\*") && client_nat_test("7"))
{
setflag(6);
fix_nated_register();
force_rport();
};
if (!www_authorize("sip.philonline.com","subscriber")) {
www_challenge("sip.philonline.com","0");
break;
};
if (!check_to()) {
sl_send_reply("401", "You are not authorized");
break;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
##INVITE message Handler##
route[3]
{
# if (!allow_trusted()) {
# if (!proxy_authorize("","subscriber")) {
# proxy_challenge("", "0");
# break;
# } else if (!check_from()) {
# sl_send_reply("403", "User From=ID");
# break;
# };
# consume_credentials();
# };
if (client_nat_test("3")) {
setflag(7);
force_rport();
fix_nated_contact();
};
#if (uri=~"^sip:1[0-9]@") {
# strip(1);
#};
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
break;
};
if (uri=~"^sip:011[0-9]*@") {
strip(3);
route(4);
route(5);
break;
};
if (avp_db_load("$ruri/username","s:callfwd")) {
setflag(22);
avp_pushto("$ruri", "s:callfwd");
route(6);
break;
} else if (avp_db_load("$ruri/username","s:vmail")) {
setflag(23);
avp_pushto("$ruri", "s:vmail");
route(6);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(5);
break;
};
sl_send_reply("404", "User not found");
break;
};
if (avp_db_load("$ruri/username","s:fwdbusy")) {
if (!avp_check("s:fwdbusy","eq/$ruri/i")) {
setflag(26);
};
};
if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) {
setflag(27);
};
};
if (avp_db_load("$ruri/username", "s:vmail") &&
is_user_in("To", "vmail")) {
if (!avp_check("s:vmail", "eq/$ruri/i")) {
setflag(28);
};
};
t_on_failure("1");
route(4);
route(1);
}
###NAT traversal section###
route[4] {
if (isflagset(6) || isflagset(7)) {
if (!isflagset(8)) {
setflag(8);
use_media_proxy();
};
};
}
###PSTN Handler###
route[5] {
rewritehost("202.147.52.21");
avp_write("i:45", "inv_timeout");
t_on_failure("1");
route(4);
route(1);
}
###Call forwarding handler###
route[6] {
if (uri=~"^sip:1[0-9]{10}@") {
strip(1);
};
if (uri=~"^sip:[a-z][0-9]@202.84.24.47.*$" ||
uri=~"^sip:[a-z]@202.84.24.47.*$") {
route(4);
route(7);
break;
};
lookup("aliases");
if (uri!=myself) {
if (!isflagset(22)) {
append_branch();
};
route(4);
route(1);
break;
};
if (uri=~"^sip:011[0-9]*@") {
strip(3);
route(4);
route(5);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(1);
break;
};
sl_send_reply("404", "User not found");
};
route(4);
route(1);
}
###Asterisk Handler###
route[7] {
sl_send_reply("100", "Trying");
rewritehostport("202.84.24.47:5060");
t_relay();
break;
}
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")) {
break;
};
if (isflagset(28)) {
if (t_check_status("486") || !lookup("location")) {
if (avp_pushto("$ruri", "s:vmail")) {
avp_delete("s:vmail");
resetflag(28);
route(6);
break;
};
};
};
if (isflagset(26) && t_check_status("486")) {
if (avp_pushto("$ruri", "s:fwdbusy")) {
avp_delete("s:fwdbusy");
resetflag(26);
route(6);
break;
};
};
if (isflagset(27) && t_check_status("408")) {
if (avp_pushto("$ruri", "s:fwdnoanswer")) {
avp_delete("s:fwdnoanswer");
resetflag(27);
route(6);
break;
};
};
end_media_session();
}