[Serusers] accounting problems: no stop record

Geert Nijpels nijpels at euronet.nl
Fri Nov 21 13:34:23 CET 2003


Hello all,

I'm trying to get accounting working, but I don't seem to get any stop 
records in the database. However, when I tell ser to log to syslog, I do 
get the STOP records. The only thing I come by when searching the 
archives is to be sure that the loose_route() is after the setflag.

I log incoming invite's and bye's to stderror, and I see them coming by:

****
 0(14598) looking up aliases
 0(14598)
****
 time [Fri Nov 21 13:22:50 2003] method <INVITE> Setting acc flags ****
 0(14598) Setting accounting flag
 0(14598) Setting missed calls flag 0(14598)
****
 time [Fri Nov 21 13:22:50 2003] method <INVITE> r-uri 
<8910 at ams-ix.net;user=phone>
 IP: <193.194.136.248> - t-uri <sip:8910 at ams-ix.net;user=phone>
****
 0(14598) looking up aliases
 0(14598)
****
 time [Fri Nov 21 13:22:55 2003] method <ACK> r-uri 
<8910 at 193.194.136.225:5060>
 IP: <193.194.136.248> - t-uri <sip:8910 at ams-ix.net;user=phone>
****
 0(14598) looking up aliases
 0(14598)
****
 time [Fri Nov 21 13:23:02 2003] method <BYE> Setting acc flags ****
 0(14598) Setting accounting flag
 0(14598) Setting missed calls flag 0(14598)
****
 time [Fri Nov 21 13:23:02 2003] method <BYE> r-uri 
<8910 at 193.194.136.225:5060>
 IP: <193.194.136.248> - t-uri <sip:8910 at ams-ix.net;user=phone>
****

Also, the INVITE is inserted into the database, but the BYE not. When I 
change "db_flag" to "log_flag" and change log_stderror=yes to 
log_stderror=no, I do see the BYE ACC antries in the syslog. I do not 
see errors int he mysql log file. No obvious errors when viewing debug=7.

Running:
ser 0.8.11
Mysql 4.x

I hope for a few suggestions:-) My config is pasted in below.

Kind regards,

Geert

----------
Config:

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

#debug=3         # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no        # (cmd line: -E)

debug=3
fork=no
log_stderror=yes

check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5060
#children=4
fifo="/tmp/ser_fifo"
listen="colo.jink.net"
alias="ams-ix.net"

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

loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/xlog.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/lib/ser/modules/acc.so"
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"

# ----------------- setting module-specific parameters ---------------
### Set up parameters for database lookups
modparam("usrloc|auth_db|group|acc", "db_url", 
"sql://xxxx:xxxx@localhost/ser")

### mode 1: direct writing to database
### mode 2: buffered writing to database
modparam("usrloc", "db_mode", 1)

# -- auth_db params --
### Enable encrypted database authentication
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")

# -- acc params --
### For acc Database support, uncomment: DEFS+=-DSQL_ACC in
### sip_router/modules/acc/Makefile and recompile

### Set up missed call logging
modparam("acc", "db_missed_flag", 3)
modparam("acc", "db_flag", 1 )
modparam("acc", "log_level", 1)

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


# -------------------------  request routing logic -------------------

route{

  if (method=="INVITE" || method=="BYE"){
    ## Accounting for all calls
    xlog("L_INFO", "\n****\n time [%Tf] method <%rm> Setting acc flags 
****\n");
          log(1, "Setting accounting flag\n");
    setflag(1);

    ## Accounting for "missed calls"
    log(1, "Setting missed calls flag");
    setflag(3);
  };

  ## Log the request:
  xlog("L_INFO", "\n****\n time [%Tf] method <%rm> r-uri <%ru>\n IP: 
<%is> - t-uri <%tu>\n\n****\n");

  # 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 (len_gt( max_len )) {
                sl_send_reply("513", "Message too big");
                break;
        };

  # Load aliases in memory
        log(1, "looking up aliases\n");
        lookup("aliases");


   # loose-route processing
        #if (loose_route()) {
        #   t_relay();
        #   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") {
                        if (!www_authorize("ams-ix.net", "subscriber")) {
                          www_challenge("ams-ix.net", "0");
                                break;
                        };
                        save("location");
                        break;
    };

    # native SIP destinations are handled using our USRLOC DB
    if (!lookup("location")) {
         if ((method=="INVITE" || method=="ACK") && t_newtran()) {
           t_reply("404", "Not Found");
           #log(1, "Log missed call");
           break;
         };
         sl_send_reply("404", "Not Found");
         break;
      }else{
         if (!t_relay()) {
                    sl_reply_error();
         };
    };
  };
}




More information about the sr-users mailing list