drachtio/drachtio-freeswitch-modules

Error when starting to intercept voice channel:

Closed this issue · 3 comments

Hi,
we're trying to test Drachtio with custom FS modules to integrate with Google DialogFlow.

So far we have the custom FS version installed based on the Ansible role from another repository and drachtio-server installed from the source. These modules are on the same server. Then we have the exemplary node.js app "simple-dialogflow-example" on another server and trying to make some testing calls.
The modules seem to be connected properly, the sample app connects both to FS and drachtio-server.
The environmental variable GOOGLE_APPLICATION_CREDENTIALS is set as well and the json file with Google app credentials is on the server in accessible path.

The FreeSwitch log throws this on the console when the call is connected:

2019-10-17 07:37:58.950617 [DEBUG] sofia.c:7291 Channel sofia/drachtio_mrf/nobody@104.248.2.221:5061 entering state [ready][200] 2019-10-17 07:37:58.970627 [DEBUG] switch_ivr.c:625 sofia/drachtio_mrf/nobody@104.248.2.221:5061 Command Execute answer(undefined) EXECUTE sofia/drachtio_mrf/nobody@104.248.2.221:5061 answer(undefined) 2019-10-17 07:37:59.010608 [DEBUG] switch_ivr.c:625 sofia/drachtio_mrf/nobody@104.248.2.221:5061 Command Execute set(codec_string=PCMU) EXECUTE sofia/drachtio_mrf/nobody@104.248.2.221:5061 set(codec_string=PCMU) 2019-10-17 07:37:59.010608 [DEBUG] mod_dptools.c:1598 SET sofia/drachtio_mrf/nobody@104.248.2.221:5061 [codec_string]=[PCMU] 2019-10-17 07:37:59.090643 [DEBUG] mod_dialogflow.c:153 command 0a9761f6-f0b1-11e9-b97e-d73ac769f0aa testing123-nmhtfg en-US 20 welcome 2019-10-17 07:37:59.090643 [INFO] mod_dialogflow.c:102 starting dialogflow with project testing123-nmhtfg, language en-US, timeout: 20, event welcome. 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:54 GStreamer::startStream set event welcome, 0x7fa014002200 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:135 grpc_read_thread: starting cb 0x7fa0181ac240 2019-10-17 07:37:59.090643 [INFO] mod_dialogflow.c:56 Got SWITCH_ABC_TYPE_INIT. 2019-10-17 07:37:59.090643 [DEBUG] switch_core_media_bug.c:962 Attaching BUG to sofia/drachtio_mrf/nobody@104.248.2.221:5061 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:195 dialogflow read loop is done 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:91 GStreamer::finish 0x7fa014002200 2019-10-17 07:37:59.090643 [CRIT] google_glue.cpp:202 StreamingDetectIntentRequest finished with err lame client channel (2): 2019-10-17 07:37:59.090643 [INFO] mod_dialogflow.c:136 Received user command command to stop dialogflow. 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:91 GStreamer::finish 0x7fa014002200 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:44 GStreamer::~GStreamer wrote 0 packets 0x7fa014002200 2019-10-17 07:37:59.090643 [INFO] mod_dialogflow.c:61 Got SWITCH_ABC_TYPE_CLOSE. 2019-10-17 07:37:59.090643 [INFO] google_glue.cpp:313 sofia/drachtio_mrf/nobody@104.248.2.221:5061 Bug is not attached. 2019-10-17 07:37:59.090643 [DEBUG] mod_dialogflow.c:64 Finished SWITCH_ABC_TYPE_CLOSE. 2019-10-17 07:37:59.090643 [DEBUG] switch_core_media_bug.c:1276 Removing BUG from sofia/drachtio_mrf/nobody@104.248.2.221:5061 2019-10-17 07:37:59.090643 [INFO] google_glue.cpp:308 google_dialogflow_session_cleanup: Closed google session 2019-10-17 07:37:59.090643 [INFO] mod_dialogflow.c:138 stopped dialogflow. 2019-10-17 07:37:59.090643 [DEBUG] google_glue.cpp:210 dialogflow read thread exiting 2019-10-17 07:37:59.330632 [DEBUG] switch_rtp.c:7550 Correct audio ip/port confirmed. 2019-10-17 07:37:59.330632 [DEBUG] switch_core_io.c:448 Setting BUG Codec PCMU:0 2019-10-17 07:38:05.170614 [DEBUG] switch_ivr.c:625 sofia/drachtio_mrf/nobody@104.248.2.221:5061 Command Execute hangup() EXECUTE sofia/drachtio_mrf/nobody@104.248.2.221:5061 hangup()

Can you point me to the right direction where should I look for the solution?
Thank you in advance.

Let me add that sometimes the log includes also following lines:

2019-10-17 10:45:38.942273 [CRIT] google_glue.cpp:202 StreamingDetectIntentRequest finished with err lame client channel (2): 2019-10-17 10:45:38.942273 [DEBUG] google_glue.cpp:210 dialogflow read thread exiting 2019-10-17 10:45:38.942273 [DEBUG] google_glue.cpp:74 GStreamer::write not writing because we are finished, 0x7f624c001e90 2019-10-17 10:45:38.962254 [DEBUG] google_glue.cpp:74 GStreamer::write not writing because we are finished, 0x7f624c001e90
The log entry google_glue.cpp:74 GStreamer::write not writing because we are finished is generated till the call is disconnected.

I have resolved the issue, seems the FS didn't see the "GOOGLE_APPLICATION_CREDENTIALS" environmental variable when set from the console directly.

Editing the service file (/lib/systemd/system/freeswitch.service) did the trick.
Just add the line:
Environment="GOOGLE_APPLICATION_CREDENTIALS=/tmp/google_credentials.json"
under the [Service] section and after that reload the deamon configuration:
systemctl daemon-reload

yes, I always set the environment variables in the systemd service file