<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1290/">https://reviewboard.asterisk.org/r/1290/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Russell Bryant and David Vossel.</div>
<div>By jrose.</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Someone made a patch so that 'moh reload' would scan for changes within the directory using moh_scan_files() if musiconhold.conf had not been touched because they wanted to be able to use that cli command in order to refresh the playlist.
Normally however, moh_scan_files() is only used during initial config and reload if the moh class in question is of mode "files". This patch changes this addendum to the code so that it also only runs moh_scan_files if the class in question is in mode "files"
Additional Notes: It seems to me like during normal initialization, if a class is of mode "files" and moh_scan_files returns a failure, the normal action would be to destroy that music on hold class. This may or may not be desirable behavior if we want to be able to repopulate the playlist at any time like this. Currently reload won't destroy the channel unless the config has been touched and the directory linked is empty, but I wonder if this is a proper approach at all.
MOH needs to stream the files from the directory regardless of whether or not we run moh reload or not, so it seems to me like it might be a good idea to make the whole thing more dynamic. I think it might be prudent for MOH classes in files mode to check for additions and removals to the directory every time they prepare to play the next file in the stored playlist. I don't think the performance hit for this sort of thing would be especially significant.
Alternatively, it might be a good idea to simply separate the idea of reload and rescanning. Something like "moh <class> refresh" might be an idea. Honestly, I can think of about a million different things to do with the music on hold class if it were a priority.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Tested behavior using madcap before and after changes. Honestly, this change seemed fairly obvious at the time, so I'm not really all that worried about this.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-17730">ASTERISK-17730</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/1.8/res/res_musiconhold.c <span style="color: grey">(324847)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1290/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>