<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18478">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Joshua Colp: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_dahdi: Don't append cadences on dahdi restart.<br><br>Currently, if any custom ring cadences are specified, they are<br>appended to the array of cadences from wherever we left off<br>last time. This works properly the first time, but on subsequent<br>dahdi restarts, it means that the existing cadences are left<br>alone and (most likely) the same cadences are then re-added<br>afterwards. In short order, the cadence array gets maxed out<br>and the user begins seeing warnings that the array is full<br>and no more cadences may be added.<br><br>This buggy behavior persists until Asterisk is completely<br>restarted; however, if and when dahdi restart is run again,<br>then the same problem is reintroduced.<br><br>This fixes this behavior so that cadence parsing is more<br>idempotent, that is so running dahdi restart multiple times<br>starts adding cadences from the beginning, rather than from<br>wherever the last cadence was added.<br><br>As before, it is still not possible to revert to the default<br>cadences by simply removing all cadences in this manner, nor<br>is it possible to delete existing cadences. However, this<br>does make it possible to update existing cadences, which<br>was not possible before, and also ensures that the cadences<br>remain unchanged if the config remains unchanged.<br><br>ASTERISK-29990 #close<br><br>Change-Id: Ie32ea3e8a243b766756b1afce684d4a31ee7421d<br>---<br>M channels/chan_dahdi.c<br>M configs/samples/chan_dahdi.conf.sample<br>A doc/CHANGES-staging/chan_dahdi_cadences.txt<br>3 files changed, 14 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c</span><br><span>index c834112..6fb0eb2 100644</span><br><span>--- a/channels/chan_dahdi.c</span><br><span>+++ b/channels/chan_dahdi.c</span><br><span>@@ -17880,6 +17880,9 @@</span><br><span> int y;</span><br><span> struct ast_variable *dahdichan = NULL;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Re-parse any cadences from beginning, rather than appending until we run out of room */</span><br><span style="color: hsl(120, 100%, 40%);">+ user_has_defined_cadences = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> for (; v; v = v->next) {</span><br><span> if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))</span><br><span> continue;</span><br><span>diff --git a/configs/samples/chan_dahdi.conf.sample b/configs/samples/chan_dahdi.conf.sample</span><br><span>index 5c3af43..6333351 100644</span><br><span>--- a/configs/samples/chan_dahdi.conf.sample</span><br><span>+++ b/configs/samples/chan_dahdi.conf.sample</span><br><span>@@ -1286,10 +1286,11 @@</span><br><span> ; You can define your own custom ring cadences here. You can define up to 8</span><br><span> ; pairs. If the silence is negative, it indicates where the caller ID spill is</span><br><span> ; to be placed. Also, if you define any custom cadences, the default cadences</span><br><span style="color: hsl(0, 100%, 40%);">-; will be turned off.</span><br><span style="color: hsl(120, 100%, 40%);">+; will be turned off (overwritten).</span><br><span> ;</span><br><span> ; This setting is global, rather than per-channel. It will not update on</span><br><span style="color: hsl(0, 100%, 40%);">-; a reload.</span><br><span style="color: hsl(120, 100%, 40%);">+; a reload, but new and modified cadences will update on dahdi restart.</span><br><span style="color: hsl(120, 100%, 40%);">+; A maximum of 24 cadences may be specified.</span><br><span> ;</span><br><span> ; Syntax is: cadence=ring,silence[,ring,silence[...]]</span><br><span> ;</span><br><span>diff --git a/doc/CHANGES-staging/chan_dahdi_cadences.txt b/doc/CHANGES-staging/chan_dahdi_cadences.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..b888926</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/chan_dahdi_cadences.txt</span><br><span>@@ -0,0 +1,8 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: chan_dahdi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Previously, cadences were appended on dahdi restart,</span><br><span style="color: hsl(120, 100%, 40%);">+rather than reloaded. This prevented cadences from</span><br><span style="color: hsl(120, 100%, 40%);">+being updated and maxed out the available cadences</span><br><span style="color: hsl(120, 100%, 40%);">+if reloaded multiple times. This behavior is fixed</span><br><span style="color: hsl(120, 100%, 40%);">+so that reloading cadences is idempotent and cadences</span><br><span style="color: hsl(120, 100%, 40%);">+can actually be reloaded.</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18478">change 18478</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/c/asterisk/+/18478"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ie32ea3e8a243b766756b1afce684d4a31ee7421d </div>
<div style="display:none"> Gerrit-Change-Number: 18478 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>