<!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.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I'm having this situation while configuring a new
SER installation over a Debian Linux:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have two</FONT><FONT face=Arial size=2> two
grandstream BT-101 as UA configured with the default parameters and</FONT></DIV>
<DIV><FONT face=Arial size=2>proxy, user, ID and password.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Both phones are behind a LinkSys ADSL router and
work fine if I register to iptel.org</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>When I register to my own server (freephonet.com)
only one completes the registration and</FONT></DIV>
<DIV><FONT face=Arial size=2>serctl moni shows issuing continuous 401 stauts
codes.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The ser.cfg in use is the following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT size=2><SPAN># FREEPHONET SIP SERVER I</SPAN><BR><SPAN># SER Config
File</SPAN><BR><SPAN># named gateway.freephonet.com at ip address
69.60.109.205</SPAN><BR><SPAN># running on a Debian Linux
server</SPAN><BR><SPAN># </SPAN><BR><SPAN># ------------- version 0.8.14
--------------------------------------------</SPAN><BR><SPAN># -------------
Initial global variables
----------------------------------</SPAN><BR><SPAN>/*</SPAN><BR><SPAN>debug=3</SPAN><BR><SPAN>fork=yes</SPAN><BR><SPAN>log_stderror=no</SPAN><BR><SPAN>*/</SPAN><BR><SPAN>#listen=69.60.109.205</SPAN><BR><SPAN>#listen=127.0.0.1</SPAN><BR><SPAN>#
hostname matching an alias will satisfy the condition
uri==myself".</SPAN><BR><SPAN>alias=freephonet.com</SPAN><BR><SPAN>alias=69.60.109.205</SPAN><BR><SPAN>#
dns - Uses dns to check if it is necessary to add a "received="
field</SPAN><BR><SPAN># to a via. Default is no.</SPAN><BR><SPAN># rev_dns -
Same as dns but use reverse DNS.</SPAN><BR><SPAN>dns=no # (cmd. line:
-r)</SPAN><BR><SPAN>rev_dns=no # (cmd. line:
-r)</SPAN><BR><SPAN>port=5060</SPAN><BR><SPAN>children=4</SPAN><BR><SPAN>#
check_via - Turn on or off Via host checking when forwarding
replies.</SPAN><BR><SPAN># Default is no. arcane. looks for discrepancy between
name and</SPAN><BR><SPAN># ip address when forwarding
replies.</SPAN><BR><SPAN>check_via=no # (cmd. line: -v)</SPAN><BR><SPAN>#
syn_branch - Shall the server use stateful synonym branches? It
is</SPAN><BR><SPAN># faster but not reboot-safe. Default is
yes.</SPAN><BR><SPAN>syn_branch=no</SPAN><BR><SPAN># memlog - Debugging level
for final memory statistics report.</SPAN><BR><SPAN># Default is L_DBG - memory
statistics are dumped</SPAN><BR><SPAN># only if debug is set
high.</SPAN><BR><SPAN>memlog=3</SPAN><BR><SPAN># sip_warning - Should replies
include extensive warnings? By default</SPAN><BR><SPAN># yes, it is good for
trouble-shooting.</SPAN><BR><SPAN>sip_warning=yes</SPAN><BR><SPAN># fifo - FIFO
special file pathname</SPAN><BR><SPAN>fifo="/tmp/ser_fifo"</SPAN><BR><SPAN>#
server_signature - Should locally-generated messages include
server's</SPAN><BR><SPAN># signature? By default yes, it is good
for</SPAN><BR><SPAN>#
trouble-shooting.</SPAN><BR><SPAN>server_signature=yes</SPAN><BR><SPAN>#
reply_to_via - A hint to reply modules whether they should send
reply</SPAN><BR><SPAN># to IP advertised in Via. Turned off by default,
which</SPAN><BR><SPAN># means that replies are sent to IP address from
which</SPAN><BR><SPAN># requests
came.</SPAN><BR><SPAN>reply_to_via=no</SPAN><BR><SPAN># user | uid - uid to be
used by the server. 99 = nobody.</SPAN><BR><SPAN>#uid="nobody"</SPAN><BR><SPAN>#
group | gid - gid to be used by the server. 99 =
nobody.</SPAN><BR><SPAN>#gid="nobody"</SPAN><BR><SPAN># mhomed -- enable
calculation of outbound interface; useful on</SPAN><BR><SPAN># multihomed
servers.</SPAN><BR><SPAN>mhomed=0</SPAN><BR><SPAN># ------------- external
module loading --------------------------------------</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/mysql.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/sl.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/tm.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/rr.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/maxfwd.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/usrloc.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/registrar.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/auth.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/auth_db.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/acc.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/exec.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/group.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/print.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/textops.so"</SPAN><BR><SPAN>loadmodule
"/usr/lib/ser/modules/uri.so"</SPAN><BR><SPAN># ------------- tm parameters
------------------------------------------------</SPAN><BR><SPAN>modparam("tm",
"fr_timer", 12) # Timer which hits if no final reply for a</SPAN><BR><SPAN>#
request or ACK for a negative INVITE</SPAN><BR><SPAN># reply arrives (in
seconds).</SPAN><BR><SPAN># Default value is 30
seconds.</SPAN><BR><SPAN>modparam("tm", "fr_inv_timer", 24) # Timer which hits
if no final reply for an</SPAN><BR><SPAN># INVITE arrives after a provisional
message</SPAN><BR><SPAN># was received (in seconds).</SPAN><BR><SPAN># Default
value is 120 seconds.</SPAN><BR><SPAN># ------------- rr parameters
-------------------------------------------------</SPAN><BR><SPAN># set ";lr"
tag to ";lr=true"</SPAN><BR><SPAN>modparam("rr", "enable_full_lr", 1) # If set
to 1 then ;lr=on instead of just ;lr</SPAN><BR><SPAN># will be used. This is to
overcome problems</SPAN><BR><SPAN># with broken UAs which strip ;lr
parameter</SPAN><BR><SPAN># when generating Route header fields from
</SPAN><BR><SPAN># Record-Route (;lr=on seems to help).</SPAN><BR><SPAN>#
Default value is 0 (no).</SPAN><BR><SPAN># ------------- accounting parameters
-----------------------------------------</SPAN><BR><SPAN>modparam("acc",
"log_level", 1) # Log level at which accounting messages are</SPAN><BR><SPAN>#
issued to syslog. Default value is L_NOTICE.</SPAN><BR><SPAN>modparam("acc",
"log_flag", 1) # Request flag which needs to be set to</SPAN><BR><SPAN># account
a transaction. Default value is 1.</SPAN><BR><SPAN>modparam("acc",
"log_missed_flag", 3) # Request flag which needs to be set to</SPAN><BR><SPAN>#
account missed calls. Default value is 2.</SPAN><BR><SPAN># ------------- usrloc
parameters ---------------------------------------------</SPAN><BR><SPAN># 2
enables write-back to persistent mysql storage for speed</SPAN><BR><SPAN>#
disable=0, write-through=1</SPAN><BR><SPAN>modparam("usrloc", "db_mode",
2)</SPAN><BR><SPAN># minimize write back window - default is 60
seconds</SPAN><BR><SPAN>modparam("usrloc", "timer_interval",
10)</SPAN><BR><SPAN># database location</SPAN><BR><SPAN>modparam("usrloc",
"db_url", "sql://ser:heslo@localhost/ser")</SPAN><BR><SPAN># ------------- auth
parameters ----------------------------------------------</SPAN><BR><SPAN>#
database location</SPAN><BR><SPAN>modparam("auth_db", "db_url",
"sql://ser:heslo@localhost/ser")</SPAN><BR><SPAN># allows clear text passwords
in the mysql database</SPAN><BR><SPAN>modparam("auth_db", "calculate_ha1",
yes)</SPAN><BR><SPAN># name of password column in mysql
database</SPAN><BR><SPAN>modparam("auth_db", "password_column",
"password")</SPAN><BR><SPAN># ------------- routing logic
------------------------------------------------</SPAN><BR><SPAN>route
{</SPAN><BR><SPAN># ------------- routine checks
--------------------------------------------</SPAN><BR><SPAN></SPAN><BR><SPAN>#
stop forwarding at 10 hops to prevent infinite loops</SPAN><BR><SPAN>if
(!mf_process_maxfwd_header("10")) {</SPAN><BR><SPAN>log(1, "LOG: Too many
hops\n");</SPAN><BR><SPAN>sl_send_reply("483", "Too many
hops");</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
prevents private ip space from being used</SPAN><BR><SPAN>#if
(search("^(Contact|m): .*@(192\.168\.|10\.|172\.16)")) {</SPAN><BR><SPAN># if
(method=="REGISTER") {</SPAN><BR><SPAN># log(1, "LOG: Someone trying to register
from private IP\n");</SPAN><BR><SPAN># sl_send_reply("479", "Please don't use
private IP addresses" );</SPAN><BR><SPAN># break;</SPAN><BR><SPAN>#
};</SPAN><BR><SPAN>#};</SPAN><BR><SPAN></SPAN><BR><SPAN># separate the
destination r-uri from the set of proxies that must be
traversed</SPAN><BR><SPAN>loose_route();</SPAN><BR><SPAN></SPAN><BR><SPAN># if
the host portion of the request uri is not local, send it
directly</SPAN><BR><SPAN># to route processing.</SPAN><BR><SPAN>if
(!(uri==myself))
{</SPAN><BR><SPAN>route(2);</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
All REGISTER attempts are processed and must always be
authenticated</SPAN><BR><SPAN>if (method=="REGISTER")
{</SPAN><BR><SPAN></SPAN><BR><SPAN># make sure that users don't register
infinite loops</SPAN><BR><SPAN>if (search("^(Contact|m):
.*@(69\.60\.109\.205|(proxy\.)?freephonet\.com)")) {</SPAN><BR><SPAN>log(1,
"LOG: alert: someone trying to set
aor==contact\n");</SPAN><BR><SPAN>sl_send_reply("476", "No Server Address in
Contacts Allowed"
);</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
challenge/response</SPAN><BR><SPAN>if (!www_authorize("freephonet.com",
"subscriber")) {</SPAN><BR><SPAN>www_challenge("freephonet.com",
"0");</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
only registered users are allowed</SPAN><BR><SPAN>if (!is_user("replicator")
& !check_to()) {</SPAN><BR><SPAN>log(1, "LOG: unregistered user registration
attempt\n");</SPAN><BR><SPAN>sl_send_reply("403", "Only registered users are
allowed");</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
it is an authenticated request, update Contact database now</SPAN><BR><SPAN>if
(!save("location"))
{</SPAN><BR><SPAN>sl_reply_error();</SPAN><BR><SPAN>};</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN>#
process traffic local to freephonet and the PSTN</SPAN><BR><SPAN># Find the
canonical
username</SPAN><BR><SPAN>lookup("aliases");</SPAN><BR><SPAN></SPAN><BR><SPAN>#
check domain again, if it is not still local after the alias</SPAN><BR><SPAN>#
table lookup, just send it on its way. We do not authenticate</SPAN><BR><SPAN>#
traffic we forward</SPAN><BR><SPAN>if
(!(uri=~"^sip:(.+@)?(69\.60\.109\.205|(proxy\.)?freephonet\.com)([:;\?].*)?$"))
{</SPAN><BR><SPAN>route(5);</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
now check for destinations through the gateway. 911 and 9911</SPAN><BR><SPAN>#
are always sent to the gateway. The assumption is that other
all</SPAN><BR><SPAN># numeric usernames between 5 and 20 digits are really pstn
numbers</SPAN><BR><SPAN># and so they are routed to the
gateway</SPAN><BR><SPAN>if ( (uri=~"^sip:911@.*") | (uri=~"^sip:9911@.*") |
(uri=~"sip:[0-9]{5,20}@.*") )
{</SPAN><BR><SPAN>route(3);</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN>#
does the user wish redirection on no availability? (i.e., is
he</SPAN><BR><SPAN># in the voicemail (ser->grp) group?)</SPAN><BR><SPAN>if
(is_user_in("Request-URI", "voicemail"))
{</SPAN><BR><SPAN>t_on_failure("4");</SPAN><BR><SPAN>setflag(4);</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
handle local SIP destinations not found in usrloc
db</SPAN><BR><SPAN></SPAN><BR><SPAN># mostly offline or non-existent
users</SPAN><BR><SPAN>if (!lookup("location"))
{</SPAN><BR><SPAN>route(4);</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
check whether some inventive user has uploaded gateway</SPAN><BR><SPAN>#
contacts to usrloc to bypass authorization logic</SPAN><BR><SPAN>if
(uri=~"@10\.1\.2\.5([;:].*)*" ) {</SPAN><BR><SPAN>log(1, "LOG: Gateway address
in
UsrLoc\n");</SPAN><BR><SPAN>route(3);</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>#
this flag is used with the acc module to report missed calls</SPAN><BR><SPAN>#
to syslog.</SPAN><BR><SPAN>setflag(3);</SPAN><BR><SPAN></SPAN><BR><SPAN># do it
(words to live by)</SPAN><BR><SPAN>append_hf("P-hint:
USRLOC\r\n");</SPAN><BR><SPAN>if (!t_relay())
{</SPAN><BR><SPAN>sl_reply_error();</SPAN><BR><SPAN>break;</SPAN><BR><SPAN>};</SPAN><BR><SPAN></SPAN><BR><SPAN>}
/* end of initial routing logic */</SPAN><BR><SPAN><FONT
face=Arial></FONT> </SPAN><BR></FONT></DIV></BODY></HTML>