core: Add digit filtering to ast_waitfordigit_full

This adds a parameter to ast_waitfordigit_full which can be used to only
stop waiting when certain expected digits are received.  Any unexpected
DTMF digits are simply ignored.

This also creates a new dialplan application WaitDigit.

ASTERISK-27129 #close

Change-Id: Id233935ea3d13e71c75a0861834c5936c3700ef9
This commit is contained in:
Corey Farrell
2017-07-12 14:24:36 -04:00
parent 27aeca3594
commit 6b138046e7
4 changed files with 92 additions and 10 deletions

View File

@@ -2219,11 +2219,12 @@ int ast_waitfordigit(struct ast_channel *c, int ms);
* Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to monitor for reading.
* \param c channel to wait for a digit on
* \param ms how many milliseconds to wait (<0 for indefinite).
* \param breakon string of DTMF digits to break upon or NULL for any.
* \param audiofd audio file descriptor to write to if audio frames are received
* \param ctrlfd control file descriptor to monitor for reading
* \return Returns 1 if ctrlfd becomes available
*/
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int ctrlfd);
int ast_waitfordigit_full(struct ast_channel *c, int ms, const char *breakon, int audiofd, int ctrlfd);
/*!
* \brief Reads multiple digits