[OpenSIPS-Users] cdr_flag not working in v1.7
Razvan Crainea
razvan at opensips.org
Fri Mar 23 17:20:53 CET 2012
Hello, Sebastien!
The problem is that you should set the cdr_flag only for the initial
INVITEs. If you also set it for the BYE messages, the acc module will
consider that you want to separately dump the BYE in the database,
regardless the cdr automatic behaviour.
So the proper way to use the cdr accounting is to set the cdr_flag only
for initial INVITEs:
if (is_method("INVITE") && has_totag())
setflag(2);
Regards,
--
Răzvan Crainea
OpenSIPS Developer
http://www.opensips-solutions.com
On 03/23/2012 04:41 PM, Sebastien CRUAUX wrote:
> Hi Razvan,
>
> I dug up this thread because I am facing the same issue as John and I
> am not sure I understood your answer.
> What should be done in order to make the cdr_flag work with opensips
> 1.7 ?
>
> Regards,
>
> Sebastien
>
> Le 20/09/2011 18:23, Razvan Crainea a écrit :
>> Hi John,
>>
>> The problem is here:
>>
>> if (method=="INVITE" || method=="BYE") {
>> # Write CDR records to the database
>> setflag(2);
>> }
>>
>> For any sequential request, the CDR engine ignores the flag (2 in
>> your case). But the standard accounting will still notice it, and
>> therefore will log the
>> BYE into the database. Deleting this lines above should no longer
>> account it.
>> Anyway, I guess that the INVITE has all the fields filled properly
>> (especially duration and setuptime), right?
>>
>> Regards,
>>
>> --
>> Răzvan Crainea
>> OpenSIPS Developer
>>
>>
>> On 20.09.2011 19:07, John Quick wrote:
>>> My favourite module (dialog) got even better when the cdr_flag
>>> option was
>>> added. I use it all the time now.
>>>
>>> But it doesn't seem to be working in version 1.7. I know the call is
>>> creating a dialog because db_mode is set to 1 and the record can be
>>> seen in
>>> the dialog table while the call is active. However, 2 records are
>>> written to
>>> the acc table - one for the INVITE and another for the BYE. So
>>> cdr_flag is
>>> being ignored. Is this a problem in v1.7 or have I done something
>>> wrong?
>>>
>>> Here's the relevant bits from opensips.cfg:
>>> modparam("acc", "db_flag", 2)
>>> modparam("acc", "cdr_flag", 2)
>>> modparam("acc", "db_missed_flag", 3)
>>> modparam("acc", "failed_transaction_flag", 3)
>>> modparam("acc", "report_cancels", 1)
>>> modparam("acc", "detect_direction", 1)
>>> modparam("acc", "db_extra", "authid=$avp(authid); srcip=$si;
>>> called=$rU;
>>> route=$rd; cli=$fU")
>>>
>>> modparam("dialog", "db_mode", 1) # 1 during testing; 0 or 3 for
>>> production
>>> modparam("dialog", "dlg_match_mode", 1)
>>> modparam("dialog", "rr_param", "scdg") # unique rr tag value in
>>> case other
>>> opensips servers in route
>>> modparam("dialog", "default_timeout", 14400) # default timeout set
>>> to 4
>>> hours
>>>
>>> route[3]
>>> if (method=="INVITE" || method=="BYE") {
>>> # Write CDR records to the database
>>> setflag(2);
>>> # ...and missed calls too
>>> setflag(3);
>>> }
>>>
>>> if (method=="INVITE") {
>>> # make OpenSIPS create a dialog record (see dialog module
>>> for info)
>>> create_dialog();
>>> }
>>>
>>> ...and my loose routing section:
>>> if (has_totag()) {
>>> if (loose_route()) {
>>> # Attempt to match this request with an existing dialog
>>> match_dialog();
>>>
>>> # Check authentication of re-invites - don't challenge
>>> if from a
>>> known address
>>> if(method=="INVITE"&&
>>> (!check_address("0","$si","$sp","$proto"))) {
>>> if (!proxy_authorize("","subscriber")) {
>>> proxy_challenge("","1");
>>> exit;
>>> };
>>> };
>>>
>>> if (method=="INVITE" || method=="BYE") {
>>> # Write CDR records to the database
>>> setflag(2);
>>> }
>>>
>>>
>>> John Quick
>>> Smartvox Limited
>>> Web: www.smartvox.co.uk
>>>
>>> Smartvox is a limited company, registered in England and Wales, number
>>> 5005263.
>>> Registered office: Spectrum House, Dunstable Road, Redbourn, St.Albans,
>>> Herts AL3 7PR
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list