]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add an API call to allow the engine to know that DTMF was received.
authorJoshua Colp <jcolp@digium.com>
Mon, 13 Aug 2007 14:51:09 +0000 (14:51 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 13 Aug 2007 14:51:09 +0000 (14:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79207 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_speech_utils.c
include/asterisk/speech.h
res/res_speech.c

index c545db7cdc608536c237345caed93698d4d868a6..cf559c453b161749c2594158e9d7505d21daa3bd 100644 (file)
@@ -722,6 +722,7 @@ static int speech_background(struct ast_channel *chan, void *data)
                         /* Free the frame we received */
                         switch (f->frametype) {
                         case AST_FRAME_DTMF:
+                               ast_speech_dtmf(speech, f->subclass);
                                if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) {
                                        done = 1;
                                } else {
index 85e17edf2ac6238d4fa359fb9ecef051b4ff5c08..85a3514851fa72dee8c1e7dd6ca30c3fe70ebf65 100644 (file)
@@ -83,6 +83,8 @@ struct ast_speech_engine {
        int (*deactivate)(struct ast_speech *speech, char *grammar_name);
        /*! Write audio to the speech engine */
        int (*write)(struct ast_speech *speech, void *data, int len);
+       /*! Signal DTMF was received */
+       int (*dtmf)(struct ast_speech *speech, char dtmf);
        /*! Prepare engine to accept audio */
        int (*start)(struct ast_speech *speech);
        /*! Change an engine specific setting */
@@ -130,6 +132,8 @@ struct ast_speech *ast_speech_new(char *engine_name, int format);
 int ast_speech_destroy(struct ast_speech *speech);
 /*! \brief Write audio to the speech engine */
 int ast_speech_write(struct ast_speech *speech, void *data, int len);
+/*! \brief Signal to the engine that DTMF was received */
+int ast_speech_dtmf(struct ast_speech *speech, char dtmf);
 /*! \brief Change an engine specific attribute */
 int ast_speech_change(struct ast_speech *speech, char *name, const char *value);
 /*! \brief Change the type of results we want */
index 73dfe8dec646d9b52fde637e33b72cd5ee579317..5b8f3569c2bff4fecc217fe39c93c2e07c9f6492 100644 (file)
@@ -193,6 +193,21 @@ int ast_speech_write(struct ast_speech *speech, void *data, int len)
        return res;
 }
 
+/*! \brief Signal to the engine that DTMF was received */
+int ast_speech_dtmf(struct ast_speech *speech, char dtmf)
+{
+       int res = 0;
+
+       if (speech->state != AST_SPEECH_STATE_READY)
+               return -1;
+
+       if (speech->engine->dtmf != NULL) {
+               res = speech->engine->dtmf(speech, dtmf);
+       }
+
+       return res;
+}
+
 /*! \brief Change an engine specific attribute */
 int ast_speech_change(struct ast_speech *speech, char *name, const char *value)
 {