<p>Kevin Harwell <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14794">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Kevin Harwell: Looks good to me, approved; Approved for Submit
  George Joseph: Looks good to me, but someone else must approve

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: Process urgent messages with mailcmd<br><br>Rather than putting messages into INBOX and then moving them to Urgent<br>later, put them directly in to the Urgent folder. This prevents<br>mailcmd from being skipped.<br><br>ASTERISK-27273 #close<br><br>Change-Id: I49934e093290d308506ab8d45a40ef705c5ae4f5<br>---<br>M apps/app_voicemail.c<br>1 file changed, 9 insertions(+), 21 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index 73813df..cc96a1c 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -6576,8 +6576,6 @@</span><br><span> {</span><br><span> #ifdef IMAP_STORAGE</span><br><span>        int newmsgs, oldmsgs;</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-      char urgdir[PATH_MAX];</span><br><span> #endif</span><br><span>     char txtfile[PATH_MAX];</span><br><span>      char tmptxtfile[PATH_MAX];</span><br><span>@@ -6996,6 +6994,14 @@</span><br><span>          }</span><br><span>            res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, &sound_duration, NULL, options->record_gain, vms, flag, msg_id, 0);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+          /* At this point, either we were instructed to make the message Urgent</span><br><span style="color: hsl(120, 100%, 40%);">+                   by arguments to VoiceMail or during the review process by the person</span><br><span style="color: hsl(120, 100%, 40%);">+                  leaving the message. So we update the directory where we want this</span><br><span style="color: hsl(120, 100%, 40%);">+            message to go. */</span><br><span style="color: hsl(120, 100%, 40%);">+          if (!strcmp(flag, "Urgent")) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      create_dirpath(dir, sizeof(dir), vmu->context, ext, "Urgent");</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          if (txt) {</span><br><span>                   fprintf(txt, "flag=%s\n", flag);</span><br><span>                   if (sound_duration < vmu->minsecs) {</span><br><span>@@ -7076,25 +7082,7 @@</span><br><span>                                                  free_user(recip);</span><br><span>                                            }</span><br><span>                                    }</span><br><span style="color: hsl(0, 100%, 40%);">-#ifndef IMAP_STORAGE</span><br><span style="color: hsl(0, 100%, 40%);">-                                   if (!ast_strlen_zero(flag) && !strcmp(flag, "Urgent")) { /* If this is an Urgent message */</span><br><span style="color: hsl(0, 100%, 40%);">-                                           /* Move the message from INBOX to Urgent folder if this is urgent! */</span><br><span style="color: hsl(0, 100%, 40%);">-                                           char sfn[PATH_MAX];</span><br><span style="color: hsl(0, 100%, 40%);">-                                             char dfn[PATH_MAX];</span><br><span style="color: hsl(0, 100%, 40%);">-                                             int x;</span><br><span style="color: hsl(0, 100%, 40%);">-                                          /* It's easier just to try to make it than to check for its existence */</span><br><span style="color: hsl(0, 100%, 40%);">-                                            create_dirpath(urgdir, sizeof(urgdir), vmu->context, ext, "Urgent");</span><br><span style="color: hsl(0, 100%, 40%);">-                                               x = last_message_index(vmu, urgdir) + 1;</span><br><span style="color: hsl(0, 100%, 40%);">-                                                make_file(sfn, sizeof(sfn), dir, msgnum);</span><br><span style="color: hsl(0, 100%, 40%);">-                                               make_file(dfn, sizeof(dfn), urgdir, x);</span><br><span style="color: hsl(0, 100%, 40%);">-                                         ast_debug(5, "Created an Urgent message, moving file from %s to %s.\n", sfn, dfn);</span><br><span style="color: hsl(0, 100%, 40%);">-                                            RENAME(dir, msgnum, vmu->mailbox, vmu->context, urgdir, x, sfn, dfn);</span><br><span style="color: hsl(0, 100%, 40%);">-                                             /* Notification must happen for this new message in Urgent folder, not INBOX */</span><br><span style="color: hsl(0, 100%, 40%);">-                                         ast_copy_string(fn, dfn, sizeof(fn));</span><br><span style="color: hsl(0, 100%, 40%);">-                                           pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", fn);</span><br><span style="color: hsl(0, 100%, 40%);">-                                                msgnum = x;</span><br><span style="color: hsl(0, 100%, 40%);">-                                     }</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>                                    /* Notification needs to happen after the copy, though. */</span><br><span>                                   if (ast_fileexists(fn, NULL, NULL)) {</span><br><span> #ifdef IMAP_STORAGE</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14794">change 14794</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/+/14794"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I49934e093290d308506ab8d45a40ef705c5ae4f5 </div>
<div style="display:none"> Gerrit-Change-Number: 14794 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.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: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>