[asterisk-dev] AST_FRAME_NULL - what is it?
Bryan Field-Elliot
bryan+asterisk-dev at nextalarm.com
Fri May 29 08:54:44 CDT 2009
We are running a simple custom application on Asterisk 1.6.1, which
basically waits for a DTMF digit to be entered by the user.
Our code is basically like this:
struct ast_frame *frame;
while (true) {
ast_waitfor(channel, -1);
frame = ast_read(channel);
// Exit if hung up
if (frame->frametype == AST_FRAME_CONTROL) && (f->subclass ==
AST_CONTROL_HANGUP)) {
ast_frfree(frame);
return;
}
if (frame->frametype == AST_FRAME_DTMF) {
// .. Do the thing we need with the digit ...
ast_frfree(frame);
return;
}
// Ignore the frame, it's not a DTMF digit.
ast_frfree(frame);
}
Most of our clients are SIP clients, and this loop ends up ignoring a
few hundred frames before the user enters a digit. That's fine. But
some of our SIP clients, when they execute this, end up throwing us
around 150,000 AST_FRAME_NULL's, which this little loop has to ignore.
I don't know why Asterisk is sending us the AST_FRAME_NULL's or what
it's supposed to mean, but, our CPU is getting pegged from having to
process and ignore all those frames. CPU is NOT pegged when a SIP
client connects which is not sending us these null frames.
Can anyone please advise why this is happening, and how we can get it
to stop?
More information about the asterisk-dev
mailing list