[Asterisk-Dev] Wait for Digits
Dean Whitock
webjester at chartertn.net
Fri Jan 14 14:49:29 MST 2005
I am wanting to modify the wait for digits command to accept 2 key
presses instead of 1 but still have the time out
What would be the best way to do this ?
char ast_waitfordigit(struct ast_channel *c, int ms)
{
/* XXX Should I be merged with waitfordigit_full XXX */
struct ast_frame *f;
char result = 0;
/* Stop if we're a zombie or need a soft hangup */
if (c->zombie || ast_check_hangup(c))
return -1;
/* Wait for a digit, no more than ms milliseconds total. */
while(ms && !result) {
ms = ast_waitfor(c, ms);
if (ms < 0) /* Error */
result = -1;
else if (ms > 0) {
/* Read something */
f = ast_read(c);
if (f) {
if (f->frametype == AST_FRAME_DTMF)
result = f->subclass;
ast_frfree(f);
} else
result = -1;
}
}
return result;
}
Thanks,
Dean
More information about the asterisk-dev
mailing list