mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Dialplan functions should not actually return 0, unless they have modified the
workspace. To signal an error (and no change to the workspace), -1 should be returned instead. (closes issue #13340) Reported by: kryptolus Patches: 20080827__bug13340__2.diff.txt uploaded by Corydon76 (license 14) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@146799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -193,8 +193,11 @@ static int speech_text(struct ast_channel *chan, char *cmd, char *data,
|
||||
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
|
||||
return -1;
|
||||
|
||||
if (result->text != NULL)
|
||||
if (result->text != NULL) {
|
||||
ast_copy_string(buf, result->text, len);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -219,8 +222,11 @@ static int speech_grammar(struct ast_channel *chan, char *cmd, char *data,
|
||||
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
|
||||
return -1;
|
||||
|
||||
if (result->grammar != NULL)
|
||||
if (result->grammar != NULL) {
|
||||
ast_copy_string(buf, result->grammar, len);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -322,6 +328,8 @@ static int speech_read(struct ast_channel *chan, char *cmd, char *data,
|
||||
}
|
||||
snprintf(tmp, sizeof(tmp), "%d", results);
|
||||
ast_copy_string(buf, tmp, len);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user