<p>sungtae kim has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10964">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/cdr: Fixed cdr start overwriting<br><br>The CDR was overwriting the start time when the call continued the<br>dialplan from the ARI stasis or a Local channel was originated.<br><br>This change fixes this by no longer reinitializing the CDR when<br>transitioning out of the dialed pending state to the single state.<br><br>ASTERISK-28181<br><br>Change-Id: I921bc04064b6cff1deb2eea56a94d86489561cdc<br>---<br>M main/cdr.c<br>1 file changed, 24 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/64/10964/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/cdr.c b/main/cdr.c</span><br><span>index c048761..ba0f337 100644</span><br><span>--- a/main/cdr.c</span><br><span>+++ b/main/cdr.c</span><br><span>@@ -803,19 +803,30 @@</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Transition a \ref cdr_object to a new state with initiation flag</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param cdr The \ref cdr_object to transition</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param fn_table The \ref cdr_object_fn_table state to go to</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void cdr_object_transition_state_init(struct cdr_object *cdr, struct cdr_object_fn_table *fn_table, int do_init)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ CDR_DEBUG("%p - Transitioning CDR for %s from state %s to %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ cdr, cdr->party_a.snapshot->name,</span><br><span style="color: hsl(120, 100%, 40%);">+ cdr->fn_table ? cdr->fn_table->name : "NONE", fn_table->name);</span><br><span style="color: hsl(120, 100%, 40%);">+ cdr->fn_table = fn_table;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (cdr->fn_table->init_function && do_init) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cdr->fn_table->init_function(cdr);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \brief Transition a \ref cdr_object to a new state</span><br><span> * \param cdr The \ref cdr_object to transition</span><br><span> * \param fn_table The \ref cdr_object_fn_table state to go to</span><br><span> */</span><br><span> static void cdr_object_transition_state(struct cdr_object *cdr, struct cdr_object_fn_table *fn_table)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- CDR_DEBUG("%p - Transitioning CDR for %s from state %s to %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">- cdr, cdr->party_a.snapshot->name,</span><br><span style="color: hsl(0, 100%, 40%);">- cdr->fn_table ? cdr->fn_table->name : "NONE", fn_table->name);</span><br><span style="color: hsl(0, 100%, 40%);">- cdr->fn_table = fn_table;</span><br><span style="color: hsl(0, 100%, 40%);">- if (cdr->fn_table->init_function) {</span><br><span style="color: hsl(0, 100%, 40%);">- cdr->fn_table->init_function(cdr);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ cdr_object_transition_state_init(cdr, fn_table, 1);</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -1955,7 +1966,12 @@</span><br><span> cdr->fn_table->process_party_a(cdr, snapshot);</span><br><span> return 1;</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- cdr_object_transition_state(cdr, &single_state_fn_table);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* The CDR does not need to be reinitialized when transitioning</span><br><span style="color: hsl(120, 100%, 40%);">+ * to its single state as this would overwrite the start time,</span><br><span style="color: hsl(120, 100%, 40%);">+ * causing potentially both the answer and the start time to be</span><br><span style="color: hsl(120, 100%, 40%);">+ * the same which is incorrect.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ cdr_object_transition_state_init(cdr, &single_state_fn_table, 0);</span><br><span> cdr->fn_table->process_party_a(cdr, snapshot);</span><br><span> return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10964">change 10964</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10964"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I921bc04064b6cff1deb2eea56a94d86489561cdc </div>
<div style="display:none"> Gerrit-Change-Number: 10964 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: sungtae kim <pchero21@gmail.com> </div>