drachtio / drachtio-freeswitch-modules

A collection of open-sourced freeswitch modules that I use in various drachtio applications
MIT License
176 stars 119 forks source link

[mod_dialogflow] Question about multiple GOOGLE_APPLICATION_CREDENTIALS #34

Closed ruipfmendes closed 4 years ago

ruipfmendes commented 4 years ago

Hello!

I have a quick question regarding mod_dialogflow and credentials I'm looking to have a Freeswitch instance serving multiple Dialogflow accounts (imagine two different users giving me credentials). One of the use cases is that these two clients may call concurrently. Is there another way other than setting a global ENV VAR?

I noticed this when I dove into the code: "missing credentials: GOOGLE_APPLICATION_CREDENTIALS must be suuplied either as an env variable (path to file) or a channel variable (json string)\n" Is it possible that, in the drachtio application, when I receive a call I check which user is calling and then call FreeSWITCH API command uuid_set_var to add the channel variable "GOOGLE_APPLICATION_CREDENTIALS" with the corresponding service account json?

davehorton commented 4 years ago

yes, you can do exactly that. Have a look here for an example

ruipfmendes commented 4 years ago

Great! Thanks again for the help! 😀