NodeJS project to update Cisco Unity Call Handler's using Google's Cloud Text to Speech via Ngrok, Twilio and Weather.gov
Install nodemon globally
npm i nodemon -g
Install pm2 globally
sudo npm install pm2@latest -g
Install server and client dependencies
yarn
cd client
yarn
To start the server and client at the same time (from the root of the project).
yarn dev
In development mode a Ngrok tunnel will also be created to aid in development. Status of the tunnel can be view at:
Running the production build on localhost. This will create a production build, then Node will serve the app on http://localhost:8000. Note: PM2 needs to be installed.
NODE_ENV=production yarn dev:server
The key to using an Express backend with a project created with create-react-app
is on using a proxy. We have a proxy entry in client/package.json
. You may need to update this depending on your enviroment.
"proxy": "http://localhost:8000/"
This tells Webpack development server to proxy our API requests to our API server, given that our Express server is running on localhost:5000
- Create a project (or use an existing one) in the Cloud Console.
- Make sure that billing is enabled for your project.
- Enable the Text-to-Speech API.
- Create a Service Account.
- Download key. Select Project created in step 1, then Actions > Create Key.
- Using service account key, create enviromental variable. export GOOGLE_APPLICATION_CREDENTIALS="[PATH]/[FILE_NAME].json"
Optional ngrok settings
export NGROK_SUBDOMAIN='insert subdomain' export NGROK_AUTH_TOKEN='insert authtoken from ngrok.com'
View status at: http://localhost:4040/status
I'm using a droplet on DigitalOcean to connect to Cisco's DevNet sandbox. I wrote a script that uses openconnect to create a vpn tunnel to the sandbox. You'll need to edit the text file vpnmaker.txt with your creds.
Permissions:
chmod +x openconnect.sh
To run:
./openconnect -c 20160
To disconnect:
./openconnect -d
Visit my blog post entry for write up on application.
If you would like to support my work and the time I put in creating the code, you can click the image below to get me a coffee. I would really appreciate it (but is not required).
-Jeremy Worden