<!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.1479" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Times New Roman">Hi,</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman">I am running ser0.8.14 and rtpproxy. Could
anyone help me how to configure ser.cfg so that I can forward sip call to
pstn gateway once I receive a prefix 9?</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman">I know that I need to add something like
"t_relay_to_udp" and "rewritehost" commands, however, I do not know how to add
these commands in my script.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman">Thank you so much if you could give some
advice to me.</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman">Thomas</FONT></DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman"></FONT> </DIV>
<DIV><FONT face="Times New Roman">----------------------</FONT></DIV>
<DIV><FONT face="Times New Roman">Here is my config.</FONT></DIV>
<DIV><FONT face="Times New Roman">----------------------</FONT></DIV>
<DIV>#<BR># $Id: nathelper.cfg,v 1.1.2.1 2003/11/24 14:47:18 janakj Exp
$<BR>#<BR># simple quick-start config script including nathelper
support<BR><BR># This default script includes nathelper support. To make it
work<BR># you will also have to install Maxim's RTP proxy. The proxy is
enforced<BR># if one of the parties is behind a NAT.<BR>#<BR># If you have an
endpoing in the public internet which is known to<BR># support symmetric RTP
(Cisco PSTN gateway or voicemail, for example),<BR># then you don't have to
force RTP proxy. If you don't want to enforce<BR># RTP proxy for some
destinations than simply use t_relay() instead of<BR># route(1)<BR>#<BR>#
Sections marked with !! Nathelper contain modifications for nathelper<BR>#<BR>#
NOTE !! This config is EXPERIMENTAL !<BR>#<BR># ----------- global configuration
parameters
------------------------<BR><BR>debug=7
# debug level (cmd line:
-dddddddddd)<BR>fork=yes<BR>log_stderror=yes
# (cmd line: -E)<BR><BR>/* Uncomment these lines to enter debugging mode
<BR>fork=no<BR>log_stderror=yes<BR>*/<BR><BR>check_via=no
# (cmd. line:
-v)<BR>dns=no #
(cmd. line: -r)<BR>rev_dns=no # (cmd. line:
-R)<BR>port=5060<BR>children=4<BR>fifo="/tmp/ser_fifo"<BR><BR>#
------------------ module loading ----------------------------------<BR><BR>#
Uncomment this if you want to use SQL database<BR>#loadmodule
"/usr/local/lib/ser/modules/mysql.so"<BR><BR>loadmodule
"/usr/lib/ser/modules/sl.so"<BR>loadmodule
"/usr/lib/ser/modules/tm.so"<BR>loadmodule
"/usr/lib/ser/modules/rr.so"<BR>loadmodule
"/usr/lib/ser/modules/maxfwd.so"<BR>loadmodule
"/usr/lib/ser/modules/usrloc.so"<BR>loadmodule
"/usr/lib/ser/modules/registrar.so"<BR>loadmodule
"/usr/lib/ser/modules/textops.so"<BR><BR># Uncomment this if you want digest
authentication<BR># mysql.so must be loaded !<BR>#loadmodule
"/usr/lib/ser/modules/auth.so"<BR>#loadmodule
"/usr/lib/ser/modules/auth_db.so"<BR><BR># !! Nathelper<BR>loadmodule
"/usr/lib/ser/modules/nathelper.so"<BR><BR># ----------------- setting
module-specific parameters ---------------<BR><BR># -- usrloc params
--<BR><BR>modparam("usrloc", "db_mode", 0)<BR><BR># Uncomment this
if you want to use SQL database <BR># for persistent storage and comment the
previous line<BR>#modparam("usrloc", "db_mode", 2)<BR><BR># -- 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")<BR><BR>#
-- rr params --<BR># add value to ;lr param to make some broken UAs
happy<BR>modparam("rr", "enable_full_lr", 1)<BR><BR># !!
Nathelper<BR>modparam("registrar", "nat_flag", 6)<BR>modparam("nathelper",
"natping_interval", 30) # Ping interval 30 s<BR>#modparam("nathelper",
"ping_nated_only", 1) # Ping only clients behind NAT<BR><BR>#
------------------------- request routing logic
-------------------<BR><BR># main routing
logic<BR><BR>route{<BR><BR> # initial
sanity checks -- messages with<BR> #
max_forwards==0, or excessively long
requests<BR> if
(!mf_process_maxfwd_header("10"))
{<BR>
sl_send_reply("483","Too Many
Hops");<BR>
break;<BR>
};<BR> if (msg:len >= max_len
)
{<BR>
sl_send_reply("513", "Message too
big");<BR>
break;<BR>
};<BR><BR> # !!
Nathelper<BR> # Special handling for
NATed clients; first, NAT test is<BR>
# executed: it looks for via!=received and RFC1918
addresses<BR> # in Contact (may fail
if line-folding is used); also,<BR> #
the received test should, if completed, should check
all<BR> # vias for rpesence of
received<BR> #if (nat_uac_test("3"))
{<BR>
# Allow RR-ed requests, as these may indicate
that<BR>
# a NAT-enabled proxy takes care of it; unless it
is<BR>
# a
REGISTER<BR><BR>
if (method == "REGISTER" || ! search("^Record-Route:"))
{<BR>
log("LOG: Someone trying to register from private IP,
<BR>rewriting\n");<BR><BR>
# This will work only for user agents that support
symmetric<BR>
# communication. We tested quite many of them and majority
<BR>is<BR>
# smart enough to be symmetric. In some phones it takes a
<BR>configuration<BR>
# option. With Cisco 7960, it is called NAT_Enable=Yes, <BR>with kphone it
is<BR>
# called "symmetric media" and "symmetric
signalling".<BR><BR>
fix_nated_contact(); # Rewrite contact with source IP of
<BR>signalling<BR>
if (method == "INVITE")
{<BR>
fix_nated_sdp("1"); # Add direction=active to
SDP<BR>
};<BR>
force_rport(); # Add rport parameter to topmost
Via<BR>
setflag(6); # Mark as
NATed<BR>
};<BR>
#};<BR><BR> # we record-route all
messages -- to make sure that<BR> #
subsequent messages will go through our proxy;
that's<BR> # particularly good if
upstream and downstream entities<BR> #
use different transport protocol<BR>
if (!method=="REGISTER")
record_route();
<BR><BR> # subsequent messages withing
a dialog should take the<BR> # path
determined by record-routing<BR> if
(loose_route())
{<BR>
# mark routing logic in
request<BR>
append_hf("P-hint: rr-enforced\r\n");
<BR>
route(1);<BR>
break;<BR>
};<BR><BR> if (!uri==myself)
{<BR>
# mark routing logic in
request<BR>
append_hf("P-hint: outbound\r\n");
<BR>
route(1);<BR>
break;<BR>
};<BR><BR> # if the request is for
other domain use UsrLoc<BR> # (in
case, it does not work, use the following
command<BR> # with proper names and
addresses in it)<BR> if (uri==myself)
{<BR><BR> if (method=="REGISTER")
{<BR><BR># Uncomment this if you want to use digest
authentication<BR>#
if (!www_authorize("iptel.org", "subscriber"))
{<BR>#
www_challenge("iptel.org",
"0");<BR>#
break;<BR>#
};<BR><BR>
save("location");<BR>
break;<BR>
};<BR><BR>
lookup("aliases");<BR>
if (!uri==myself)
{<BR>
append_hf("P-hint: outbound alias\r\n");
<BR>
route(1);<BR>
break;<BR>
};<BR><BR>
# native SIP destinations are handled using our USRLOC
DB<BR>
if (!lookup("location"))
{<BR>
sl_send_reply("404", "Not
Found");<BR>
break;<BR>
};<BR>
};<BR> append_hf("P-hint: usrloc
applied\r\n"); <BR>
route(1);<BR>}<BR><BR>route[1]
<BR>{<BR> # !!
Nathelper<BR> if
(uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &&
!<BR>search("^Route:")){<BR>
sl_send_reply("479", "We don't forward to private IP
addresses");<BR>
break;<BR>
};<BR>
<BR> # if client or server know to be
behind a NAT, enable relay<BR> if
(isflagset(6))
{<BR>
force_rtp_proxy();<BR>
};<BR><BR> # NAT processing of
replies; apply to all transactions (for
example,<BR> # re-INVITEs from public
to private UA are hard to identify
as<BR> # NATed at the moment of
request processing); look at
replies<BR>
t_on_reply("1");<BR><BR> # send it out
now; use stateful forwarding as it works
reliably<BR> # even for
UDP2TCP<BR> if (!t_relay())
{<BR>
sl_reply_error();<BR> };<BR>}<BR><BR>#
!! Nathelper<BR>onreply_route[1] {<BR> # NATed transaction
?<BR> if (isflagset(6) && status =~
"(183)|2[0-9][0-9]") {<BR>
fix_nated_contact();<BR>
force_rtp_proxy();<BR> # otherwise, is it a transaction behind
a NAT and we did not<BR> # know at time of request processing
? (RFC1918 contacts)<BR> } else
{<BR>
fix_nated_contact();<BR> };<BR>}</DIV></BODY></HTML>