<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/2220/">https://reviewboard.asterisk.org/r/2220/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/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, Mark Michelson, Matt Jordan, and kmoore.</div>
<div>By jrose.</div>
<p style="color: grey;"><i>Updated Nov. 30, 2012, 1:05 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Change the msg_id generation to something that can work uniquely with copy.
New format is A-B-C
A is a hash of the system name defined in asterisk.conf. Technically this might not be unique even on two systems with a different system name, in which case... crap. How unlucky is that? Still, using the actual system name would mean we'd have to allow for up to 256 characters and the odds are miniscule of actually having a collision on a production system. This will appear currently as an 8 character hex value.
B is the unsigned long form of the epoch in which the msg_id is generated. This is the longest part of the id and could potentially hit as many as 20 characters. At least, I think that's the upper bound on a 64 bit OS. It might be prodent to trim this down a bit somewhow.
C is obtained via an protected value that should only be touched with the ast_atomic_fetchadd_int (to ensure safety when using from different threads). It is also an 8 character hex value.
So that should be 38 characters all together when B is at the upper bound... which shouldn't occur for a considerable amount of time.
All code that previously generated the msg_id inline now call a signle generate_msg_id function. COPY now uses this msg_generate_id function and generates a completely fresh ID when copying.</pre>
</td>
</tr>
</table>
<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;">When a message is moved between folders (such as after listening to new messages, they are switched to the old messages folder), the msg_id field added in Asterisk 11 isn't copied. This patch simply adds that field to what is copied in the odbc COPY function and appears to solve the problem.</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;">Made messages in a mailbox using app_voicemail. Checked mysql to see the msg_id. Verified an ID was created.
Listened to messages, made sure the COPY function was invoked. Checked mysql again and saw that the IDs were gone.
Applied the patch, repeated the process, the IDs remained intact.</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-20717">ASTERISK-20717</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/11/apps/app_voicemail.c <span style="color: grey">(376833)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2220/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>