<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15887">View Change</a></p><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>1 file changed, 23 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/15887/1</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 2929cf2..db531e9 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -149,6 +149,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>@@ -582,15 +587,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>@@ -609,7 +616,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>@@ -6277,6 +6285,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>@@ -6938,7 +6947,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>@@ -8473,6 +8485,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>@@ -12298,6 +12311,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>@@ -15450,6 +15468,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></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15887">change 15887</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/+/15887"/><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: I1c439c0011497e28a28067fc1cf1e654c8843280 </div>
<div style="display:none"> Gerrit-Change-Number: 15887 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>