<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19567">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_agi: Respect "transmit_silence" option for "RECORD FILE".<br><br>The "RECORD FILE" command in res_agi has its own<br>implementation for actually doing the recording. This<br>has resulted in it not actually obeying the option<br>"transmit_silence" when recording.<br><br>This change causes it to now send silence if the<br>option is enabled.<br><br>ASTERISK-30314<br><br>Change-Id: Ib3a85601ff35d1b904f836691bad8a4b7e957174<br>---<br>M res/res_agi.c<br>1 file changed, 34 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/19567/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_agi.c b/res/res_agi.c</span><br><span>index 56e8e76..cafe13b 100644</span><br><span>--- a/res/res_agi.c</span><br><span>+++ b/res/res_agi.c</span><br><span>@@ -2907,6 +2907,7 @@</span><br><span> int gotsilence = 0; /* did we timeout for silence? */</span><br><span> char *silencestr = NULL;</span><br><span> RAII_VAR(struct ast_format *, rfmt, NULL, ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_silence_generator *silgen = NULL;</span><br><span> </span><br><span> /* XXX EAGI FIXME XXX */</span><br><span> </span><br><span>@@ -2984,6 +2985,10 @@</span><br><span> ast_seekstream(fs, sample_offset, SEEK_SET);</span><br><span> ast_truncstream(fs);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_opt_transmit_silence) {</span><br><span style="color: hsl(120, 100%, 40%);">+ silgen = ast_channel_start_silence_generator(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> start = ast_tvnow();</span><br><span> while ((ms < 0) || ast_tvdiff_ms(ast_tvnow(), start) < ms) {</span><br><span> res = ast_waitfor(chan, ms - ast_tvdiff_ms(ast_tvnow(), start));</span><br><span>@@ -2992,6 +2997,8 @@</span><br><span> ast_agi_send(agi->fd, chan, "200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);</span><br><span> if (sildet)</span><br><span> ast_dsp_free(sildet);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (silgen)</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_stop_silence_generator(chan, silgen);</span><br><span> return RESULT_FAILURE;</span><br><span> }</span><br><span> f = ast_read(chan);</span><br><span>@@ -3000,6 +3007,8 @@</span><br><span> ast_agi_send(agi->fd, chan, "200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);</span><br><span> if (sildet)</span><br><span> ast_dsp_free(sildet);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (silgen)</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_stop_silence_generator(chan, silgen);</span><br><span> return RESULT_FAILURE;</span><br><span> }</span><br><span> switch(f->frametype) {</span><br><span>@@ -3016,6 +3025,8 @@</span><br><span> ast_frfree(f);</span><br><span> if (sildet)</span><br><span> ast_dsp_free(sildet);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (silgen)</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_stop_silence_generator(chan, silgen);</span><br><span> return RESULT_SUCCESS;</span><br><span> }</span><br><span> break;</span><br><span>@@ -3067,6 +3078,10 @@</span><br><span> ast_dsp_free(sildet);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (silgen) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_stop_silence_generator(chan, silgen);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> return RESULT_SUCCESS;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19567">change 19567</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/+/19567"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Ib3a85601ff35d1b904f836691bad8a4b7e957174 </div>
<div style="display:none"> Gerrit-Change-Number: 19567 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>