[Asterisk-Dev] RECORD FILE in app_agi

Steven Critchfield critch at basesys.com
Mon Mar 1 09:36:39 MST 2004


On Mon, 2004-03-01 at 06:35, Jason Boyd wrote:
> I'm contemplating a patch to app_agi.c that would address a few issues
> with the RECORD FILE command:

> 4) After a max-silence timeout, asterisk trims the recorded file so that
> only the first second of silence remains.  The "endpos=" value does not
> reflect this, however -- it still indicates the position in the file at
> the moment the maximum silence was hit.  I propose that that "endpos="
> value should take the silence trimming into account.
> 
> The first two are easy, but they are both potential script-breakers.  #3
> is not hard but it would be good to run it by someone who has some
> knowledge of how the silence detetctor works, to know what sane values
> are, if nothing else.  #4 is tricky, and I'd be much obliged if someone
> with a little more experience would take a peek at it.


#4 wasn't tricky at all. For #4, if you truncate, do a
ast_tellstream(fs) again.

Index: apps/app_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_agi.c,v
retrieving revision 1.27
diff -u -r1.27 app_agi.c
--- apps/app_agi.c      27 Feb 2004 08:30:30 -0000      1.27
+++ apps/app_agi.c      1 Mar 2004 16:34:34 -0000
@@ -614,6 +614,7 @@
                if (gotsilence) {
                        ast_stream_rewind(fs, silence-1000);
                        ast_truncstream(fs);
+                       sample_offset = ast_tellstream(fs);
                }
                fdprintf(agi->fd, "200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
                ast_closestream(fs);


-- 
Steven Critchfield  <critch at basesys.com>




More information about the asterisk-dev mailing list