SER example MySQL

SIP Express Router

example: SER working with MySQL


  1. $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
  2. simple quick-start config script

  1. ----------- global configuration parameters ------------------------

  1. debug=3 # debug level (cmd line: -dddddddddd)
  2. fork=yes
  3. 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)
  1. port=5060
  2. children=4
fifo="/tmp/ser_fifo"

  1. ------------------ module loading ----------------------------------

  1. 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"

  1. Uncomment this if you want digest authentication
  2. mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"

  1. ----------------- setting module-specific parameters ---------------

  1. — usrloc params --

#modparam("usrloc", "db_mode", 0)

  1. Uncomment this if you want to use SQL database
  2. for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

  1. — auth params --
  2. Uncomment if you are using auth module
modparam("auth_db", "calculate_ha1", yes)
  1. If you set "calculate_ha1" parameter to yes (which true in this config),
  2. uncomment also the following parameter)
modparam("auth_db", "password_column", "password")

  1. — rr params --
  2. add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

(:exclaim:) See Below.
  1. SQL settings
modparam("usrloc", "db_url","sql://username:password@mysql.example.org/ser")
modparam("auth_db", "db_url","sql://username:password@mysql.example.org/ser")

  1. ------------------------- request routing logic -------------------

  1. main routing logic

route{

  1. initial sanity checks — messages with
  2. 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;
};

  1. we record-route all messages — to make sure that
  2. subsequent messages will go through our proxy; that's
  3. particularly good if upstream and downstream entities
  4. use different transport protocol
record_route();
  1. loose-route processing
if (loose_route()) {
t_relay();
break;
};

  1. if the request is for other domain use UsrLoc
  2. (in case, it does not work, use the following command
  3. with proper names and addresses in it)
if (uri==myself) {

if (method=="REGISTER") {

  1. Uncomment this if you want to use digest authentication
if (!www_authorize("proxy.example.org", "subscriber")) {
www_challenge("proxy.example.org", "0");
break;
};

save("location");
break;
};

lookup("aliases");

  1. native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
break;
};
};
  1. forward to current uri now; use stateful forwarding; that
  2. works reliably even if we forward from TCP to UDP
if (!t_relay()) {
sl_reply_error();
};

}



ser version 0.9.3 reqired

modparam("usrloc", "db_url","mysql://username:password@mysql.example.org/ser")
modparam("auth_db", "db_url","mysql://username:password@mysql.example.org/ser")

SIP Express Router

example: SER working with MySQL


  1. $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
  2. simple quick-start config script

  1. ----------- global configuration parameters ------------------------

  1. debug=3 # debug level (cmd line: -dddddddddd)
  2. fork=yes
  3. 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)
  1. port=5060
  2. children=4
fifo="/tmp/ser_fifo"

  1. ------------------ module loading ----------------------------------

  1. 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"

  1. Uncomment this if you want digest authentication
  2. mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"

  1. ----------------- setting module-specific parameters ---------------

  1. — usrloc params --

#modparam("usrloc", "db_mode", 0)

  1. Uncomment this if you want to use SQL database
  2. for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

  1. — auth params --
  2. Uncomment if you are using auth module
modparam("auth_db", "calculate_ha1", yes)
  1. If you set "calculate_ha1" parameter to yes (which true in this config),
  2. uncomment also the following parameter)
modparam("auth_db", "password_column", "password")

  1. — rr params --
  2. add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

(:exclaim:) See Below.
  1. SQL settings
modparam("usrloc", "db_url","sql://username:password@mysql.example.org/ser")
modparam("auth_db", "db_url","sql://username:password@mysql.example.org/ser")

  1. ------------------------- request routing logic -------------------

  1. main routing logic

route{

  1. initial sanity checks — messages with
  2. 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;
};

  1. we record-route all messages — to make sure that
  2. subsequent messages will go through our proxy; that's
  3. particularly good if upstream and downstream entities
  4. use different transport protocol
record_route();
  1. loose-route processing
if (loose_route()) {
t_relay();
break;
};

  1. if the request is for other domain use UsrLoc
  2. (in case, it does not work, use the following command
  3. with proper names and addresses in it)
if (uri==myself) {

if (method=="REGISTER") {

  1. Uncomment this if you want to use digest authentication
if (!www_authorize("proxy.example.org", "subscriber")) {
www_challenge("proxy.example.org", "0");
break;
};

save("location");
break;
};

lookup("aliases");

  1. native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
break;
};
};
  1. forward to current uri now; use stateful forwarding; that
  2. works reliably even if we forward from TCP to UDP
if (!t_relay()) {
sl_reply_error();
};

}



ser version 0.9.3 reqired

modparam("usrloc", "db_url","mysql://username:password@mysql.example.org/ser")
modparam("auth_db", "db_url","mysql://username:password@mysql.example.org/ser")

Created by: pabelanger, Last modification: Mon 08 of Aug, 2005 (09:58 UTC) by alberti_n
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+