[Asterisk-code-review] res_agi: Respect "transmit_silence" option for "RECORD FILE". (asterisk[18])
Joshua Colp
asteriskteam at digium.com
Wed Nov 16 05:42:56 CST 2022
Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19567 )
Change subject: res_agi: Respect "transmit_silence" option for "RECORD FILE".
......................................................................
res_agi: Respect "transmit_silence" option for "RECORD FILE".
The "RECORD FILE" command in res_agi has its own
implementation for actually doing the recording. This
has resulted in it not actually obeying the option
"transmit_silence" when recording.
This change causes it to now send silence if the
option is enabled.
ASTERISK-30314
Change-Id: Ib3a85601ff35d1b904f836691bad8a4b7e957174
---
M res/res_agi.c
1 file changed, 34 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/19567/1
diff --git a/res/res_agi.c b/res/res_agi.c
index 56e8e76..cafe13b 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2907,6 +2907,7 @@
int gotsilence = 0; /* did we timeout for silence? */
char *silencestr = NULL;
RAII_VAR(struct ast_format *, rfmt, NULL, ao2_cleanup);
+ struct ast_silence_generator *silgen = NULL;
/* XXX EAGI FIXME XXX */
@@ -2984,6 +2985,10 @@
ast_seekstream(fs, sample_offset, SEEK_SET);
ast_truncstream(fs);
+ if (ast_opt_transmit_silence) {
+ silgen = ast_channel_start_silence_generator(chan);
+ }
+
start = ast_tvnow();
while ((ms < 0) || ast_tvdiff_ms(ast_tvnow(), start) < ms) {
res = ast_waitfor(chan, ms - ast_tvdiff_ms(ast_tvnow(), start));
@@ -2992,6 +2997,8 @@
ast_agi_send(agi->fd, chan, "200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);
if (sildet)
ast_dsp_free(sildet);
+ if (silgen)
+ ast_channel_stop_silence_generator(chan, silgen);
return RESULT_FAILURE;
}
f = ast_read(chan);
@@ -3000,6 +3007,8 @@
ast_agi_send(agi->fd, chan, "200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);
if (sildet)
ast_dsp_free(sildet);
+ if (silgen)
+ ast_channel_stop_silence_generator(chan, silgen);
return RESULT_FAILURE;
}
switch(f->frametype) {
@@ -3016,6 +3025,8 @@
ast_frfree(f);
if (sildet)
ast_dsp_free(sildet);
+ if (silgen)
+ ast_channel_stop_silence_generator(chan, silgen);
return RESULT_SUCCESS;
}
break;
@@ -3067,6 +3078,10 @@
ast_dsp_free(sildet);
}
+ if (silgen) {
+ ast_channel_stop_silence_generator(chan, silgen);
+ }
+
return RESULT_SUCCESS;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19567
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ib3a85601ff35d1b904f836691bad8a4b7e957174
Gerrit-Change-Number: 19567
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221116/72a3d113/attachment.html>
More information about the asterisk-code-review
mailing list