SourceForge has been redesigned. Learn more.

#595 ACC not logging BYE on random calls

modules (454)


I built a billing system using Opensips. The logic was to log on a mysql table "acc" all INVITEs and BYEs to be removed later. Then within a few seconds, a console would search for BYEs and related INVITES, calculate duration and price, write on the final table and erase those 2 records from this table.
After some time running, I checked that randomly calls, ACC wrote to DB just the INVITEs and not the BYEs. Checked on syslog and happened the same. I got this:

sbin/opensips[2024]: ACC: transaction answered: timestamp=1353582441;method=INVITE;from_tag=as6c53d5bd;to_tag=1c431879610;call_id=c1434b259b666c921e0c67752f09c01@;code=200;reason=OK

But not the "BYE" message.

This seems to be a bug on ACC module because it doesn’t write the data to Mysql neither to syslog, and also doesn't generate any error on syslog.

To make sure that my problem was on the module and not in my logic, I removed almost all functionality of my Opensips and let just the call routing and ACC module... It reduced the problem but still happens on some situations, from 0.5% to 5% of all calls, randomly.

To temporary solve my problem, i forced INSERT on DB using avp_db_query on loose_route function. On 95% calls it generate a duplicated BYE on my table but my algorithm discard these additional BYEs, so it’s fine for now.

I believe this is an urgent issue since it affects the billing system of almost everyone using opensips.

How can I debug this issue?



  • Vladut-Stefan Paiu

    • assigned_to: nobody --> vladut-paiu
  • Vladut-Stefan Paiu


    So you cannot replicate this scenario ?
    Are you sure that the BYEs that are not accounted for are ok from SIP and Dialog point of view ? Perhaps they have no route headers, and thus they do not enter the scripting logic where you set the accounting flag for the BYE as well.

    Could you try to setup more logging in your script, putting some xlog messages for BYEs , and then search for the missing BYEs in the log file, to make sure they are hitting your part of the script ?


  • Daniel Zanutti

    Daniel Zanutti - 2012-11-30

    Hi Vlad
    Sorry, didn't see your comment earlier.

    For testing purpose, i set the db_flag on the first line of the script and ACC also didn't write it to the DB... I was thinking if the dialogic wasn't created but, not sure.

    I'll set log on everything and try get the full log.

    In the mean time, please check my first post about this issue:


  • Daniel Zanutti

    Daniel Zanutti - 2012-11-30

    ** I was thinking if the dialog wasn't created but, not sure. The INVITE was accounted.

  • M. Dobrovolskyy

    M. Dobrovolskyy - 2013-01-15


    I can show a lot of call logs where BYE wasn't processed by OpenSIPS and we got duration in acc table = default_timeout + time_before_last_acl

    I can provide you logs/info from MySQL acc table, just let me know if required.


Log in to post a comment.