Index: apps/app_meetme.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v retrieving revision 1.70 diff -u -r1.70 app_meetme.c --- apps/app_meetme.c 14 Jan 2005 05:10:00 -0000 1.70 +++ apps/app_meetme.c 18 Jan 2005 03:10:43 -0000 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -522,6 +523,8 @@ int menu_active = 0; int using_pseudo = 0; int duration=20; + int talking=0; + struct ast_dsp *dsp; struct ast_app *app; char *agifile; @@ -774,6 +777,13 @@ x = 1; ast_channel_setoption(chan,AST_OPTION_TONE_VERIFY,&x,sizeof(char),0); } + if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR))) + ast_log(LOG_WARNING, "Unable to set read format to linear!\n"); + + if (!(dsp = ast_dsp_new())) { + ast_log(LOG_WARNING, "Unable to allocate DSP!\n"); + res = -1; + } for(;;) { outfd = -1; ms = -1; @@ -852,7 +862,19 @@ f = ast_read(c); if (!f) break; - if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) { + if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) { + int totalsilence; + int ms; + res = ast_dsp_silence(dsp, f, &totalsilence); + if (totalsilence < 300 && !talking) { + ast_log(LOG_WARNING, "MeetMe User %d Start Talking\n",user->user_no); + talking = 1; + } + if (totalsilence > 1000 && talking) { + ast_log(LOG_WARNING, "MeetMe User %d Stop Talking\n",user->user_no); + talking = 0; + } + } else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) { char tmp[2]; tmp[0] = f->subclass; tmp[1] = '\0';