<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15059">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">voicemail: add option 'e' to play greetings as early media<br><br>When using this option, answering the channel is deferred until<br>all prompts/greetings have been played and the caller is about<br>to leave their message.<br><br>ASTERISK-29118 #close<br><br>Change-Id: I41b9f0428783c0bd697c8c994f906d1e75ce9ddb<br>---<br>M apps/app_voicemail.c<br>A doc/CHANGES-staging/voicemail_early_media.txt<br>2 files changed, 25 insertions(+), 5 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 c830ec3..1bb736b 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -135,6 +135,10 @@</span><br><span> <para>Accept digits for a new extension in context <replaceable>c</replaceable>,</span><br><span> if played during the greeting. Context defaults to the current context.</para></span><br><span> </option></span><br><span style="color: hsl(120, 100%, 40%);">+ <option name="e"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Play greetings as early media -- only answer the channel just</span><br><span style="color: hsl(120, 100%, 40%);">+ before accepting the voice message.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </option></span><br><span> <option name="g"></span><br><span> <argument name="#" required="true" /></span><br><span> <para>Use the specified amount of gain when recording the voicemail</span><br><span>@@ -577,7 +581,8 @@</span><br><span> OPT_AUTOPLAY = (1 << 6),</span><br><span> OPT_DTMFEXIT = (1 << 7),</span><br><span> OPT_MESSAGE_Urgent = (1 << 8),</span><br><span style="color: hsl(0, 100%, 40%);">- OPT_MESSAGE_PRIORITY = (1 << 9)</span><br><span style="color: hsl(120, 100%, 40%);">+ OPT_MESSAGE_PRIORITY = (1 << 9),</span><br><span style="color: hsl(120, 100%, 40%);">+ OPT_EARLYM_GREETING = (1 << 10)</span><br><span> };</span><br><span> </span><br><span> enum vm_option_args {</span><br><span>@@ -603,7 +608,8 @@</span><br><span> AST_APP_OPTION('p', OPT_PREPEND_MAILBOX),</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 style="color: hsl(0, 100%, 40%);">- AST_APP_OPTION('P', OPT_MESSAGE_PRIORITY)</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_APP_OPTION('P', OPT_MESSAGE_PRIORITY),</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_APP_OPTION('e', OPT_EARLYM_GREETING)</span><br><span> });</span><br><span> </span><br><span> static const char * const mailbox_folders[] = {</span><br><span>@@ -6854,6 +6860,9 @@</span><br><span> return -1;</span><br><span> }</span><br><span> /* The meat of recording the message... All the announcements and beeps have been played*/</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_channel_state(chan) != AST_STATE_UP) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_answer(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> ast_copy_string(fmt, vmfmts, sizeof(fmt));</span><br><span> if (!ast_strlen_zero(fmt)) {</span><br><span> char msg_id[MSG_ID_LEN] = "";</span><br><span>@@ -12259,9 +12268,6 @@</span><br><span> </span><br><span> memset(&leave_options, 0, sizeof(leave_options));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_channel_state(chan) != AST_STATE_UP)</span><br><span style="color: hsl(0, 100%, 40%);">- ast_answer(chan);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if (!ast_strlen_zero(data)) {</span><br><span> tmp = ast_strdupa(data);</span><br><span> AST_STANDARD_APP_ARGS(args, tmp);</span><br><span>@@ -12294,6 +12300,14 @@</span><br><span> args.argv0 = ast_strdupa(temp);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_channel_state(chan) != AST_STATE_UP) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_test_flag(&flags, OPT_EARLYM_GREETING)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_indicate(chan, AST_CONTROL_PROGRESS);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_answer(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> res = leave_voicemail(chan, args.argv0, &leave_options);</span><br><span> if (res == 't') {</span><br><span> ast_play_and_wait(chan, "vm-goodbye");</span><br><span>diff --git a/doc/CHANGES-staging/voicemail_early_media.txt b/doc/CHANGES-staging/voicemail_early_media.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..6dd79be</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/voicemail_early_media.txt</span><br><span>@@ -0,0 +1,6 @@</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%);">+The VoiceMail application can now be configured to send greetings and</span><br><span style="color: hsl(120, 100%, 40%);">+instructions via early media and only answering the channel when it is</span><br><span style="color: hsl(120, 100%, 40%);">+time for the caller to record their message. This behavior can be</span><br><span style="color: hsl(120, 100%, 40%);">+activated by passing the new 'e' option to VoiceMail.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15059">change 15059</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/+/15059"/><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: I41b9f0428783c0bd697c8c994f906d1e75ce9ddb </div>
<div style="display:none"> Gerrit-Change-Number: 15059 </div>
<div style="display:none"> Gerrit-PatchSet: 10 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.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-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>