#547 Duration populated with created time on call timeout

1.8.x
closed-fixed
modules (454)
5
2012-08-14
2012-08-04
No

When doing CDR accounting to a Mysql database, when a call is terminated due to a failed dialog options ping (receives response of 481) the database duration field is populated with the unix timestamp of the dialog created time. The 'created' and 'setuptime' fields do not appear to get populated as well.

This does not appear to happen when CDR accounting to syslog, as the same records accounted to syslog have the correct duration, created, and setuptime.

Opensips information:
version: opensips 1.8.0-notls (x86_64/linux)
flags: STATS: Off, USE_IPV6, USE_TCP, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
svnrevision: 2:9164M
@(#) $Id: main.c 8772 2012-03-08 11:16:13Z bogdan_iancu $
main.c compiled on 12:53:09 Aug 3 2012 with gcc 4.4.6

I do have extra, and extra_bye variables which are the same for the database and syslog.

Thanks.

Discussion

  • Vladut-Stefan Paiu

    Hello,

    I have just committed a fix for this in the SVN trunk and 1.8 branch.
    Can you please update your svn and see if it's ok now ?

    Regards,
    Vlad

     
  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> vladut-paiu
    • status: open --> open-fixed
     
  • Ryan Bullock

    Ryan Bullock - 2012-08-13

    Hello Vlad,

    Tried svn revision 9198 for the 1.8 trunk and started getting this message in my logs:

    ERROR:acc:acc_get_created: error getting dialog creation time
    ERROR:acc:acc_log_cdrs: cannot get created
    ERROR:acc:acc_dlg_callback: Cannot log values

    We account to both logs and db, and this revision seems to cause a problem with getting the creation time. Wasn't sure what was causing this, so I reverted back to revision 9164.

    Another issue related to this on revision 9164 is a segfault. Not sure if this addressed with the potential fix you implemented. Got this when I tried to add accounting $si in extra_bye for database accounting. Looks like a bad pointer can get passed to mysql_real_escape_string when a timeout occurs and there is no actual request to pull values from. I have included the backtrace for this as well.

     
  • Ryan Bullock

    Ryan Bullock - 2012-08-13

    Segfault for string escape on accounting internally terminated call

     
  • Vladut-Stefan Paiu

    • status: open-fixed --> open-accepted
     
  • Vladut-Stefan Paiu

    Hello,

    In 9164, segfaults were possible since indeed some invalid pointers might have been passed to the mysql query.

    I tried to test your issue in 9198 and I can't seem to replicate it. The issue you are describing seems to be related to the dialog module, since it does not find the creation time in the dialog variables. So it doesn't seem at all related to the previous fix.

    Can you please attach a full OpenSIPS debug for such a call, as well as the acc & dialog parameters you are using in your script ?

    Regards,
    Vlad

     
  • Ryan Bullock

    Ryan Bullock - 2012-08-13

    Looking through my logs a big closer for the period I also found:

    ERROR:dialog:dlg_validate_dialog: Script error - validate function before having a dialog
    ERROR:dialog:fix_route_dialog: Script error - validate function before having a dialog

    Which is odd, because my calls to validate_dialog() and fix_route_dialog() are wrapped as follows:

    route[dialog_fixup] {
    if ($DLG_status==NULL && !match_dialog()) {
    return(-1);
    } else {
    if (!validate_dialog()) {
    fix_route_dialog();
    }
    }

    return(1);
    }

    Which means it should be impossible to call them even if the dialog does not exists somehow.

    So yeah, looks like I stumbled upon something else on accident their as well. Should I open a separate bug for this? Right now I am not sure what is causing it, only that it does not appear to happen under 9164.

    I will try making a separate patch for the accounting changes and applying that to my current copy of opensips build and seeing how that goes.

     
  • Bogdan-Andrei Iancu

    Ryan,

    Please open a separate report for the new issue. Also test and confirm the fix for original report (with acc data).

    Best regards,

     
  • Ryan Bullock

    Ryan Bullock - 2012-08-14

    Isolated just the fixes for this bug and tested them. Works great, all the fields are correctly populated in the database.

    No signs of the getting created issue, so that appears to be separate. I will see if I can reproduce that in a simpler configuration.

    The fix for the initial bug in this report looks good to me, this can be closed.

     
  • Bogdan-Andrei Iancu

    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks