mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 11:11:05 +00:00
Merge "main/cdr: Fixed cdr start overwriting" into 16
This commit is contained in:
32
main/cdr.c
32
main/cdr.c
@@ -803,6 +803,23 @@ static void cdr_object_snapshot_copy(struct cdr_object_snapshot *dst, struct cdr
|
|||||||
copy_variables(&dst->variables, &src->variables);
|
copy_variables(&dst->variables, &src->variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Transition a \ref cdr_object to a new state with initiation flag
|
||||||
|
* \param cdr The \ref cdr_object to transition
|
||||||
|
* \param fn_table The \ref cdr_object_fn_table state to go to
|
||||||
|
*/
|
||||||
|
static void cdr_object_transition_state_init(struct cdr_object *cdr, struct cdr_object_fn_table *fn_table, int do_init)
|
||||||
|
{
|
||||||
|
CDR_DEBUG("%p - Transitioning CDR for %s from state %s to %s\n",
|
||||||
|
cdr, cdr->party_a.snapshot->name,
|
||||||
|
cdr->fn_table ? cdr->fn_table->name : "NONE", fn_table->name);
|
||||||
|
cdr->fn_table = fn_table;
|
||||||
|
|
||||||
|
if (cdr->fn_table->init_function && do_init) {
|
||||||
|
cdr->fn_table->init_function(cdr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Transition a \ref cdr_object to a new state
|
* \brief Transition a \ref cdr_object to a new state
|
||||||
* \param cdr The \ref cdr_object to transition
|
* \param cdr The \ref cdr_object to transition
|
||||||
@@ -810,13 +827,7 @@ static void cdr_object_snapshot_copy(struct cdr_object_snapshot *dst, struct cdr
|
|||||||
*/
|
*/
|
||||||
static void cdr_object_transition_state(struct cdr_object *cdr, struct cdr_object_fn_table *fn_table)
|
static void cdr_object_transition_state(struct cdr_object *cdr, struct cdr_object_fn_table *fn_table)
|
||||||
{
|
{
|
||||||
CDR_DEBUG("%p - Transitioning CDR for %s from state %s to %s\n",
|
cdr_object_transition_state_init(cdr, fn_table, 1);
|
||||||
cdr, cdr->party_a.snapshot->name,
|
|
||||||
cdr->fn_table ? cdr->fn_table->name : "NONE", fn_table->name);
|
|
||||||
cdr->fn_table = fn_table;
|
|
||||||
if (cdr->fn_table->init_function) {
|
|
||||||
cdr->fn_table->init_function(cdr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -1952,7 +1963,12 @@ static int dialed_pending_state_process_party_a(struct cdr_object *cdr, struct a
|
|||||||
cdr->fn_table->process_party_a(cdr, snapshot);
|
cdr->fn_table->process_party_a(cdr, snapshot);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
cdr_object_transition_state(cdr, &single_state_fn_table);
|
/* The CDR does not need to be reinitialized when transitioning
|
||||||
|
* to its single state as this would overwrite the start time,
|
||||||
|
* causing potentially both the answer and the start time to be
|
||||||
|
* the same which is incorrect.
|
||||||
|
*/
|
||||||
|
cdr_object_transition_state_init(cdr, &single_state_fn_table, 0);
|
||||||
cdr->fn_table->process_party_a(cdr, snapshot);
|
cdr->fn_table->process_party_a(cdr, snapshot);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user