[Kamailio-Users] acc doesn't write to database and to a log file

Koffedor dangerkoffe at gmail.com
Tue Aug 11 16:22:06 CEST 2009


Hello to all
I enabled the acc module but it isn't writing to "acc" or
"missed_calls" table in mysql, and to a log file too.

my config:

(...)
loadmodule "db_mysql.so"
loadmodule "tm.so"
loadmodule "rr.so"

(...)
# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure the enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc",
"log_extra","src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
/* uncomment the following lines to enable DB accounting also */
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)
modparam("acc", "db_url", "mysql://xxx:xxxx@localhost/kamailio")
modparam("acc", "db_extra",
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")

Flags 1 and 2 set just like in a sample configuration file.

(...)
                if (loose_route()) {
                        if (is_method("BYE")) {
                                setflag(1); # do accounting ...
                                setflag(3); # ... even if the transaction fails
                        }
                        route(1);

(...)
      # account only INVITEs
        if (is_method("INVITE")) {
                setflag(1); # do accounting
        }

Mysql tables are created:

| acc   | CREATE TABLE `acc` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `method` varchar(16) NOT NULL default '',
  `from_tag` varchar(64) NOT NULL default '',
  `to_tag` varchar(64) NOT NULL default '',
  `callid` varchar(128) NOT NULL default '',
  `sip_code` char(3) NOT NULL default '',
  `sip_reason` varchar(32) NOT NULL default '',
  `time` datetime NOT NULL default '0000-00-00 00:00:00',
  `src_ip` varchar(64) NOT NULL default '',
  `dst_user` varchar(64) NOT NULL default '',
  `dst_domain` varchar(128) NOT NULL default '',
  `src_user` varchar(64) NOT NULL default '',
  `src_domain` varchar(128) NOT NULL default '',
  `cdr_id` int(11) NOT NULL default '0',
  `dst_ouser` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `acc_callid` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |


| missed_calls | CREATE TABLE `missed_calls` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `method` varchar(16) NOT NULL default '',
  `from_tag` varchar(64) NOT NULL default '',
  `to_tag` varchar(64) NOT NULL default '',
  `callid` varchar(128) NOT NULL default '',
  `sip_code` char(3) NOT NULL default '',
  `sip_reason` varchar(32) NOT NULL default '',
  `time` datetime NOT NULL default '0000-00-00 00:00:00',
  `src_ip` varchar(64) NOT NULL default '',
  `dst_user` varchar(64) NOT NULL default '',
  `dst_domain` varchar(128) NOT NULL default '',
  `src_user` varchar(64) NOT NULL default '',
  `src_domain` varchar(128) NOT NULL default '',
  `cdr_id` int(11) NOT NULL default '0',
  `dst_ouser` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `mc_callid` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

There are no errors in log, and nothing about acc module in debug mode.
Cant get where is my mistake.



More information about the Users mailing list