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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: Configurable voicemail beep<br><br>Hitherto, VoiceMail() played a non-customizable beep tone to indicate<br>the caller could leave a message. In some cases, the beep may not<br>be desired, or a different tone may be desired.<br><br>To increase flexibility, a new option allows customization of the tone.<br>If the t option is specified, the default beep will be overridden.<br>Supplying an argument will cause it to use the specified file for the tone,<br>and omitting it will cause it to skip the beep altogether. If the option<br>is not used, the default behavior persists.<br><br>ASTERISK-29349<br><br>Change-Id: I1c439c0011497e28a28067fc1cf1e654c8843280<br>---<br>M apps/app_voicemail.c<br>A doc/CHANGES-staging/voicemail_beep.txt<br>2 files changed, 26 insertions(+), 4 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 994bb27..9e0e74d 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -182,6 +182,11 @@</span><br><span>                                          <para>Skip the playback of instructions for leaving a message to the</span><br><span>                                           calling party.</para></span><br><span>                                  </option></span><br><span style="color: hsl(120, 100%, 40%);">+                                       <option name="t"></span><br><span style="color: hsl(120, 100%, 40%);">+                                             <argument name="x" required="false" /></span><br><span style="color: hsl(120, 100%, 40%);">+                                              <para>Play a custom beep tone to the caller instead of the default one.</span><br><span style="color: hsl(120, 100%, 40%);">+                                         If this option is used but no file is specified, the beep is suppressed.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                 </option></span><br><span>                                      <option name="u"></span><br><span>                                            <para>Play the <literal>unavailable</literal> greeting.</para></span><br><span>                                       </option></span><br><span>@@ -665,15 +670,17 @@</span><br><span>      OPT_DTMFEXIT =         (1 << 7),</span><br><span>       OPT_MESSAGE_Urgent =   (1 << 8),</span><br><span>       OPT_MESSAGE_PRIORITY = (1 << 9),</span><br><span style="color: hsl(0, 100%, 40%);">-  OPT_EARLYM_GREETING =  (1 << 10)</span><br><span style="color: hsl(120, 100%, 40%);">+        OPT_EARLYM_GREETING =  (1 << 10),</span><br><span style="color: hsl(120, 100%, 40%);">+       OPT_BEEP =             (1 << 11)</span><br><span> };</span><br><span> </span><br><span> enum vm_option_args {</span><br><span>    OPT_ARG_RECORDGAIN = 0,</span><br><span>      OPT_ARG_PLAYFOLDER = 1,</span><br><span>      OPT_ARG_DTMFEXIT   = 2,</span><br><span style="color: hsl(120, 100%, 40%);">+       OPT_ARG_BEEP_TONE  = 3,</span><br><span>      /* This *must* be the last value in this enum! */</span><br><span style="color: hsl(0, 100%, 40%);">-       OPT_ARG_ARRAY_SIZE = 3,</span><br><span style="color: hsl(120, 100%, 40%);">+       OPT_ARG_ARRAY_SIZE = 4,</span><br><span> };</span><br><span> </span><br><span> enum vm_passwordlocation {</span><br><span>@@ -692,7 +699,8 @@</span><br><span>        AST_APP_OPTION_ARG('a', OPT_AUTOPLAY, OPT_ARG_PLAYFOLDER),</span><br><span>   AST_APP_OPTION('U', OPT_MESSAGE_Urgent),</span><br><span>     AST_APP_OPTION('P', OPT_MESSAGE_PRIORITY),</span><br><span style="color: hsl(0, 100%, 40%);">-      AST_APP_OPTION('e', OPT_EARLYM_GREETING)</span><br><span style="color: hsl(120, 100%, 40%);">+      AST_APP_OPTION('e', OPT_EARLYM_GREETING),</span><br><span style="color: hsl(120, 100%, 40%);">+     AST_APP_OPTION_ARG('t', OPT_BEEP, OPT_ARG_BEEP_TONE)</span><br><span> });</span><br><span> </span><br><span> static const char * const mailbox_folders[] = {</span><br><span>@@ -6382,6 +6390,7 @@</span><br><span>   unsigned int flags;</span><br><span>  signed char record_gain;</span><br><span>     char *exitcontext;</span><br><span style="color: hsl(120, 100%, 40%);">+    char *beeptone;</span><br><span> };</span><br><span> </span><br><span> static void generate_msg_id(char *dst)</span><br><span>@@ -7043,7 +7052,10 @@</span><br><span>                 /* Now play the beep once we have the message number for our next message. */</span><br><span>                if (res >= 0) {</span><br><span>                   /* Unless we're *really* silent, try to send the beep */</span><br><span style="color: hsl(0, 100%, 40%);">-                    res = ast_stream_and_wait(chan, "beep", "");</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* Play default or custom beep, unless no beep desired */</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (!ast_strlen_zero(options->beeptone)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                         res = ast_stream_and_wait(chan, options->beeptone, "");</span><br><span style="color: hsl(120, 100%, 40%);">+                  }</span><br><span>            }</span><br><span> </span><br><span>                /* Store information in real-time storage */</span><br><span>@@ -8578,6 +8590,7 @@</span><br><span>                 /* Send VoiceMail */</span><br><span>                 memset(&leave_options, 0, sizeof(leave_options));</span><br><span>                leave_options.record_gain = record_gain;</span><br><span style="color: hsl(120, 100%, 40%);">+              leave_options.beeptone = "beep";</span><br><span>           cmd = leave_voicemail(chan, mailbox, &leave_options);</span><br><span>    } else {</span><br><span>             /* Forward VoiceMail */</span><br><span>@@ -12403,6 +12416,11 @@</span><br><span>                                   leave_options.exitcontext = opts[OPT_ARG_DTMFEXIT];</span><br><span>                  }</span><br><span>            }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (ast_test_flag(&flags, OPT_BEEP)) { /* Use custom beep (or none at all) */</span><br><span style="color: hsl(120, 100%, 40%);">+                     leave_options.beeptone = opts[OPT_ARG_BEEP_TONE];</span><br><span style="color: hsl(120, 100%, 40%);">+             } else { /* Use default beep */</span><br><span style="color: hsl(120, 100%, 40%);">+                       leave_options.beeptone = "beep";</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span>    } else {</span><br><span>             char temp[256];</span><br><span>              res = ast_app_getdata(chan, "vm-whichbox", temp, sizeof(temp) - 1, 0);</span><br><span>@@ -15722,6 +15740,7 @@</span><br><span> </span><br><span>                               memset(&leave_options, 0, sizeof(leave_options));</span><br><span>                                leave_options.record_gain = record_gain;</span><br><span style="color: hsl(120, 100%, 40%);">+                              leave_options.beeptone = "beep";</span><br><span>                           res = leave_voicemail(chan, mailbox, &leave_options);</span><br><span>                            if (!res)</span><br><span>                                    res = 't';</span><br><span>diff --git a/doc/CHANGES-staging/voicemail_beep.txt b/doc/CHANGES-staging/voicemail_beep.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..d98b403</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/voicemail_beep.txt</span><br><span>@@ -0,0 +1,3 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_voicemail</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+You can now customize the "beep" tone or omit it entirely.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15877">change 15877</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/+/15877"/><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: I1c439c0011497e28a28067fc1cf1e654c8843280 </div>
<div style="display:none"> Gerrit-Change-Number: 15877 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </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-MessageType: merged </div>