<p>Juan Carlos Castro y Castro would like Joshua Colp to <strong>review</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15065">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">voicemail: add option 'e' top 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>Change-Id: I6b8a77d33e338a3e52dd65f998d8a07e4d16aa2e<br><br>Change-Id: I41b9f0428783c0bd697c8c994f906d1e75ce9ddb<br>---<br>M apps/app_voicemail.c<br>1 file changed, 19 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/65/15065/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 0b9904c..67562da 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>@@ -627,7 +631,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>@@ -653,7 +658,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>@@ -6905,6 +6911,8 @@</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> 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>@@ -12310,9 +12318,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>@@ -12345,6 +12350,15 @@</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%);">+ ast_log(AST_LOG_WARNING, "Playing greetings as Early Media, deferring answer (EXPERIMENTAL FEATURE)\n");</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></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15065">change 15065</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/+/15065"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I41b9f0428783c0bd697c8c994f906d1e75ce9ddb </div>
<div style="display:none"> Gerrit-Change-Number: 15065 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Juan Carlos Castro y Castro <jccyc1965@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>