This repository demonstrates some of the possible capabilities of Twilio while building a Click-To-Call feature.
see package.json
for current version of node/npm.
- Copy
.example.env
to.env
and change values npm install
node app.js
- https://www.twilio.com/docs/api/voice/making-calls
- https://elements.heroku.com/buttons/heroku-examples/node-websockets
- https://www.twilio.com/docs/tutorials/automated-survey-node-express#what-we-will-learn
- https://www.twilio.com/docs/tutorials/dynamic-call-center-node-express
- https://www.twilio.com/studio#request-access
- https://networktest.twilio.com/
- http://www.mathguide.de/info/tools/languagecode.html
Use console.log(message)
throughout the application
heroku logs -a ctc-poc -t
Are you using a bash shell? Use echo $SHELL to find out. For a bash shell, using the Gmail example, edit the ~/.bashrc or ~/.bashprofile file and add:
export TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxx
export TWILIO_AUTH_TOKEN=yyyyyyyyyyyyyyyyy
export TWILIO_NUMBER=+15556667777
Are you using Windows or Linux? You can learn more about how to set variables here.
Getting your local environment setup to work with this app is easy. After you configure your app with the steps above use this guide to get it going locally.
- Install the dependencies.
npm install
- Launch local development webserver.
node app.js
-
Open browser to http://localhost:3000.
-
Tweak away on
routes/index.js
.
Given some phone number connected to some TwiML Bin like:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman" language="fr">Chapeau!</Say>
<Dial timeout="10">
<Client>directdial</Client>
</Dial>
<Say voice="woman" language="fr">Chapeau! 2</Say>
</Response>
Calling the number will dial an agent named directdial
.
main files:
routes/token.js
: acquire twilio client token for softphonepublic/agent.js
: client side agent experience functionalityviews/agent.jade
: client side agent experience view
This application is a modification of an application example implementing Click To Call using Twilio created by Twilio Developer Education. No warranty expressed or implied. Software is as is.
This software is licensed under the MIT License.
For further information on the original source, please see the following resources:
following Adding React to an Existing Application
new tooling
- react & react-dom – react itself
- babel – copmiles all js for common compatibility
- webpack – assembles all js & css into bundles
- bootstrap – to look as good as the old stuff, but be bundled; build config docs
deploy: git push -f heroku ${my_branch}:master
view logs: heroku logs -a ctc-poc -t
preliminary checks:
- assert customer phone
- assert no incomplete tasks exist in Twilio Task Router
- open two tabs with developer consoles:
- in the agent experience tab: become ready to handle callbacks
- login as
agent
- ensure work activity is
Idle
- login as
- in the customer experience tab: request callback
- fill out form describing issue & customer DID
- submit form
- observe confirmation of call request
- in the agent experience tab: handle callback
- observe incoming call with data from customer form
- observe outgoing softphone call to customer; ring … ring …
- observe ringing on customer phone from twilio number
- answer customer phone [ ] observe call recording warning
- make noise in customer phone [ ] observe noise from agent soft-phone
- in the agent experience tab
- observe call recording warning
- observe noise from customer phone
- make noise in agent soft-phone
- end call: two scenarios: customer or agent termination
- in agent experience: observe clear softphone
post checks
- observe no errors or warning from Twilio Debugger
- observe no errors in developer console in any open tabls