<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16850" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello friends,</FONT></DIV>
<DIV><FONT face=Arial size=2>I have problem with CANCEL request because of
t_check_trans() is always failed. </FONT></DIV>
<DIV><FONT face=Arial size=2>Here is my config file</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT face=Arial><FONT face=Courier size=2># --- main routing
logic<BR>########################################################################<BR>#
Request route
generic<BR>########################################################################<BR>route[0]<BR>{</FONT></DIV></BLOCKQUOTE>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT face=Courier size=2> #Flood detection<BR> if
(!pike_check_req()) {<BR> #xlog("L_INFO", ">>>>>>
Flood detection \n - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci
(R00-02)\n");<BR> drop();<BR> #sl_send_reply("403",
"Forbidden");<BR> exit;<BR> }<BR> <BR> xlog("L_INFO",
"OPENSIPS: New request; M=$rm ; F=$fu ; T=$tu ; IP=$si ;
ID=$ci\n");<BR> if (!mf_process_maxfwd_header("10"))
<BR> {<BR> sl_send_reply("483","Too Many
Hops");<BR> exit;<BR> };<BR> <BR> if (msg:len
>= 2048 )
<BR> {<BR> <BR> sl_send_reply("513", "Message too
big");<BR> exit;<BR> };</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><BR><FONT face=Courier size=2> <BR> if(is_method("SUBSCRIBE")
|| is_method("NOTIFY") || is_method("OPTIONS"))<BR>
{<BR> drop();<BR>
};</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> #NAT
detection<BR> route(7);</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> if (!is_method("REGISTER"))
<BR> {<BR> record_route();<BR> };</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> if(is_method("CANCEL") ||
is_method("BYE"))<BR> {<BR> <BR> unforce_rtp_proxy();<BR> #end_media_session();<BR> <BR> }<BR> <BR> if(loose_route())<BR> {<BR> if(!has_totag())<BR> {<BR> <BR> sl_send_reply("403",
"Initial Loose-Routing
Rejected");<BR> exit;<BR> }<BR> <BR> }</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> if (is_method("REGISTER"))
<BR> {<BR> <BR> route(2);<BR> }</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> if(is_method("INVITE"))<BR> {<BR> <BR> route(3);<BR> }</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> if(is_method("CANCEL") ||
is_method("ACK"))<BR> {<BR> route(6);<BR> }</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> append_hf("P-hint: usrloc applied\r\n");
<BR> route(1);<BR>}<BR>########################################################################<BR>#
Request route
generic<BR>########################################################################</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2>route[1] <BR>{<BR> <BR> if
(subst_uri('/(sip:.*);nat=yes/\1/'))<BR> {<BR> setbflag(6);<BR> }; <BR> if(isbflagset(6))
<BR> {<BR> <BR> t_on_reply("1");<BR> t_on_failure("2");</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> }<BR> <BR> if
(!t_relay("0x05")) <BR> {<BR> if ((is_method("INVITE") ||
is_method("BYE")) && isbflagset(6))
<BR> {<BR>
unforce_rtp_proxy();<BR>
#end_media_session();<BR>
<BR> };</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> sl_reply_error();<BR> }<BR> exit;<BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><BR><FONT face=Courier
size=2>############################################`############################<BR>#
Request route
'REGISTER'<BR>########################################################################<BR>route[2]<BR>{<BR> sl_send_reply("100",
"Trying");<BR> <BR> if(!aaa_www_authorize("sip.worldfone.com.vn"))
<BR> {<BR> xlog("L_INFO", "aaa_www_authorize failed,
challenging M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci ..
\n");<BR> <BR> www_challenge("sip.worldfone.com.vn",
"0");<BR> exit;<BR> }<BR> <BR> if(!db_check_to())
<BR> {<BR> sl_send_reply("401","Unauthorized");<BR>
exit;<BR> }</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> consume_credentials();</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> if(!save("location"))
<BR> {<BR> sl_reply_error();<BR> exit;<BR> }<BR> <BR> exit;<BR> <BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Request route
'INVITE'<BR>########################################################################<BR>route[3]<BR>{</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> sl_send_reply("100",
"Trying");</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> /* Don't authen if INVITE from these IPs
*/<BR> if(
($si=="210.211.108.102")||($si=="222.255.236.131")||($si=="222.255.236.132")
)<BR>
{<BR> route(5);<BR> route(1);<BR> exit;<BR>
} <BR> else<BR>
{<BR> if(!aaa_proxy_authorize("sip.worldfone.com.vn"))<BR> {<BR> xlog("L_INFO",
"aaa_proxy_authorize ; M=$rm ; F=$fu ; T=$tu ; IP=$si ;
ID=$ci\n");<BR> proxy_challenge("sip.worldfone.com.vn","0");<BR> exit;<BR> <BR> }<BR> <BR> if
(!db_check_from())
<BR> {<BR> sl_send_reply("403","Forbidden");<BR> exit;<BR> }<BR> consume_credentials();<BR> <BR> route(4);<BR> <BR> route(1);<BR> exit;<BR>
};<BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><BR><FONT face=Courier
size=2>########################################################################<BR>#
Request route
'invite-to-external/PC2Phone'<BR>########################################################################<BR>route[4]<BR>{</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> if(isbflagset(6))<BR> {<BR> #force_rtp_proxy();<BR> fix_nated_sdp("3");<BR> #xlog("L_INFO",
"*-*-* fix_nated_sdp *-*-*\n");<BR> }<BR> setbflag(11);</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> rewritehostport("210.211.108.102:5060");</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> append_hf("Service: PC2PHONE\r\n");
</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><BR><FONT face=Courier size=2>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Request route
'invite-to-internal'/PC2PC<BR>########################################################################<BR>route[5]<BR>{<BR> if(!lookup("location"))
<BR> {<BR> sl_send_reply("404","User is
offline");<BR> exit;<BR> }<BR> else<BR> {<BR> xlog("L_INFO",
"OPENSIPS: PC2PC found
user\n");<BR> <BR> #if(isbflagset(6))<BR> #{<BR> # force_rtp_proxy();<BR> #}<BR> append_hf("Service:
PC2PC\r\n");<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Request route
'base-route-local'<BR>########################################################################<BR>route[6]<BR>{</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> t_on_reply("2");<BR> t_on_failure("2");<BR> if(t_check_trans())<BR> {<BR> <BR> if(!t_relay())<BR> {<BR> xlog("L_INFO",
"Reply error for CANCEL request - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");<BR> sl_reply_error();<BR> }<BR> }<BR> else<BR> {<BR> <BR> xlog("L_INFO",
"Dropping mis-routed request - M=$rm RURI=$ru F=$fu T=$tu IP=$si
ID=$ci\n");</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> }<BR> exit;<BR> <BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><BR><FONT face=Courier
size=2>########################################################################<BR>#
Fix NATed
contact<BR>########################################################################<BR>route[7]<BR>{<BR> force_rport();<BR> if
(nat_uac_test("19"))<BR> {<BR> if
(method=="REGISTER")<BR> {<BR> fix_nated_register();<BR> }<BR> else<BR> {<BR> fix_nated_contact();<BR> };<BR> setbflag(6);<BR> };<BR> </FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Check for failure cases from
AVP<BR>########################################################################<BR>route[8]<BR>{</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> avp_print();<BR> switch($avp(s:h323-credit-time))</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> {</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> case
"-100":<BR> sl_send_reply("401","UnAuthorised");<BR>
break;</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> case
"-101":<BR>
sl_send_reply("401","User not
found");<BR> break;<BR> <BR>
case
"-102":<BR> sl_send_reply("409","Conflict");<BR> break;</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> case
"-103":<BR> sl_send_reply("402","Payment
Required");<BR> break;</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> case
"-104":<BR> sl_send_reply("407","User not
active");<BR> break;</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2> case
"-105":<BR> sl_send_reply("604","Does not match dial
plan");<BR> break;<BR> <BR> case
"-107":<BR> sl_send_reply("604","Dial plan is
diable");<BR> break;<BR> case
"-108":<BR> sl_send_reply("484","Address
Incomplete");<BR> break;<BR> <BR> default:<BR> sl_send_reply("403","UnAuthorised");<BR> <BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Failure
route<BR>########################################################################<BR>failure_route[2]<BR>{</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2>
if(isbflagset(6))<BR>
{<BR>
unforce_rtp_proxy();<BR>
<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Reply route
generic<BR>########################################################################<BR>onreply_route[1]
<BR>{</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><BR><FONT face=Courier size=2> if ((isbflagset(6) || isbflagset(3))
&& status=~"183||(2[0-9][0-9])")
<BR> {<BR> if(!search("^Content-Length:[
]*0"))<BR> {</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> if(isbflagset(11))<BR>
{<BR> fix_nated_sdp("3");<BR> #force_rtp_proxy();</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2>
}<BR> else <BR> {</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> force_rtp_proxy();</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> }<BR> <BR> }<BR> }<BR> search_append('Contact:.*sip:[^>[:cntrl:]]*',
';nat=yes');<BR> if (isbflagset(6)) <BR> {</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2> fix_nated_contact();<BR> }<BR> <BR> if
(status=~"180||183||(2[0-9][0-9])")<BR> {<BR> # Add AVP into
headers<BR> #route(10);<BR> }<BR> exit;<BR>}</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier
size=2>########################################################################<BR>#
Reply route
'base-standard-reply'<BR>########################################################################<BR>onreply_route[2]<BR>{<BR> xlog("L_INFO",
"Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci
(RR1-01)\n");<BR> exit;</FONT></DIV>
<DIV><FONT face=Courier size=2></FONT> </DIV>
<DIV><FONT face=Courier size=2>}</FONT></DIV></BLOCKQUOTE>
<DIV><FONT size=2>I take long time for this but can not find out where is
problem.</FONT></DIV>
<DIV><FONT size=2>Please everyone help me solve where is problem and how to fix
it.</FONT></DIV>
<DIV><FONT size=2></FONT></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best regards,<BR>Thank you,</FONT></DIV>
<DIV><BR><FONT face=Arial size=2>Huy Huynh (Mr.)</FONT></DIV></BODY></HTML>