Module: kamailio
Branch: master
Commit: d46f3f642f491968e06faea4eb1aab30ff7582fd
URL:
https://github.com/kamailio/kamailio/commit/d46f3f642f491968e06faea4eb1aab3…
Author: lucian balanceanu <lucian.balanceanu(a)1and1.ro>
Committer: lucian balanceanu <lucian.balanceanu(a)1and1.ro>
Date: 2015-05-25T10:49:36+03:00
acc, dialog: change cdr dialog duration
- CDR duration for timed out acknowledged dialogs is no longer left empty
---
Modified: modules/acc/acc_cdr.c
Modified: modules/dialog/dlg_cb.h
Modified: modules/dialog/dlg_handlers.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d46f3f642f491968e06faea4eb1aab3…
Patch:
https://github.com/kamailio/kamailio/commit/d46f3f642f491968e06faea4eb1aab3…
---
diff --git a/modules/acc/acc_cdr.c b/modules/acc/acc_cdr.c
index a7dc54c..d5b16e3 100644
--- a/modules/acc/acc_cdr.c
+++ b/modules/acc/acc_cdr.c
@@ -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))
{
diff --git a/modules/dialog/dlg_cb.h b/modules/dialog/dlg_cb.h
index fa27e16..349e24b 100644
--- a/modules/dialog/dlg_cb.h
+++ b/modules/dialog/dlg_cb.h
@@ -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)
diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index ae101e0..aae6efb 100644
--- a/modules/dialog/dlg_handlers.c
+++ b/modules/dialog/dlg_handlers.c
@@ -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) -
@@ -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) {
@@ -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);