Skip to content

Commit

Permalink
acc, dialog: change cdr dialog duration
Browse files Browse the repository at this point in the history
- CDR duration for timed out acknowledged dialogs is no longer left empty
  • Loading branch information
lucian balanceanu committed May 25, 2015
1 parent cc85366 commit d46f3f6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions modules/acc/acc_cdr.c
Expand Up @@ -692,6 +692,23 @@ static void cdr_on_expired( struct dlg_cell* dialog,
}

LM_DBG("dialog '%p' expired!\n", dialog);
/* compute duration for timed out acknowledged dialog */
if ( params && params->dlg_data ) {
if ( (void*)CONFIRMED_DIALOG_STATE == params->dlg_data) {
if( set_end_time( dialog) != 0)
{
LM_ERR( "failed to set end time!\n");
return;
}

if( set_duration( dialog) != 0)
{
LM_ERR( "failed to set duration!\n");
return;
}

}
}

if( cdr_expired_dlg_enable && (write_cdr( dialog, 0) != 0))
{
Expand Down
2 changes: 2 additions & 0 deletions modules/dialog/dlg_cb.h
Expand Up @@ -58,6 +58,8 @@ typedef int (*set_dlg_variable_f)( struct dlg_cell* dlg,
typedef str* (*get_dlg_variable_f)( struct dlg_cell* dlg,
str* key);

#define CONFIRMED_DIALOG_STATE 1

#define DLGCB_LOADED (1<<0)
#define DLGCB_CREATED (1<<1)
#define DLGCB_FAILED (1<<2)
Expand Down
8 changes: 7 additions & 1 deletion modules/dialog/dlg_handlers.c
Expand Up @@ -1371,6 +1371,7 @@ void dlg_ontimeout(struct dlg_tl *tl)
dlg_cell_t *dlg;
int new_state, old_state, unref;
sip_msg_t *fmsg;
void* timeout_cb = 0;

/* get the dialog tl payload */
dlg = ((struct dlg_cell*)((char *)(tl) -
Expand Down Expand Up @@ -1413,6 +1414,11 @@ void dlg_ontimeout(struct dlg_tl *tl)
}

next_state_dlg( dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref);
/* used for computing duration for timed out acknowledged dialog */
if (DLG_STATE_CONFIRMED == old_state) {
timeout_cb = (void *)CONFIRMED_DIALOG_STATE;
}

dlg_run_event_route(dlg, NULL, old_state, new_state);

if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
Expand All @@ -1422,7 +1428,7 @@ void dlg_ontimeout(struct dlg_tl *tl)
dlg->tag[DLG_CALLEE_LEG].len, dlg->tag[DLG_CALLEE_LEG].s);

/* dialog timeout */
run_dlg_callbacks( DLGCB_EXPIRED, dlg, NULL, NULL, DLG_DIR_NONE, 0);
run_dlg_callbacks( DLGCB_EXPIRED, dlg, NULL, NULL, DLG_DIR_NONE, timeout_cb);

dlg_unref(dlg, unref+1);

Expand Down

0 comments on commit d46f3f6

Please sign in to comment.