Index: formats/format_wav_gsm.c =================================================================== --- formats/format_wav_gsm.c (revision 47521) +++ formats/format_wav_gsm.c (working copy) @@ -86,6 +86,20 @@ static char *desc = "Microsoft WAV format (Proprietary GSM)"; static char *exts = "WAV|wav49"; +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}; + +struct ast_frame silence_frame = { + .frametype = AST_FRAME_VOICE, + .subclass = AST_FORMAT_GSM, + .datalen = 33, + .mallocd = 0, + .src = "wav49", + .data = gsm_silence, +}; + #if __BYTE_ORDER == __LITTLE_ENDIAN #define htoll(b) (b) #define htols(b) (b) @@ -405,6 +419,8 @@ return tmp; } +static int wav_write(struct ast_filestream *fs, struct ast_frame *f); + static void wav_close(struct ast_filestream *s) { char zero = 0; @@ -415,6 +431,8 @@ glistcnt--; ast_mutex_unlock(&wav_lock); ast_update_use_count(); + if (s->secondhalf) + wav_write(s, &silence_frame); /* Pad to even length */ fseek(s->f, 0, SEEK_END); if (ftell(s->f) & 0x1)