[Serusers] Ser CDRs

Gregory D. Burns greg.burns at dslextreme.com
Wed Nov 26 17:28:39 CET 2003


Guys,

I’m new with ser, but it seem great so far. The customer I’m working with
want to get reliable CDR’s from his SER SIP Server. He also has pre-paid
customers on it so it need to check to see if they have monies to make the
call, and when the call is done, it need to calculate and deduct the cost of
the call from their balance.

I have been using exec_msg command to try and do this, but I been having a
hard time getting it to work right because I get more then one invite’s and
ack’s. Also sometime they miss-dial and I only get Invite’s.

So I guess my is, are exec_msg’s the right way to go? Is anyone else doing
the same thing, if so could you share you config with me?

-Greg
Voipin.com

#
# $Id: ser.cfg,v 1.21.2.1 2003/07/30 16:46:18 andrei Exp $
#
# simple quick-start config script
#

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

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

/* Uncomment these lines to enter debugging mode
debug=7
fork=yes
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"
mhomed=yes

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

#loadmodule "/usr/local/lib/ser/modules/group.so"

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

# -- usrloc params --
modparam("usrloc","db_mode",2)
modparam("usrloc", "timer_interval", 30)
modparam("usrloc","db_url", "sql://ser:dc74uc@localhost/Tigris")

# -- auth params --
modparam("auth_db", "db_url", "sql://ser:dc74uc@localhost/Tigris")

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

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

# main routing logic

route{


  /* ********* ROUTINE CHECKS  ********************************** */
  # Take take of Max hops
  if (!mf_process_maxfwd_header("10")) {
    sl_send_reply("483","Too Many Hops");
    break;
  };

  # Too big for a SIP msg.
  if (len_gt( max_len )) {
    sl_send_reply("513", "Message too big");
    break;
  };

  # Authorize
  if (method=="REGISTER")
  {
    if (!www_authorize("64.81.40.173", "subscriber")) {
      www_challenge("64.81.40.173", "0");
      log(1, "BAD REGISTER\n");
      break;
    };
    save("location");
    break;
  };

  exec_msg('`/root/bin/logcdr.pl`');

  loose_route();
  if (method=="INVITE")
  {
    record_route();

    if (!exec_msg('`/root/bin/test.pl`'))
    {
       t_reply("404", "Low Funds");
       break;
    };
  };


 if (uri =~"^sip:[0-1]") {

    if (uri =~"^sip:1666") {
      rewritehostport("216.91.9.42:5060");
      if (!t_relay()) { sl_reply_error(); };
      break;
    };

    if (uri =~"^sip:1") {
      rewritehostport("128.121.29.99:5060");
      if (!t_relay()) { sl_reply_error(); };
      break;
    };

    if (uri =~"^sip:011") {
      rewritehostport("128.121.29.99:5060");
      if (!t_relay()) { sl_reply_error(); };
      break;
    };

    if (uri =~"^sip:00") {
      strip(2);
      prefix("011");
      rewritehostport("128.121.29.99:5060");
      if (!t_relay()) { sl_reply_error(); };
      break;
    };

  } else {
    if (!lookup("location")) {
      sl_send_reply("404", "User Not Found");
      log("SER: Dest User Not in location table.\n");
      break;
    };
    if (!t_relay()) { sl_reply_error(); };
    break;
  };
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20031126/6037722a/attachment.htm>


More information about the sr-users mailing list