@ -495,7 +495,7 @@ static int speech_background(struct ast_channel *chan, void *data)
char dtmf [ AST_MAX_EXTENSION ] = " " ;
char dtmf [ AST_MAX_EXTENSION ] = " " ;
time_t start , current ;
time_t start , current ;
struct ast_datastore * datastore = NULL ;
struct ast_datastore * datastore = NULL ;
char * argv [ 2 ] , * args = NULL , * filename_tmp = NULL , * filename = NULL , tmp [ 2 ] = " " ;
char * argv [ 2 ] , * args = NULL , * filename_tmp = NULL , * filename = NULL , tmp [ 2 ] = " " , dtmf_terminator = ' # ' ;
const char * tmp2 = NULL ;
const char * tmp2 = NULL ;
args = ast_strdupa ( data ) ;
args = ast_strdupa ( data ) ;
@ -530,6 +530,14 @@ static int speech_background(struct ast_channel *chan, void *data)
if ( ( tmp2 = pbx_builtin_getvar_helper ( chan , " SPEECH_DTMF_MAXLEN " ) ) & & ! ast_strlen_zero ( tmp2 ) )
if ( ( tmp2 = pbx_builtin_getvar_helper ( chan , " SPEECH_DTMF_MAXLEN " ) ) & & ! ast_strlen_zero ( tmp2 ) )
max_dtmf_len = atoi ( tmp2 ) ;
max_dtmf_len = atoi ( tmp2 ) ;
/* See if a terminator is specified */
if ( ( tmp2 = pbx_builtin_getvar_helper ( chan , " SPEECH_DTMF_TERMINATOR " ) ) ) {
if ( ast_strlen_zero ( tmp2 ) )
dtmf_terminator = ' \0 ' ;
else
dtmf_terminator = tmp2 [ 0 ] ;
}
/* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
/* Before we go into waiting for stuff... make sure the structure is ready, if not - start it again */
if ( speech - > state = = AST_SPEECH_STATE_NOT_READY | | speech - > state = = AST_SPEECH_STATE_DONE ) {
if ( speech - > state = = AST_SPEECH_STATE_NOT_READY | | speech - > state = = AST_SPEECH_STATE_DONE ) {
ast_speech_change_state ( speech , AST_SPEECH_STATE_NOT_READY ) ;
ast_speech_change_state ( speech , AST_SPEECH_STATE_NOT_READY ) ;
@ -651,7 +659,7 @@ static int speech_background(struct ast_channel *chan, void *data)
/* Free the frame we received */
/* Free the frame we received */
switch ( f - > frametype ) {
switch ( f - > frametype ) {
case AST_FRAME_DTMF :
case AST_FRAME_DTMF :
if ( f- > subclass = = ' # ' ) {
if ( dtmf_terminator ! = ' \0 ' & & f- > subclass = = dtmf_terminator ) {
done = 1 ;
done = 1 ;
} else {
} else {
if ( chan - > stream ! = NULL ) {
if ( chan - > stream ! = NULL ) {