<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=big5">
<META content="MSHTML 6.00.2800.1491" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Times New Roman">Please ignore my previous email. Here is the 
correct one. Thank you.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV style="FONT: 10pt 新細明體">----- Original Message ----- 
<DIV style="BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A 
title=support@cybertel.biz href="mailto:support@cybertel.biz">support</A> </DIV>
<DIV><B>To:</B> <A title=serusers@lists.iptel.org 
href="mailto:serusers@lists.iptel.org">serusers@lists.iptel.org</A> </DIV>
<DIV><B>Sent:</B> Thursday, February 17, 2005 11:59 AM</DIV>
<DIV><B>Subject:</B> STUN, rtpproxy problem</DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT face="Times New Roman">Hi,</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">I am running ser-0.8.14 with rtpproxy and 
nathelper. I have also enabled STUN on the same server.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">My SIP UA supports STUN,&nbsp;but my PSTN 
gateway does not.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">If I don't enable STUN on SIP UA, I can route 
the call to PSTN gateway successfully using rtpproxy.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">If I enable STUN on SIP UA, I cannot route the 
call out to PSTN gateway. On ringing sound is heard on callie, but no voice 
passing through.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">I use t_relay_to_udp to forward the call to 
PSTN gateway. It seems that if STUN is&nbsp;supported on SIP UA, the call cannot 
be routed to PSTN gateway.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">Hope someone could fix this 
problem.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">Best wishes,</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">Thomas</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">My ser.cfg is as follows:</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"><FONT face=新細明體>
<DIV><FONT face="Times New Roman">#<BR># $Id: ser.cfg,v 1.21.4.1 2003/11/10 
15:35:15 andrei Exp $<BR>#<BR># simple quick-start config 
script<BR>#</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># ----------- global configuration parameters 
------------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT 
face="Times New Roman">debug=3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 
debug level (cmd line: -dddddddddd)<BR>fork=yes<BR>log_stderror=no&nbsp;# (cmd 
line: -E)</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">check_via=no&nbsp;# (cmd. line: 
-v)<BR>dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 
(cmd. line: -r)<BR>rev_dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: 
-R)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT 
face="Times New Roman">listen=""<BR>port=5060<BR>#children=4<BR>fifo_mode=0666<BR>fifo="/tmp/ser_fifo"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># ------------------ module loading 
----------------------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># Uncomment this if you want to use SQL 
database<BR>loadmodule "/usr/local/lib/ser/modules/mysql.so"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">loadmodule 
"/usr/local/lib/ser/modules/sl.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/tm.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/rr.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/maxfwd.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/usrloc.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/registrar.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/textops.so"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># Uncomment this if you want digest 
authentication<BR># mysql.so must be loaded !<BR>loadmodule 
"/usr/local/lib/ser/modules/auth.so"<BR>loadmodule 
"/usr/local/lib/ser/modules/auth_db.so"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># Nathelper<BR>loadmodule 
"/usr/local/lib/ser/modules/nathelper.so"<BR># ----------------- setting 
module-specific parameters ---------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># -- usrloc params --</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">#modparam("usrloc", "db_mode",&nbsp;&nbsp; 
0)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># Uncomment this if you want to use SQL 
database <BR># for persistent storage and comment the previous 
line<BR>modparam("usrloc", "db_mode", 2)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># -- auth params --<BR># Uncomment if you are 
using auth module<BR>#<BR>modparam("auth_db", "calculate_ha1", yes)<BR>#<BR># If 
you set "calculate_ha1" parameter to yes (which true in this config), <BR># 
uncomment also the following parameter)<BR>#<BR>modparam("auth_db", 
"password_column", "password")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># -- rr params --<BR># add value to ;lr param 
to make some broken UAs happy<BR>modparam("rr", "enable_full_lr", 
1)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># -- Nathelper params 
--<BR>modparam("registrar", "nat_flag", 6)<BR>modparam("nathelper", 
"natping_interval", 30)&nbsp; # Ping interval<BR>modparam("nathelper", 
"ping_nated_only", 1) # Ping only clients behind NAT</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># -------------------------&nbsp; request 
routing logic -------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># main routing logic</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">route{</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# initial sanity checks -- messages 
with<BR>&nbsp;# max_forwards==0, or excessively long requests<BR>&nbsp;if 
(!mf_process_maxfwd_header("10")) {<BR>&nbsp;&nbsp;sl_send_reply("483","Too Many 
Hops");<BR>&nbsp;&nbsp;break;<BR>&nbsp;};<BR>&nbsp;if ( msg:len &gt; max_len ) 
{<BR>&nbsp;&nbsp;sl_send_reply("513", "Message too 
big");<BR>&nbsp;&nbsp;break;<BR>&nbsp;};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# Nathelper<BR>&nbsp;if 
(nat_uac_test("3")) {<BR>&nbsp;&nbsp;# Allow RR-ed requests, as these may 
indicate that<BR>&nbsp;&nbsp;# a NAT-enabled proxy takes care of it; unless it 
is<BR>&nbsp;&nbsp;# a REGISTER<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;if (method == 
"REGISTER" || ! search("^Record-Route:")) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
log("LOG: Someone trying to register from private IP, 
rewriting\n");</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # This will 
work only for user agents that support 
symmetric<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # communication. We tested quite 
many of them and majority is<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # smart enough to 
be symmetric. In some phones it takes a 
configuration<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # option. With Cisco 7960, it is 
called NAT_Enable=Yes, with kphone it is<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 
called "symmetric media" and "symmetric signalling".</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fix_nated_contact(); # Rewrite contact with source IP of 
signalling<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (method == "INVITE") 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fix_nated_sdp("1"); 
# Add direction=active to SDP<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; force_rport(); # Add rport parameter to 
topmost Via<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setflag(6);&nbsp;&nbsp;&nbsp; # 
Mark as NATed<BR>&nbsp;&nbsp;};<BR>&nbsp;};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# we record-route all messages -- to 
make sure that<BR>&nbsp;# subsequent messages will go through our proxy; 
that's<BR>&nbsp;# particularly good if upstream and downstream 
entities<BR>&nbsp;# use different transport protocol<BR>&nbsp;if 
(!method=="REGISTER") record_route();&nbsp;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# subsequent messages withing a dialog 
should take the<BR>&nbsp;# path determined by record-routing<BR>&nbsp;if 
(loose_route()) {<BR>&nbsp;&nbsp;# mark routing logic in 
request<BR>&nbsp;&nbsp;append_hf("P-hint: rr-enforced\r\n"); 
<BR>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;break;<BR>&nbsp;};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;if (!uri==myself) {<BR>&nbsp;&nbsp;# 
mark routing logic in request<BR>&nbsp;&nbsp;append_hf("P-hint: outbound\r\n"); 
<BR>&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;break;<BR>&nbsp;};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# if the request is for other domain use 
UsrLoc<BR>&nbsp;# (in case, it does not work, use the following 
command<BR>&nbsp;# with proper names and addresses in it)<BR>&nbsp;if 
(uri==myself) {</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;&nbsp;if (method=="REGISTER") 
{</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># Uncomment this if you want to use digest 
authentication<BR>&nbsp;&nbsp;&nbsp;if (!www_authorize("", "subscriber")) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;www_challenge("", 
"0");<BR>&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT 
face="Times New Roman">&nbsp;&nbsp;&nbsp;save("location");<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;};<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;if 
(uri=~"^sip:866*") {<BR>&nbsp;&nbsp;&nbsp;log(1, "going to PSTN 
route\n");<BR>&nbsp;&nbsp;&nbsp;route(2);<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;};<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;lookup("aliases");<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;if 
(!uri==myself) {<BR>&nbsp;&nbsp;&nbsp;append_hf("P-hint: outbound alias\r\n"); 
<BR>&nbsp;&nbsp;&nbsp;route(1);<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;};<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;# 
native SIP destinations are handled using our USRLOC DB<BR>&nbsp;&nbsp;if 
(!lookup("location")) {<BR>&nbsp;&nbsp;&nbsp;sl_send_reply("404", "Not 
Found");<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;};<BR>&nbsp;};<BR>&nbsp;append_hf("P-hint: 
usrloc applied\r\n");<BR>&nbsp;route(1);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">route[1] <BR>{<BR>&nbsp;# !! 
Nathelper<BR>&nbsp;if 
(uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &amp;&amp; 
!search("^Route:")){<BR>&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("479", "We don't 
forward to private IP addresses");<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# if client or server know to be behind 
a NAT, enable relay<BR>&nbsp;if (isflagset(6)) {<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
force_rtp_proxy();<BR>&nbsp;};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# NAT processing of replies; apply to 
all transactions (for example,<BR>&nbsp;# re-INVITEs from public to private UA 
are hard to identify as<BR>&nbsp;# NATed at the moment of request processing); 
look at replies<BR>&nbsp;t_on_reply("1");<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;# send it 
out now; use stateful forwarding as it works reliably<BR>&nbsp;# even for 
UDP2TCP<BR>&nbsp;if (!t_relay()) 
{<BR>&nbsp;&nbsp;sl_reply_error();<BR>&nbsp;&nbsp;break;<BR>&nbsp;};<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">route[2] 
{<BR>&nbsp;force_rtp_proxy();<BR>&nbsp;t_on_reply("1");<BR>&nbsp;t_relay_to_udp("<U><EM>T1&nbsp;gateway 
IP</EM></U>","<EM><U>T1 Gateway UDP port</U></EM>");<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman"># !! Nathelper<BR>onreply_route[1] 
{<BR>&nbsp;&nbsp;&nbsp; # NATed transaction ?<BR>&nbsp;&nbsp;&nbsp; if 
(isflagset(6) &amp;&amp; status =~ "(183)|2[0-9][0-9]") 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fix_nated_contact();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Times New Roman">&nbsp;# Not all 2xx messages have a content 
body so here we make sure<BR>&nbsp;# out Content-Length &gt; 0 to avoid a parse 
error<BR>&nbsp;if (!search("^Content-Length:\0")) 
{<BR>&nbsp;&nbsp;force_rtp_proxy();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
};<BR>&nbsp;&nbsp;&nbsp; # otherwise, is it a transaction behind a NAT and we 
did not<BR>&nbsp;&nbsp;&nbsp; # know at time of request processing ? (RFC1918 
contacts)<BR>&nbsp;&nbsp;&nbsp; } else if (nat_uac_test("1")) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fix_nated_contact();<BR>&nbsp;&nbsp;&nbsp; 
};<BR>}</FONT></DIV></FONT></DIV></FONT></BODY></HTML>