Dear all,
I have a simple query.
I want to configure SER in such a way that, when endpoints are behind
different NAT or same NAT, RTP flow will be from endpoint to endpoint.
Is there any way to configure SER in such a way? Now I am using RTP PROXY
for rtp flow. But I need endpoint to endpoint at least NAT DEVICE to
NATDEVICE rtp flow.
Thank you in advance.
Rokib
Hi List,
I'm tryin to configure ser with sems, on a RedHat version 9.
I'm receiving this errors:
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command DB is not available
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server:n command must begin with ::
email_address
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command must begin with ::
subscriber
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command must have at least
3 chars
Feb 9 01:36:00 sip Sems[4816]: Error: (AmSession.cpp)(startSession)(468): 404
voicemail: no email address for user <1002>
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command t_reply is not
available
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command must begin with ::
voicemail: no email address for user <1002>
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command must begin with ::
000012D07BAA2BC1
Feb 9 01:36:00 sip ser[4781]: ERROR: fifo_server: command must have at least
3 chars
Feb 9 01:36:00 sip Sems[4816]: Error: (AmRequest.cpp)(reply)(335):
AmRequestUAS::reply: 500 command 't_reply' not available
Can anyone help me with this, thank you in advanced. I've attached my ser.cfg
and sems.conf below.
----- start of ser.cfg -----
#
# $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
#
# simple quick-start config script
#
# ----------- global configuration parameters ------------------------
#debug=3 # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
debug=7
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
listen=192.168.0.2
alias="sip.nhadzter.com"
alias="nhadzter.com"
alias="192.168.0.2"
fifo="/tmp/ser_fifo"
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/ser/modules/mysql.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/vm.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
#modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# ----------------- voicemail parameters ---------------
#modparam("voicemail", "db_url","/home/rco/cvs/ser/sip_router/modules/vm/db")
modparam("voicemail", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("voicemail", "email_column", "email_address")
modparam("voicemail", "subscriber_table", "subscriber")
modparam("voicemail", "user_column", "username")
modparam("voicemail", "domain_column", "domain")
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if ( msg:len > max_len ) {
sl_send_reply("513", "Message too big");
break;
};
# we record-route all messages -- to make sure that
# subsequent messages will go through our proxy; that's
# particularly good if upstream and downstream entities
# use different transport protocol
record_route();
# loose-route processing
if (loose_route()) {
t_relay();
break;
};
# if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myself) {
if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication
if (!www_authorize("nhadzter.com", "subscriber")) {
www_challenge("nhadzter.com", "0");
break;
};
save("location");
break;
};
# Voicemail specific configuration - begin
if(method=="ACK" || method=="INVITE" || method=="BYE" ||
method=="REFER"){
if(t_newtran()){
t_reply("100","Trying -- just wait a minute !");
if(method=="INVITE" || method=="REFER"){
log("**************** vm start - begin
******************\n");
if( uri =~ "conference" ){
if(!vm("/tmp/am_fifo","conference")){
log("could not contact
conference server\n");
t_reply("500","could
not contact conference server");
};
}
else if( uri =~ "echo" ){
if(!vm("/tmp/am_fifo","echo")){
log("could not contact
echo\n");
t_reply("500","could
not contact echo");
};
}
else {
if(!vm("/tmp/am_fifo","voicemail")){
log("could not contact
voicemail\n");
t_reply("500","could
not contact voicemail");
};
};
log("**************** vm start - end
******************\n");
break;
};
if(method=="BYE"){
log("**************** vm end/refer -
begin ******************\n");
if(!vm("/tmp/am_fifo","bye")){
log("could not contact the
media server\n");
t_reply("500","could not
contact the media server");
};
log("**************** vm end/refer -
end ********************\n");
break;
};
}
else {
log("could not create new transaction\n");
sl_send_reply("500","could not create new
transaction");
};
};
# Voicemail specific configuration - end
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
break;
};
};
# forward to current uri now; use stateful forwarding; that
# works reliably even if we forward from TCP to UDP
if (!t_relay()) {
sl_reply_error();
};
}
------------- end of ser.cfg ------------------
---------start of sems.conf -----------------------
# $Id: sems.conf.sample,v 1.11.2.1 2004/01/27 15:08:28 rco Exp $
#
# sems.conf.sample
#
# Sip Express Media Server (sems)
#
# sample configuration file
#
#
# whitespaces (spaces and tabs) are ignored
# comments start with a "#" and may be used inline
#
# example: option=value1, value2 # i like this option
#
##################################
# global parameters #
##################################
# optional parameter: fork={yes|no}
#
# - specifies if sems should run in daemon mode (background)
# (fork=no is the same as -E)
fork=yes
# optional parameter: stderr={yes|no}
#
# - debug mode: do not fork and log to stderr
# (stderr=yes is the same as -E)
stderr=no
# optional parameter: loglevel={0|1|2|3}
#
# - sets log level (error=0, warning=1, info=2, debug=3)
# (same as -D)
loglevel=1
# optional parameter: fifo_name=<filename>
#
# - path and file name of our fifo file (same as -i)
fifo_name=/tmp/am_fifo
# optional parameter: ser_fifo_name=<filename>
#
# - path and file name of Ser's fifo file (same as -o)
ser_fifo_name=/tmp/ser_fifo
# optional parameter: plugin_path=<path>
#
# - sets the path to the plug-ins
# - may be absolute or relative to CWD
plugin_path=/usr/local/lib/sems/plug-in/
# optional parameter: smtp_server=<hostname>
#
# - sets address of smtp server
smtp_server=localhost
# optional parameter: smtp_port=<port>
#
# - sets port of smtp server
smtp_port=25
##################################
# module specific parameters #
##################################
# sample voicemail configuration (inline)
config.voicemail=inline
# optional parameter: announce_path=<path>
#
# - sets the path where announce files are searched for
# - the file to be played is determined the following way:
# <announce_path>/<domainname>/<username>.wav
# if this file is not available <announce_path>/<default_anounce> is used
announce_path=/usr/local/lib/sems/audio/
# parameter: default_announce=<filename>
#
# - sets the name of the default announce WAV file
default_announce=default_en.wav
# parameter: max_record_time=<seconds>
#
# - maximum record time
max_record_time=30
# parameter: accept_delay=<x>
#
# - delays accepting of the call for x seconds
# - default value is 0
accept_delay=20
# end of configuration section
# for voicemail module
config.voicemail=end
# sample announcement configuration (inline)
config.announcement=inline
# optional parameter: announce_path=<path>
#
# - sets the path where announce files are searched for
announce_path=/usr/local/lib/sems/audio/
# parameter: default_announce=<filename>
#
# - sets the name of the default announce WAV file
default_announce=default_en.wav
# end of configuration section for announcement module
config.announcement=end
# sample isdngw module configuration (external file)
# config.isdngw=/etc/isdngw.conf
# sample ivr module configuration (inline)
config.ivr=inline
#parameter: python_script_path=<full path>
python_script_path=/etc/ivr
#parameter: python_script_file=<filename>
python_script_file=example.py
# end of configuration section for ivr module
config.ivr=end
# sample conference configuration (inline)
config.conference=inline
# parameter: default_announce=<filename>
#
# - sets the full pathed name of the default announce WAV file.
# Will be played to lonely users.
default_announce=/usr/local/lib/sems/audio/first_participant.wav
# end of configuration section for conference module
config.conference=end
# example configuration for number reader
config.number_reader=inline
number_path=/usr/local/lib/sems/audio/
prolog_file=welcome_to_number_reader.wav
epilog_file=thanks_calling_number_reader.wav
# end of number_reader configuration
config.number_reader=end
# add more module configurations here (inline or external):
#
# config.mymodule=<filename>
# or
# config.mymodule=inline
# ...
# config.mymodule=end
------------- end of sems.conf -------------------
-- --
iTouch Communications, Inc.
Hello.
For those who have the same problem i have found a "work-around"
solution.
In the pyhton file, for example mediaproxy.py, there is a #! at the
beggining of the file with the route to the bin. You have to change this
for :
[prompt %]which pyhton2.3
/usr/local/bin/python2.3
this path is replaced in the mediaproxy.py file :
#!/usr/local/bin/python2.3
'''Provides a RTP Proxy server to be used in conjunction with SER's
mediaproxy
module. MediaProxy stands in between the 2 SIP clients participating in a
VoIP
conversation and forwards the RTP and RTCP streams between them, allowing
the SIP clients to work behind NAT without special settings on their behalf.
MediaProxy must have a public IP.
'''
....
at least that works for me !
Goos Luck.
Ricardo Javier Martinez Ogalde
Ingeniero de Desarrollo
VOISS NET S.A.
Cisco Certified Network Associate
* : (56 2) 240 81 96
* : (56 2) 245 74 95
* : rmartinez(a)redvoiss.net
> -----Mensaje original-----
> De: Ricardo Martinez [mailto:rmartinez@redvoiss.net]
> Enviado el: Martes, 08 de Febrero de 2005 13:03
> Para: 'serusers(a)lists.iptel.org'
> Asunto: [Serusers] Question on How Start MEDIAPROXY.
>
>
> Hello list.
> I have a question on How to Start Mediaproxy server.
> When i start
> mediaproxy from the console i obtain the following error:
>
> [root@sipproxy mediaproxy]# ./mediaproxy.py
> File "./mediaproxy.py", line 84
> print >>sys.stderr, "Mediaproxy error: %s. Exiting." % why
> ^
> SyntaxError: invalid syntax
>
> however i have installed Python2.3
> [root@sipproxy mediaproxy]# python
> python python1.5 python2 python2.2 python2.3
>
> When i start mediaproxy with the next lines it works ok :
>
> [root@sipproxy mediaproxy]# python2.3 mediaproxy.py
>
> So i made a test and i started mediaproxy with the original python.
>
> [root@sipproxy mediaproxy]# python mediaproxy.py
> File "mediaproxy.py", line 84
> print >>sys.stderr, "Mediaproxy error: %s. Exiting." % why
> ^
> SyntaxError: invalid syntax
>
> And i obtained the same initial error.
> My question is : Is there a way to force mediaproxy to start with the
> pyhton2.3? and therefore make mediaproxy start with
> %./mediaproxy.py and
> pyhton2.3
>
> Hope that someone can help me here.
>
> Thanks in advance,
>
> Ricardo Martinez.-
>
> _______________________________________________
> Serusers mailing list
> serusers(a)lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
>
Hello,
I am new to this list and SEr and am trying a very
simple scenario. I would like to establish a call
using SER via two grandstream BT100's(UA1 and UA2).
The two agent and SER are all on public addresses. The
two agents register with SER ok. However when I try to
ring UA2 from UA1, I get a 483 error. I know that this
mean there are too many hops. My config is practically
the same as the basic (i.e. standard)configuration
file (except for authorization and I have added a line
including an alias equal to the public address of
ser....the "if (uri==myself)" statement is correct I
think...I checked).
I checked the loopback address as suggested in the
archives and can see that the invite is repeatedly
sent to ser itself and 100 trying messages are sent to
ser itself, therefore the max forwards value value
must be reached and this is why the error occurs.
I note that when I comment out all the t_relay()'s in
ser.cfg, the error doesnt occur however the invite
from UA1 reached ser and thats it.(i.e. its not
forwarded)...Any help would be greatly appreciated(I
run the most stable version of ser released i.e
0.8.14)
Regards,
Pat.
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
Hi all.
If there any way to check group,username,password together.
I am using radius with mysql.
is_user_in("From", "somegroup") is checking if username is have some group privileges, but it's not checking the password.
Another question if any one had deal with cisco 7960 phones, and if there any problem with registrations requests, for some reason i changed the sip proxy to mine sip server and i don't see any registration requests.
Thanks a lot.
---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'
Hi,
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?
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.
Thank you so much if you could give some advice to me.
Thomas
----------------------
Here is my config.
----------------------
#
# $Id: nathelper.cfg,v 1.1.2.1 2003/11/24 14:47:18 janakj Exp $
#
# simple quick-start config script including nathelper support
# This default script includes nathelper support. To make it work
# you will also have to install Maxim's RTP proxy. The proxy is enforced
# if one of the parties is behind a NAT.
#
# If you have an endpoing in the public internet which is known to
# support symmetric RTP (Cisco PSTN gateway or voicemail, for example),
# then you don't have to force RTP proxy. If you don't want to enforce
# RTP proxy for some destinations than simply use t_relay() instead of
# route(1)
#
# Sections marked with !! Nathelper contain modifications for nathelper
#
# NOTE !! This config is EXPERIMENTAL !
#
# ----------- global configuration parameters ------------------------
debug=7 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/ser_fifo"
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
#loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/textops.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
#loadmodule "/usr/lib/ser/modules/auth.so"
#loadmodule "/usr/lib/ser/modules/auth_db.so"
# !! Nathelper
loadmodule "/usr/lib/ser/modules/nathelper.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# !! Nathelper
modparam("registrar", "nat_flag", 6)
modparam("nathelper", "natping_interval", 30) # Ping interval 30 s
#modparam("nathelper", "ping_nated_only", 1) # Ping only clients behind NAT
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if (msg:len >= max_len ) {
sl_send_reply("513", "Message too big");
break;
};
# !! Nathelper
# Special handling for NATed clients; first, NAT test is
# executed: it looks for via!=received and RFC1918 addresses
# in Contact (may fail if line-folding is used); also,
# the received test should, if completed, should check all
# vias for rpesence of received
#if (nat_uac_test("3")) {
# Allow RR-ed requests, as these may indicate that
# a NAT-enabled proxy takes care of it; unless it is
# a REGISTER
if (method == "REGISTER" || ! search("^Record-Route:")) {
log("LOG: Someone trying to register from private IP,
rewriting\n");
# This will work only for user agents that support symmetric
# communication. We tested quite many of them and majority
is
# smart enough to be symmetric. In some phones it takes a
configuration
# option. With Cisco 7960, it is called NAT_Enable=Yes,
with kphone it is
# called "symmetric media" and "symmetric signalling".
fix_nated_contact(); # Rewrite contact with source IP of
signalling
if (method == "INVITE") {
fix_nated_sdp("1"); # Add direction=active to SDP
};
force_rport(); # Add rport parameter to topmost Via
setflag(6); # Mark as NATed
};
#};
# we record-route all messages -- to make sure that
# subsequent messages will go through our proxy; that's
# particularly good if upstream and downstream entities
# use different transport protocol
if (!method=="REGISTER") record_route();
# subsequent messages withing a dialog should take the
# path determined by record-routing
if (loose_route()) {
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
route(1);
break;
};
if (!uri==myself) {
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
route(1);
break;
};
# if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myself) {
if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication
# if (!www_authorize("iptel.org", "subscriber")) {
# www_challenge("iptel.org", "0");
# break;
# };
save("location");
break;
};
lookup("aliases");
if (!uri==myself) {
append_hf("P-hint: outbound alias\r\n");
route(1);
break;
};
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
break;
};
};
append_hf("P-hint: usrloc applied\r\n");
route(1);
}
route[1]
{
# !! Nathelper
if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !
search("^Route:")){
sl_send_reply("479", "We don't forward to private IP addresses");
break;
};
# if client or server know to be behind a NAT, enable relay
if (isflagset(6)) {
force_rtp_proxy();
};
# NAT processing of replies; apply to all transactions (for example,
# re-INVITEs from public to private UA are hard to identify as
# NATed at the moment of request processing); look at replies
t_on_reply("1");
# send it out now; use stateful forwarding as it works reliably
# even for UDP2TCP
if (!t_relay()) {
sl_reply_error();
};
}
# !! Nathelper
onreply_route[1] {
# NATed transaction ?
if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
fix_nated_contact();
force_rtp_proxy();
# otherwise, is it a transaction behind a NAT and we did not
# know at time of request processing ? (RFC1918 contacts)
} else {
fix_nated_contact();
};
}
Hi,
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?
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.
Thank you so much if you could give some advice to me.
Thomas
----------------------
Here is my config.
----------------------
#
# $Id: nathelper.cfg,v 1.1.2.1 2003/11/24 14:47:18 janakj Exp $
#
# simple quick-start config script including nathelper support
# This default script includes nathelper support. To make it work
# you will also have to install Maxim's RTP proxy. The proxy is enforced
# if one of the parties is behind a NAT.
#
# If you have an endpoing in the public internet which is known to
# support symmetric RTP (Cisco PSTN gateway or voicemail, for example),
# then you don't have to force RTP proxy. If you don't want to enforce
# RTP proxy for some destinations than simply use t_relay() instead of
# route(1)
#
# Sections marked with !! Nathelper contain modifications for nathelper
#
# NOTE !! This config is EXPERIMENTAL !
#
# ----------- global configuration parameters ------------------------
debug=7 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/ser_fifo"
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
#loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/textops.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
#loadmodule "/usr/lib/ser/modules/auth.so"
#loadmodule "/usr/lib/ser/modules/auth_db.so"
# !! Nathelper
loadmodule "/usr/lib/ser/modules/nathelper.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# !! Nathelper
modparam("registrar", "nat_flag", 6)
modparam("nathelper", "natping_interval", 30) # Ping interval 30 s
#modparam("nathelper", "ping_nated_only", 1) # Ping only clients behind NAT
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if (msg:len >= max_len ) {
sl_send_reply("513", "Message too big");
break;
};
# !! Nathelper
# Special handling for NATed clients; first, NAT test is
# executed: it looks for via!=received and RFC1918 addresses
# in Contact (may fail if line-folding is used); also,
# the received test should, if completed, should check all
# vias for rpesence of received
#if (nat_uac_test("3")) {
# Allow RR-ed requests, as these may indicate that
# a NAT-enabled proxy takes care of it; unless it is
# a REGISTER
if (method == "REGISTER" || ! search("^Record-Route:")) {
log("LOG: Someone trying to register from private IP,
rewriting\n");
# This will work only for user agents that support symmetric
# communication. We tested quite many of them and majority
is
# smart enough to be symmetric. In some phones it takes a
configuration
# option. With Cisco 7960, it is called NAT_Enable=Yes,
with kphone it is
# called "symmetric media" and "symmetric signalling".
fix_nated_contact(); # Rewrite contact with source IP of
signalling
if (method == "INVITE") {
fix_nated_sdp("1"); # Add direction=active to SDP
};
force_rport(); # Add rport parameter to topmost Via
setflag(6); # Mark as NATed
};
#};
# we record-route all messages -- to make sure that
# subsequent messages will go through our proxy; that's
# particularly good if upstream and downstream entities
# use different transport protocol
if (!method=="REGISTER") record_route();
# subsequent messages withing a dialog should take the
# path determined by record-routing
if (loose_route()) {
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
route(1);
break;
};
if (!uri==myself) {
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
route(1);
break;
};
# if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myself) {
if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication
# if (!www_authorize("iptel.org", "subscriber")) {
# www_challenge("iptel.org", "0");
# break;
# };
save("location");
break;
};
lookup("aliases");
if (!uri==myself) {
append_hf("P-hint: outbound alias\r\n");
route(1);
break;
};
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
break;
};
};
append_hf("P-hint: usrloc applied\r\n");
route(1);
}
route[1]
{
# !! Nathelper
if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !
search("^Route:")){
sl_send_reply("479", "We don't forward to private IP addresses");
break;
};
# if client or server know to be behind a NAT, enable relay
if (isflagset(6)) {
force_rtp_proxy();
};
# NAT processing of replies; apply to all transactions (for example,
# re-INVITEs from public to private UA are hard to identify as
# NATed at the moment of request processing); look at replies
t_on_reply("1");
# send it out now; use stateful forwarding as it works reliably
# even for UDP2TCP
if (!t_relay()) {
sl_reply_error();
};
}
# !! Nathelper
onreply_route[1] {
# NATed transaction ?
if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
fix_nated_contact();
force_rtp_proxy();
# otherwise, is it a transaction behind a NAT and we did not
# know at time of request processing ? (RFC1918 contacts)
} else {
fix_nated_contact();
};
}
Hello List:
I am going to install SIP Proxy but not sure which one should I pick,
RIPProxy or MediaProxy.
Would you please post pros and cons of both.
Please don't take this mail as I am going to start a debate between the
users of RIP and Media. I am just trying to find which one will suit me
best.
Thanks,
MOhammad
sip:beeplove@iptel.org
Hi,
In our telephony network, telephones have a private telephone number and
a public telephone number. I want the CLIP to be the private telephone
number when calls are made to other company phones, and CLIP to be the
public telephone number when calling the outside world through the gateway.
eg: private number: 911/XXXXX <-> 02/52XXXXX public number
921/XXXX <-> 03/204XXXX
and so on.
I know I could hardcode this in SER using something similar to
subst("/^From:."(.*)sip:([^@]*@[a-zA-Z0-9.]+(.*))$/From: "+\1sip:+\2/");
(got that from a previous mail :)), but my numbering plan is too
complicated, and changes too often to implement it that way.
I'd prefer it to be in some database table which I could access through
some exec-statement. For Uri translation this would be easy with the
exec_dst statement, but I can't see any way to put the outcome of an
exec statement in some sort of variable, which I would then use in the
subst() statement. Or am I overlooking something???
Thanks,
Piet