[asterisk-commits] file: trunk r54715 - in /trunk: ./ apps/app_speech_utils.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 15 17:54:11 MST 2007


Author: file
Date: Thu Feb 15 18:54:10 2007
New Revision: 54715

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54715
Log:
Merged revisions 54714 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r54714 | file | 2007-02-15 19:48:48 -0500 (Thu, 15 Feb 2007) | 2 lines

Don't let dtmf leak over into the engine and let it skew the results... also give DTMF results priority. (issue #9014 reported by surftek)

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_speech_utils.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_speech_utils.c?view=diff&rev=54715&r1=54714&r2=54715
==============================================================================
--- trunk/apps/app_speech_utils.c (original)
+++ trunk/apps/app_speech_utils.c Thu Feb 15 18:54:10 2007
@@ -614,39 +614,43 @@
 				time(&start);
 				started = 1;
                         }
-                        /* Deal with audio frames if present */
-                        if (f != NULL && f->frametype == AST_FRAME_VOICE) {
+                        /* Write audio frame out to speech engine if no DTMF has been received */
+                        if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) {
                                 ast_speech_write(speech, f->data, f->datalen);
                         }
                         break;
                 case AST_SPEECH_STATE_WAIT:
                         /* Cue up waiting sound if not already playing */
-                        if (chan->stream == NULL) {
-                                if (speech->processing_sound != NULL) {
-                                        if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
-                                                speech_streamfile(chan, speech->processing_sound, chan->language);
-                                        }
-                                }
-                        } else if (chan->streamid == -1 && chan->timingfunc == NULL) {
-                                ast_stopstream(chan);
-                                if (speech->processing_sound != NULL) {
-                                        if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
-                                                speech_streamfile(chan, speech->processing_sound, chan->language);
-                                        }
-                                }
-                        }
+			if (!strlen(dtmf)) {
+				if (chan->stream == NULL) {
+					if (speech->processing_sound != NULL) {
+						if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
+							speech_streamfile(chan, speech->processing_sound, chan->language);
+						}
+					}
+				} else if (chan->streamid == -1 && chan->timingfunc == NULL) {
+					ast_stopstream(chan);
+					if (speech->processing_sound != NULL) {
+						if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
+							speech_streamfile(chan, speech->processing_sound, chan->language);
+						}
+					}
+				}
+			}
                         break;
                 case AST_SPEECH_STATE_DONE:
-                        /* Copy to speech structure the results, if available */
-                        speech->results = ast_speech_results_get(speech);
-                        /* Now that we are done... let's switch back to not ready state */
+			/* Now that we are done... let's switch back to not ready state */
 			ast_speech_change_state(speech, AST_SPEECH_STATE_NOT_READY);
-                        /* Break out of our background too */
-                        done = 1;
-                        /* Stop audio playback */
-                        if (chan->stream != NULL) {
-                                ast_stopstream(chan);
-                        }
+			if (!strlen(dtmf)) {
+				/* Copy to speech structure the results, if available */
+				speech->results = ast_speech_results_get(speech);
+				/* Break out of our background too */
+				done = 1;
+				/* Stop audio playback */
+				if (chan->stream != NULL) {
+					ast_stopstream(chan);
+				}
+			}
                         break;
                 default:
                         break;
@@ -688,7 +692,7 @@
                 }
         }
 
-	if (strlen(dtmf) > 0 && speech->results == NULL) {
+	if (strlen(dtmf)) {
 		/* We sort of make a results entry */
 		speech->results = ast_calloc(1, sizeof(*speech->results));
 		if (speech->results != NULL) {



More information about the asterisk-commits mailing list