Chapter 6. Hello World ser.cfg

Table of Contents

ser.cfg Listing
Hello World ser.cfg Analysis
Using The Hello World ser.cfg Configuration

It is a very good idea to start SER with a basic Hello World ser.cfg to ensure that the SIP server is working.

What this ser.cfg will do:

  1. Establish a SIP server on your internal LAN

  2. Allow you to connect IP phones on your internal LAN to SER

  3. Make calls between the IP phones on the LAN

What this ser.cfg will NOT do:

  1. There is no authentication for the IP telephones nor any database support. These will be added later.

  2. there is no support for PSTN, the phones connected to the LAN can only communicate between themselves.

ser.cfg Listing

Listed below is the Hello Word configuration to support the simple configuration above. You can download a version of this file from www.ONsip.org. A detailed analysis of this ser.cfg follows the example.

debug=31
fork=no2
log_stderror=yes3

listen=192.0.2.134       # INSERT YOUR IP ADDRESS HERE
port=50605
children=46

dns=no7
rev_dns=no
fifo="/tmp/ser_fifo"8

9
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"

modparam("usrloc", "db_mode", 0)10
modparam("rr", "enable_full_lr", 1)(11)

(12)route {

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

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

  # ------------------------------------------------------------------------
  # Record Route Section
  # ------------------------------------------------------------------------
  if (method!="REGISTER") { (17)
    record_route();(18)
  };

  # ------------------------------------------------------------------------
  # Loose Route Section
  # ------------------------------------------------------------------------
  if (loose_route()) { (19)
    route(1);(20)
    break;(21)
  };

  # ------------------------------------------------------------------------
  # Call Type Processing Section
  # ------------------------------------------------------------------------
  if (uri!=myself) { (22)
    route(1);(23)
    break;(24)
  };

  if (method=="ACK") {(25)
    route(1);(26)
    break;(27)
  } if (method=="REGISTER") { (28)
    route(2);(29)
    break;(30)
  };

  lookup("aliases");(31)
  (32)if (uri!=myself) {
    route(1);
    break;
  };

  if (!lookup("location")) { (33)
    sl_send_reply("404", "User Not Found");(34)
    break;(35)
  };

  route(1);(36)
}

(37)route[1] { 
  # ------------------------------------------------------------------------
    # Default Message Handler
  # ------------------------------------------------------------------------
  if (!t_relay()) {(38)
    sl_reply_error();(39)
  };
  }

(40)route[2] {
  # ------------------------------------------------------------------------
  # REGISTER Message Handler
  # ------------------------------------------------------------------------
  if (!save("location")) { (41)
    sl_reply_error();(42)
  };
}