[asterisk-dev] Need help to get ast_dsp_call_progress working in a module
Wai Wu
wkwu at calltrol.com
Tue Jul 10 18:30:37 CDT 2007
This is part of the code in my test module. The ast_dsp_call_progress
always return 0. I have setup an system calling into the * box and this
module is called from a extension.
xcpa = ast_dsp_new();
if (!xcpa)
return 0;
/* Set read format to signed linear so we get signed linear
frames in */
readFormat = chan->readformat;
if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0 ) {
ast_dsp_free(xcpa);
return 0;
}
while ((res = ast_waitfor(chan, 40000)) > -1)
{
/* If we fail to read in a frame, that means they hung
up */
if (!(f = ast_read(chan)))
break;
if (f->frametype == AST_FRAME_VOICE)
{
/* get total time spent here */
TotalTime += (ast_codec_get_samples(f) /
DEFAULT_SAMPLES_PER_MS);;
rc = ast_dsp_call_progress(xcpa, f);
if (rc) ast_verbose(VERBOSE_PREFIX_3
"ast_dsp_call_progress %d.\r\n", rc);
if (TotalTime >= 40000)
break;
}
ast_frfree(f);
}
if (readFormat)
ast_set_read_format(chan, readFormat);
ast_dsp_free(xcpa);
return 0;
More information about the asterisk-dev
mailing list