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

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 13 19:22:24 CEST 2009



On 13.08.2009 13:07 Uhr, Koffedor wrote:
> Thanks, for reply, Daniel.
>
> So it wasn't the Kamailio problem, it was misconfiguration of the
> client. I wanted to originate a call through Kamailio to Asterisk, but
> the client was making a call directly to Asterisk, because I didn't
> set outbound proxy parameter in client config. I'm sorry for my
> remissness.
>   
ok, good that the issue was somewhere else, that piece of code is pretty 
old and much in use to have such basic erroneous behavior.

Cheers,
Daniel
>
> 2009/8/11 Daniel-Constantin Mierla <miconda at gmail.com>:
>   
>> Hello,
>>
>> On 11.08.2009 16:22 Uhr, Koffedor wrote:
>>     
>>> 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.
>>>
>>>       
>> what version are your running? Can you do an acc_db_request() or
>> acc_log_request() directly in the script and see the results? for the syntax
>> of those commands check the readme of acc module.
>>
>> Note that for syslog, the debug level should be higher than acc log level.
>>
>> Cheers,
>> Daniel
>>
>>     
>>> 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.
>>>
>>> _______________________________________________
>>> Kamailio (OpenSER) - Users mailing list
>>> Users at lists.kamailio.org
>>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>       
>> --
>> Daniel-Constantin Mierla
>> * SIP Router Bootcamp
>> * Kamailio (OpenSER) and Asterisk Training
>> * Berlin, Germany, Sep 1-4, 2009
>> * http://www.asipto.com/index.php/sip-router-bootcamp/
>>
>>
>>     




More information about the Users mailing list