[Serusers] SER/PSTN Gateway conf

flavio flavio.patria at gmail.com
Thu May 10 13:50:28 CEST 2007


Hi to all,
I've updated my ser.cfg file as follow.
Essentially I've updated "Call Type Processing" Section, with
introduction of BYE SIP message handlling, and route[2] section.
So SER now reply to BYE message from PSTN Gateway (in my scenario
Phone --> PSTN --> Gateway --> SER --> SIP Phone) just with 200 OK,
but does not forward BYE to SIP Phone.

I hope this may be helpfully!

Thanks,

flavio



debug=3
fork=no
log_stderror=yes
listen=10.28.19.202 # INSERT YOUR IP ADDRESS HERE
port=5060
children=4
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://root@10.28.19.202/ser"
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/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
loadmodule "/usr/local/lib/ser/modules/permissions.so"
modparam("auth_db|permissions|uri_db|usrloc", "db_url",
"mysql://root@10.28.19.202/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("usrloc", "db_mode", 2)
modparam("rr", "enable_full_lr", 1)
modparam("tm", "fr_inv_timer", 27)
modparam("tm", "fr_inv_timer_avp", "inv_timeout")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("permissions", "default_allow_file",
"/usr/local/etc/ser/permissions.allow")
modparam("permissions", "default_deny_file",
"/usr/local/etc/ser/permissions.deny")
route {
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("16")) {
sl_send_reply("483", "Too Many Hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
break;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method!="REGISTER") {
record_route();
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {

      if (method=="INVITE") {

        if (!allow_trusted()) {

          if (!proxy_authorize("","subscriber")) {
            proxy_challenge("","0");
            break;
          } else if (!check_from()) {
            sl_send_reply("403", "Use From=ID");
            break;
          };

          consume_credentials();
        };
      };	
route(1);
break;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (uri!=myself) {
route(1);
break;
};
if (method=="ACK") {
route(3);
route(1);
break;
}
if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER" || method=="BYE") {
route(2);
break;
};
lookup("aliases");
if (uri!=myself) {
route(1);
break;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
break;
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
if (!t_relay()) {
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# ----------------------------------------------------------------
sl_send_reply("100", "Trying");
if (!allow_trusted()){
if (!www_authorize("","subscriber")) {
www_challenge("","0");
break;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
break;
}
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
break;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
break;
};
consume_credentials();
}
lookup("aliases");
  if (uri!=myself) {
    route(1);
    break;
  };
if (!lookup("location")) {
if (uri=~"^sip:0[0-9]*@") { # Domestic PSTN
#strip(0);
route(4);
break;
};
if(uri=~"^sip:3[0-9]*@") {
route(4);
break;
};
if (allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","1");
break;
};
};
sl_send_reply("404", "User Not Found");
break;
};
route(1);
}
route[4]{
#-----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
rewritehost("10.28.52.105"); # INSERT YOUR PSTN GATEWAY IP ADDRESS
avp_write("i:45", "inv_timeout");
route(1);
}



More information about the sr-users mailing list