Hi
I'm currently using mod_tts_commandline with a python script to AWS text to speech API. The flow works fine during a single call.
Event socket API -> Freeswitch dialplan -> mod_tts_commandline -> Python script -> AWS API -> Voice file -> Freeswitch say
However when there a number of concurrent calls (even just 10 to 15) the request to execute the python script hangs until all the calls are at the same requesting state. As if mod_tts_commandline is waiting for something to happen.
Dial plan:
<extension name="tts_google">
<condition field="destination_number" expression="^11111$">
<action application="set" data="call_timeout=60" />
<action application="answer"/>
<action application="detect_silence" data="100 30 25000"/>
<action application="speak" data="tts_commandline|${lang}|${text}" />
<action application="hangup"/>
</condition>
</extension>
tts_commandline.conf:
<param name="command" value="/usr/bin/python /usr/local/freeswitch/scripts/synthesize_text.py --language=${voice} --filename=${file} --text=${text}"/>
</settings>
Execution of python script in freeswitch logs:
2018-08-30 11:19:57.641892 [ERR] switch_ivr_play_say.c:2385 switch_ivr_detect_silence: SILENCE DETECTED
2018-08-30 11:19:57.641892 [DEBUG] switch_core_codec.c:248 sofia/external/33123456789 Restore previous codec PCMU:0.
EXECUTE sofia/external/33123456789 speak(tts_commandline|en-US|Hi, This is a test message)
2018-08-30 11:19:57.641892 [DEBUG] switch_ivr_play_say.c:3025 OPEN TTS tts_commandline
2018-08-30 11:19:57.641892 [DEBUG] switch_ivr_play_say.c:3035 Raw Codec Activated
2018-08-30 11:19:57.641892 [DEBUG] mod_tts_commandline.c:160 Executing: /usr/bin/python /usr/local/freeswitch/scripts/synthesize_text.py --language='en-US' --filename='/tmp/92ec5996-0dc8-4293-b5ba-465430811fed.tmp.wav' --text='Hi, This is a test message'
"Simultaneous calls requesting mod_tts_commandline"
Log from python script: (notice it's called with a 15 second delay) ---> What is causing this delay?
2018-08-30 11:20:12,488 DEBUG Called script
2018-08-30 11:20:12,490 DEBUG Arguments Namespace(filename='/tmp/92ec5996-0dc8-4293-b5ba-465430811fed.tmp.wav', language='en-US', ssml=None, text='Hi, This is a test message')
2018-08-30 11:20:12,490 DEBUG synthesize_text requested
The python script executes fine and returns to freeswitch:
2018-08-30 11:20:14.541919 [DEBUG] switch_core_file.c:342 File /tmp/c61d2034-c1b1-4f42-932f-350484553b5a.tmp.wav sample rate 24000 doesn't match requested rate 8000
2018-08-30 11:20:14.541919 [DEBUG] switch_ivr_play_say.c:2729 Speaking text: Hi, This is a test message
Any help or further debugging steps would be appreciated.
Thanks
Lee