[Asterisk-cvs] asterisk/formats format_gsm.c,1.13,1.14 format_wav_gsm.c,1.15,1.16

martinp at lists.digium.com martinp at lists.digium.com
Tue Feb 3 10:48:18 CST 2004


Update of /usr/cvsroot/asterisk/formats
In directory mongoose.digium.com:/tmp/cvs-serv26567/formats

Modified Files:
	format_gsm.c format_wav_gsm.c 
Log Message:
Add recording agent's calls patch. Basically the call starts recording when the agent picks up and the file is stamped with the agent's id and the timestamp. Also optionally a URL link to that file may be inserted in the userfield of the CDR record. By default the recorded file will be mixed if soxmix is available.


Index: format_gsm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_gsm.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- format_gsm.c	22 Jan 2004 21:30:04 -0000	1.13
+++ format_gsm.c	3 Feb 2004 16:57:00 -0000	1.14
@@ -33,11 +33,18 @@
 #endif
 #include "msgsm.h"
 
-
 /* Some Ideas for this code came from makegsme.c by Jeffrey Chilton */
 
 /* Portions of the conversion code are by guido at sienanet.it */
 
+/* silent gsm frame */
+/* begin binary data: */
+char gsm_silence[] = /* 33 */
+{0xD8,0x20,0xA2,0xE1,0x5A,0x50,0x00,0x49,0x24,0x92,0x49,0x24,0x50,0x00,0x49
+,0x24,0x92,0x49,0x24,0x50,0x00,0x49,0x24,0x92,0x49,0x24,0x50,0x00,0x49,0x24
+,0x92,0x49,0x24};
+/* end binary data. size = 33 bytes */
+
 struct ast_filestream {
 	void *reserved[AST_RESERVED_POINTERS];
 	/* Believe it or not, we must decode/recode to account for the
@@ -193,6 +200,12 @@
 	if (whence != SEEK_FORCECUR) {
 		offset = (offset > max)?max:offset;
 		offset = (offset < min)?min:offset;
+	} else if (offset > max) {
+		int i;
+		lseek(fs->fd, 0, SEEK_END);
+		for (i=0; i< (offset - max) / 33; i++) {
+			write(fs->fd, gsm_silence, 33);
+		}
 	}
 	return lseek(fs->fd, offset, SEEK_SET);
 }

Index: format_wav_gsm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_wav_gsm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- format_wav_gsm.c	22 Jan 2004 21:30:04 -0000	1.15
+++ format_wav_gsm.c	3 Feb 2004 16:57:00 -0000	1.16
@@ -37,6 +37,15 @@
 
 /* Portions of the conversion code are by guido at sienanet.it */
 
+/* begin binary data: */
+char msgsm_silence[] = /* 65 */
+{0x48,0x17,0xD6,0x84,0x02,0x80,0x24,0x49,0x92,0x24,0x89,0x02,0x80,0x24,0x49
+,0x92,0x24,0x89,0x02,0x80,0x24,0x49,0x92,0x24,0x89,0x02,0x80,0x24,0x49,0x92
+,0x24,0x09,0x82,0x74,0x61,0x4D,0x28,0x00,0x48,0x92,0x24,0x49,0x92,0x28,0x00
+,0x48,0x92,0x24,0x49,0x92,0x28,0x00,0x48,0x92,0x24,0x49,0x92,0x28,0x00,0x48
+,0x92,0x24,0x49,0x92,0x00};
+/* end binary data. size = 65 bytes */
+
 struct ast_filestream {
 	void *reserved[AST_RESERVED_POINTERS];
 	/* Believe it or not, we must decode/recode to account for the
@@ -487,6 +496,12 @@
 	if (whence != SEEK_FORCECUR) {
 		offset = (offset < min)?min:offset;
 		offset = (offset > max)?max:offset;
+	} else if (offset > max) {
+		int i;
+		lseek(fs->fd, 0, SEEK_END);
+		for (i=0; i< (offset - max) / 65; i++) {
+			write(fs->fd, msgsm_silence, 65);
+		}
 	}
 	fs->secondhalf = 0;
 	return lseek(fs->fd, offset, SEEK_SET);




More information about the svn-commits mailing list