<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15009">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Sean Bright: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_musiconhold: Load all realtime entries, not just the first<br><br>ASTERISK-29099<br><br>Change-Id: I45636679c0fb5a5f59114c8741626631a604e8a6<br>---<br>M res/res_musiconhold.c<br>1 file changed, 9 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c</span><br><span>index 8d1ab2a..db7dde7 100644</span><br><span>--- a/res/res_musiconhold.c</span><br><span>+++ b/res/res_musiconhold.c</span><br><span>@@ -1609,19 +1609,22 @@</span><br><span> if (var) {</span><br><span> const char *mode = ast_variable_find_in_list(var, "mode");</span><br><span> if (ast_strings_equal(mode, "playlist")) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_variable *entries = ast_load_realtime("musiconhold_entry", "name", name, SENTINEL);</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_variable *cur = entries;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_config *entries = ast_load_realtime_multientry("musiconhold_entry", "position >=", "0", "name", name, SENTINEL);</span><br><span style="color: hsl(120, 100%, 40%);">+ char *category = NULL;</span><br><span> size_t entry_count = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- for (; cur; cur = cur->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcmp(cur->name, "entry")) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_variable *dup = ast_variable_new(cur->name, cur->value, "");</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while ((category = ast_category_browse(entries, category))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *entry = ast_variable_retrieve(entries, category, "entry");</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (entry) {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_variable *dup = ast_variable_new("entry", entry, "");</span><br><span> if (dup) {</span><br><span> entry_count++;</span><br><span> ast_variable_list_append(&var, dup);</span><br><span> }</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_variables_destroy(entries);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_config_destroy(entries);</span><br><span> </span><br><span> if (entry_count == 0) {</span><br><span> /* Behave as though this class doesn't exist */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15009">change 15009</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/+/15009"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I45636679c0fb5a5f59114c8741626631a604e8a6 </div>
<div style="display:none"> Gerrit-Change-Number: 15009 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: lvl <digium@lvlconsultancy.nl> </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: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>