提交 13bec74c authored 作者: Chad Phillips's avatar Chad Phillips

fix bad calls to debug function. use flac instead of sox, since RHEL doesn't…

fix bad calls to debug function.  use flac instead of sox, since RHEL doesn't provide a recent enough version of sox.
上级 89ad5d05
...@@ -19,7 +19,7 @@ Translations are stored in the specified storage area with the following keys, w ...@@ -19,7 +19,7 @@ Translations are stored in the specified storage area with the following keys, w
A 'status' key is also place in the storage area, indicating the result of the translation. A value of 0 indicates the translation was successful. A 'status' key is also place in the storage area, indicating the result of the translation. A value of 0 indicates the translation was successful.
This action requires that sox is installed and executable by FreeSWITCH.]] This action requires that flac is installed and executable by FreeSWITCH.]]
jester.help_map.speech_to_text.actions.speech_to_text_from_file.params = { jester.help_map.speech_to_text.actions.speech_to_text_from_file.params = {
filepath = [[The full path to the file to translate.]], filepath = [[The full path to the file to translate.]],
storage_area = [[(Optional) The storage area to store the response in. Defaults to 'speech_to_text'.]], storage_area = [[(Optional) The storage area to store the response in. Defaults to 'speech_to_text'.]],
......
...@@ -20,7 +20,7 @@ function speech_to_text_from_file_google(action) ...@@ -20,7 +20,7 @@ function speech_to_text_from_file_google(action)
success, file_error = lfs.attributes(filepath, "mode") success, file_error = lfs.attributes(filepath, "mode")
if success then if success then
flac_file = os.tmpname() .. ".flac" flac_file = os.tmpname() .. ".flac"
command = string.format("sox %s --rate 8k %s", filepath, flac_file) command = string.format("flac --compression-level-0 --sample-rate=8000 -o %s %s", flac_file, filepath)
result = os.execute(command) result = os.execute(command)
if result == 0 then if result == 0 then
...@@ -55,14 +55,14 @@ function speech_to_text_from_file_google(action) ...@@ -55,14 +55,14 @@ function speech_to_text_from_file_google(action)
end end
end end
else else
jester.debug("ERROR: Request to Google API server failed: %s", status_description) jester.debug_log("ERROR: Request to Google API server failed: %s", status_description)
jester.set_storage(area, "status", 1) jester.set_storage(area, "status", 1)
end end
else else
jester.debug("ERROR: Unable to convert file %s to FLAC format via sox", filepath) jester.debug_log("ERROR: Unable to convert file %s to FLAC format via flac executable", filepath)
end end
else else
jester.debug("ERROR: File %s does not exist", filepath) jester.debug_log("ERROR: File %s does not exist", filepath)
end end
end end
end end
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论