[Freeswitch-users] mod_sndfile error called from mod_tts_commandline

Lewis Bergman lewis.bergman at gmail.com
Fri Feb 26 21:41:24 UTC 2021


Hello all. I am pretty new to Freeswitch and have an experimental container
on Proxmox 6.3 Debian 10 to play with. The goal is to get mod_unimrcp
working. To that end, I have mod_tts_commandline (installed from binary
with FusionPBX as part of the default install) listed in modules.conf.xml
/etc/freeswitch/autoload_configs/modules.conf.xml
                <!-- Speech Recognition / Text to Speech -->
                <load module="mod_unimrcp"/>
                <load module="mod_tts_commandline"/>
                             <load module="mod_flite"/>
I have tried it with and without mod_flite enabled.
Mod_tts_commandline refuses to pull a sound file and the debug log seems to
blame mod_sndfile. This is using the example from the mod_tts_commandline
page
<https://freeswitch.org/confluence/display/FREESWITCH/mod_tts_commandline#mod_tts_commandline-Configuringmod_tts_commandline>
as dialplan shows following the debug log output below:

2021-02-26 15:19:24.713040 [NOTICE] mod_dptools.c:1406 Channel
[sofia/internal/102 at 66.151.243.45] has been answered
2021-02-26 15:19:24.713040 [DEBUG] switch_channel.c:3865 (sofia/internal/
102 at 66.151.243.45) Callstate Change RINGING -> ACTIVE
2021-02-26 15:19:24.713040 [DEBUG] sofia.c:7326 Channel sofia/internal/
102 at 66.151.243.45 entering state [completed][200]
EXECUTE [depth=0] sofia/internal/102 at 66.151.243.45
speak(tts_commandline|pico|This is an example of using tts_commandline)
2021-02-26 15:19:24.713040 [DEBUG] switch_ivr_play_say.c:3023 OPEN TTS
tts_commandline
2021-02-26 15:19:24.713040 [DEBUG] switch_ivr_play_say.c:3033 Raw Codec
Activated
2021-02-26 15:19:24.713040 [DEBUG] mod_tts_commandline.c:160 Executing:
echo 'This is an example of using tts_commandline' | text2wave -f 8000 >
'/tmp/0665a30d-2bb8-40fe-b5a6-9625bd58306e.tmp.wav'
2021-02-26 15:19:25.433013 [WARNING] mod_sndfile.c:281 Error Opening File
[/tmp/0665a30d-2bb8-40fe-b5a6-9625bd58306e.tmp.wav] [File contains data in
an unknown format.]
2021-02-26 15:19:25.433013 [ERR] mod_tts_commandline.c:170 Failed to open
file: /tmp/0665a30d-2bb8-40fe-b5a6-9625bd58306e.tmp.wav
2021-02-26 15:19:25.433013 [DEBUG] switch_ivr_play_say.c:2741 Speaking
text: This is an example of using tts_commandline
2021-02-26 15:19:25.433013 [DEBUG] sofia.c:7326 Channel sofia/internal/
102 at 66.151.243.45 entering state [ready][200]
2021-02-26 15:19:25.433013 [DEBUG] switch_ivr_play_say.c:2905 done speaking
text
2021-02-26 15:19:25.433013 [NOTICE] switch_core_state_machine.c:386
sofia/internal/102 at 66.151.243.45 has executed the last dialplan
instruction, hanging up.
2021-02-26 15:19:25.433013 [NOTICE] switch_core_state_machine.c:388 Hangup
sofia/internal/102 at 66.151.243.45 [CS_EXECUTE] [NORMAL_CLEARING]

The dialplan for extension I am testing looks like this:
<extension name="tts_commandline_test">
   <condition field="destination_number" expression="^561$">
      <action application="speak" data="tts_commandline|pico|This is an
example of using tts_commandline"/>
   </condition>
</extension>

The code lines mentioned in debug seem to be pretty mundane, not that I
really know what I am looking for:
>From mod_tts_commnandline line 160:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing: %s\n",
message);
I tried setting the /tmp directory to 777 but that didn't help and the
error output was identical. mod_tts_commandline never reports an error on
creation and it looks like the next part of of mod_tts_commandline would
print an error if it did like this:
if (switch_system(message, SWITCH_TRUE) < 0) {
    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to
execute command: %s\n", message);
    ret = SWITCH_STATUS_FALSE; goto done;
}
if (switch_core_file_open(info->fh, info->file, 0, //number_of_channels,
    info->rate, //samples_per_second,
    SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) !=
SWITCH_STATUS_SUCCESS) {
    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open
file: %s\n", info->file);
    ret = SWITCH_STATUS_FALSE; goto done;
}

Starting at line 279 in mod_sndfile (sorry for the space formatting):

if (!context->handle) {
if (sndfile_perform_open(context, path, mode, handle) !=
SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Opening
File [%s] [%s]\n", path, sf_strerror(context->handle));
status = SWITCH_STATUS_GENERR;
goto end;
}
}

According to the dptools docs
<https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools%3A+playback#mod_dptools:playback-3.1>
and
libsndfile wav has been supported forever and it would seem highly unlikely
that is an issue. I check the /tmp directory and no files are present but I
don't know if they are being deleted by some cleanup process or just not
created. Not knowing C, it seems like mod_sndfile never received a file
handle but that is just a guess. Other Freeswitch apps are writing to the
/tmp directory (at least there are some files in there). Maybe someone sees
an error from mod_tts_commandline I don't see or knows I am doing something
stupid. Any help would be appreciated. I only found 2 references to the
error in the mail history and neither had anything to do with a
similar issue.

Freeswitch version reports: FreeSWITCH Version
1.10.5-release-17-25569c1631~64bit (-release-17-25569c1631 64bit)
FusionPBX version, in case it matters, is : 4.5.21
OS is Debian 10 Buster
-- 
Lewis Bergman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20210226/06a4ba8f/attachment.html>


More information about the FreeSWITCH-users mailing list