aboutsummaryrefslogtreecommitdiffstats
path: root/formats/format_gsm.c
diff options
context:
space:
mode:
authormartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2004-02-03 16:57:00 +0000
committermartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2004-02-03 16:57:00 +0000
commitf38bc8131c9eda8d0b0eabaafbaa53f4247989c4 (patch)
tree737412e9d633692be843c8429cc62df22fc5cfd7 /formats/format_gsm.c
parent30674920f6b94533e355a87eaf823cf14bcba9ef (diff)
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.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2121 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'formats/format_gsm.c')
-rwxr-xr-xformats/format_gsm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/formats/format_gsm.c b/formats/format_gsm.c
index 88ca9fde7..4ac2b5a5d 100755
--- a/formats/format_gsm.c
+++ b/formats/format_gsm.c
@@ -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@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 @@ static int gsm_seek(struct ast_filestream *fs, long sample_offset, int whence)
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);
}