---------- Forwarded message ----------
From: frq ser <frq.ser@googlemail.com>
Date: Dec 18, 2007 11:32 PM
Subject: Newbie Problems: ser.cfg
To: serusers@iptel.org

Hi,

I am trying to understand the process flow in the following ser.cfg file, which controls a SER proxy server at root@ip.address:5060. I have added "log()" command at almost every step to see how things proceed.

The problem is that when I generate an OPTIONS message through SIPSAK (sipsak -T -vv -s sip:root@ip.address:5060), the process branches from route(0) to route(3), sends a message (200 Message received, probably from Sipsak), then comes back to route(0), completes this route, and then loops back to start of route(0) (as evident from the last log message "Inside main route..."). This is despite the "break" command in the main route block. Here's the output of the SER:

[root@drone08 ~]# ser 
Listening on 
             udp: 192.168.3.208 [ 192.168.3.208]:5060 
             tcp: 192.168.3.208 [ 192.168.3.208]:5060 
Aliases: 
             tcp: 192.168.3.208:5060 
             udp: 192.168.3.208:5060 
 
WARNING: no fork mode 
stateless - initializing 
 0(0) Maxfwd module- initializing 
 0(0) INFO: udp_init: SO_RCVBUF is initially 107520 
 0(0) INFO: udp_init: SO_RCVBUF is finally 262142 
 2(0) INFO: fifo process starting: 5116
 2(0) SER: open_uac_fifo: fifo server up at /tmp/ser_fifo...
 2(0) WARNING: no fifo_db_url given - fifo DB commands disabled!
 0(5114) Inside the main route....
 0(5114) Inside the main route....
 0(5114) just passed the sanity checks...
 0(5114) inside method-register...
 0(5114) inside method-options...
 0(5114) Inside route3...
 0(5114) End of route3...
 0(5114) just past redir-route3..
 0(5114) Inside the main route....

 The corresponding SIPSAK output is:
 C:\..Sipsak>sipsak -v -T -s sip:root@192.168.3.208:5060
warning: IP extract from warning activated to be more informational
0: 192.168.3.208 (0.000 ms) SIP/2.0 483 Too Many Hops
1: 192.168.3.208 (0.000 ms) SIP/2.0 201 Options message received, probably from
Sipsak
        without Contact header


On the other hand, when I send an INVITE message, this problem doesn't happen. The process completes the main route and doesn't loop back (ie I don't get the "Inside the main route..." message).

[root@drone08 ~]# ser  
Listening on  
             udp: 192.168.3.208 [ 192.168.3.208]:5060  
             tcp: 192.168.3.208 [ 192.168.3.208]:5060  
Aliases:  
             tcp: 192.168.3.208:5060  
             udp: 192.168.3.208:5060  
  
WARNING: no fork mode  
stateless - initializing  
 0(0) Maxfwd module- initializing  
 0(0) INFO: udp_init: SO_RCVBUF is initially 107520  
 0(0) INFO: udp_init: SO_RCVBUF is finally 262142  
 2(0) INFO: fifo process starting: 4860
 2(0) SER: open_uac_fifo: fifo server up at /tmp/ser_fifo...
 2(0) WARNING: no fifo_db_url given - fifo DB commands disabled!
 0(4858) Inside the main route....
 0(4858) just passed the sanity checks...
 0(4858) inside method-register...
 0(4858) outside methods-options...
 0(4858) inside lookup-location...


All I want to know is that when I send an OPTIONS msg, why the process doesn't terminate at the break command in the (if (method == "OPTIONS")) in the main route. Although it is not a critical problem, I just want to improve my understanding. I'll be glad if any of you could help.

Fr.

PS: The config file (ser.cfg) is given below:

# $Id: hello-world.cfg 46 2006-01-25 04:21:30Z /CN=Paul Hazlett/emailAddress=paul@onsip.org $  
debug=3  
fork=no  
log_stderror=yes  
  
listen= 192.168.3.208  #2.13
port=5060  
children=4  
  
dns=no  
rev_dns=no  
fifo="/tmp/ser_fifo"  
  
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"  
  
# chg_rsf dec07  
#loadmodule "/usr/local/lib/ser/modules/textops.so"  
#loadmodule "/usr/local/lib/ser/modules/avpops.so"  
  
modparam("usrloc", "db_mode",   0)  
modparam("rr", "enable_full_lr", 1)  


#modparam("tm", "pass_provisional_replies", 1)  

route {  
 log(1, "Inside the main route....\n"); 

 # ------------------------------------------------------------------------ 
 # Sanity Check Section 
 # ------------------------------------------------------------------------ 
 if (!mf_process_maxfwd_header("10")) { 
  sl_send_reply("483", "Too Many Hops");
  break;
 }; 

 if (msg:len > max_len) { 
  sl_send_reply("513", "Message Overflow");
  break;
 }; 

 log(3, "just passed the sanity checks...\n"); 
 
 # ------------------------------------------------------------------------ 
 # Record Route Section 
 # ------------------------------------------------------------------------ 
 if (method!="REGISTER") { 
  record_route();
  log(3, "inside method-register...\n");
 }; 

 # ------------------------------------------------------------------------ 
 # Loose Route Section 
 # ------------------------------------------------------------------------ 
 if (loose_route()) { 
  log(3, "inside loose route...\n");
  route(1);
  break;
 }; 

 # ------------------------------------------------------------------------ 
 # Call Type Processing Section 
 # ------------------------------------------------------------------------ 
 if (uri!=myself) { 
  log(3, "inside uri-myself...\n");
  route(1);
  break;
 }; 

 if (method=="ACK") { 
  log(3, "inside method-ack...\n");
  route(1);
  break;
 } 

 else if (method=="REGISTER") { 
  log(3, "inside method-register...\n");
  route(2);
  break;
 }; 

 if (method=="OPTIONS"){ 
  log(3, "inside method-options...\n");
  route(3);
  log(3, "just past redir-route3..\n");
  break;
  log(3, "just past break...\n");
 }; 
 log(3, "outside methods-options...\n"); 

 lookup("aliases"); 
 if (uri!=myself) { 
  log(3, "inside uri-myself 2....\n");
  route(1);
  break;
 }; 

 if (!lookup("location")) { 
  log(3, "inside lookup-location...\n");
  sl_send_reply("404", "User Not Found");
  break;
 }; 

 route(1); 
}  

route[1] {  
 # ------------------------------------------------------------------------ 
 # Default Message Handler 
 # ------------------------------------------------------------------------ 
 log(3, "Inside route1...\n"); 
 if (!t_relay()) { 
  sl_reply_error();
 }; 
}  

route[2] {  
 # ------------------------------------------------------------------------ 
 # REGISTER Message Handler 
 # ------------------------------------------------------------------------ 
 log(3, "Inside route2...\n"); 
 if (!save("location")) { 
  #sl_reply_error();
  sl_send_reply("201", "Register message received at Proxy Server");
 }; 
}  
route[3]{  
 # ----------------------------------------------------------------------- 
 # OPTIONS Message Handler 
 # ----------------------------------------------------------------------- 
 log(3, "Inside route3...\n"); 
 if (!t_relay()){ 
  sl_reply_error();

 }; 

 sl_send_reply("201", "Options message received, probably from Sipsak"); 
 #forward(192.168.3.208 , 5070); 
 log(3, "End of route3...\n"); 
 #t_release(); 

}