Only consider linear frames for talk detection -- ignore anything else (bug #2219)
[asterisk/asterisk.git] / apps / app_talkdetect.c
index 60219c2..0816949 100755 (executable)
@@ -22,7 +22,6 @@
 #include <asterisk/dsp.h>
 #include <string.h>
 #include <stdlib.h>
-#include <pthread.h>
 
 static char *tdesc = "Playback with Talk Detection";
 
@@ -131,7 +130,7 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
                                                        ast_frfree(fr);
                                                        break;
                                                }
-                                       } else if (fr->frametype == AST_FRAME_VOICE) {
+                                       } else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass == AST_FORMAT_SLINEAR)) {
                                                int totalsilence;
                                                int ms;
                                                res = ast_dsp_silence(dsp, fr, &totalsilence);