[Serusers] ser+pstn call restrict

Szabolcs Szasz sszasz at digicomm.ro
Wed Jun 8 15:17:17 CEST 2005


Hi!

 I am new in ser configuration. My configuration: I use Audiocodes Mediant
2000 for PSTN gateway, ser-0.8.14 installed on my redhat 9.0 box,
audiocodes and welltech FXS's as user agents. Now, I can call succesfully
sip-->sip, sip-->PSTN and PSTN-->sip. My problem is that I need to
restrict some calls for some users, international, national and local
(sip-->sip calls).  Can anyone help me? Here is my ser.cfg file.
 Thanks!



 #
# ----------- global configuration parameters ------------------------

debug=4
fork=no
log_stderror=yes
check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
fifo="/tmp/ser_fifo"
listen=10.1.10.10

# ------------------ module loading ----------------------------------

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/acc.so"
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/group.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"

# ----------------- setting module-specific parameters ---------------


# -- usrloc params --
#modparam("usrloc", "db_mode",   0)# add value to ;lr param to make some
broken UAs happy

# -- rr params --
modparam("rr", "enable_full_lr", 1)

# ------------- accounting parameters

modparam("acc", "log_missed_flag", 3)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)

# ------------- usrloc parameters

# 2 enables write-back to persistent mysql storage for speed
# disable=0, write-through=1
modparam("usrloc", "db_mode", 2)

# minimize write back window - default is 60 seconds
modparam("usrloc", "timer_interval", 10)

# database location
modparam("usrloc", "db_url", "sql://ser:heslo@localhost/ser")

# ------------- auth parameters

# database location
modparam("auth_db", "db_url", "sql://ser:heslo@localhost/ser")

# allows clear text passwords in the mysql database
modparam("auth_db", "calculate_ha1", yes)

# name of password column in mysql database
modparam("auth_db", "password_column", "password")
# -------------------------  request routing logic -------------------

# main routing logic

route{

            # initial sanity checks -- messages with
            # 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;
            };

            # we record-route all messages -- to make sure that
            # subsequent messages will go through our proxy; that's
            # particularly good if upstream and downstream entities
            # use different transport protocol
            record_route();
            # loose-route processing
            if (loose_route()) {
                        t_relay();
                        break;
            };
    # forward all calls to audiocodes with 0 as the digit header
    if ( (uri=~"sip:0[0-9]*@*") | (uri=~"sip:1111@*") ){
rewritehostport("10.1.10.1:5060");
forward(10.1.10.1, 5060);
break;
    };
          # if the request is for other domain use UsrLoc
            # (in case, it does not work, use the following command
            # with proper names and addresses in it)
            if (uri==myself) {
                        if (method=="REGISTER") {

# Uncomment this if you want to use digest authentication
                                  if (!www_authorize("10.1.10.10",
"subscriber")) {
                                              www_challenge("10.1.10.10",
"0");
                                              break;
                                  };

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




_____________________________
Szabolcs Szasz
Digi Communication SRL
H2/3 Petofi Sandor St.
Sovata,
Mures, Romania
sszasz at digicomm.ro
www.digicomm.ro
_____________________________





More information about the sr-users mailing list