Skip to content

Commit

Permalink
Tidy up a few things we no longer need
Browse files Browse the repository at this point in the history
  • Loading branch information
lornajane committed Sep 13, 2018
1 parent 8b11711 commit 749bd4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
NEXMO_API_KEY=
NEXMO_API_SECRET=
NEXMO_APP_ID=
NEXMO_APP_FILE_NAME=
CALL_CENTER_NUMBER=
INBOUND_NUMBER_1=
INBOUND_NUMBER_2=
Expand Down
24 changes: 4 additions & 20 deletions lib/routes.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
// load environment variables
require('dotenv').config();

// initialize Nexmo with App credentials
var Nexmo = require('nexmo');
var nexmo = new Nexmo({
apiKey: process.env['NEXMO_API_KEY'],
apiSecret: process.env['NEXMO_API_SECRET'],
applicationId: process.env['NEXMO_APP_ID'],
privateKey: process.env['NEXMO_APP_FILE_NAME']
});

// Define the topics for the inbound numbers
var topics = {}
topics[process.env['INBOUND_NUMBER_1']] = 'the summer offer';
topics[process.env['INBOUND_NUMBER_2']] = 'the winter offer';

// Set an index for the current conference ID
var conferenceID = 0;

module.exports = function(app){

// Process an inbound call from an inbound call made to one of the two numbers
// we've set up
app.get('/answer', function(req, res) {
var answer_url = 'http://'+process.env['DOMAIN']+'/on-answer?conference_id='+conferenceID
console.log(answer_url);
var answer_url = 'http://'+process.env['DOMAIN']+'/on-answer'

res.json([
{
Expand All @@ -45,15 +32,12 @@ module.exports = function(app){

// Handle the call center answering the phone, prompt them with information
app.get('/on-answer', function(req, res) {
// we determine the topic of the call
// based on the inbound call number
// we determine the topic of the call based on the inbound call number
var topic = topics[req.query.from]

res.json([
// We first play back a little message
// telling the call center operator what
// the call regards to. This "whisper" can
// only be heard by the call center operator
// We first play back a little message telling the call center operator what
// the call relates to. This "whisper" can only be heard by the call center operator
{
"action": "talk",
"text": "Incoming call regarding "+topic
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"repository": "https://github.com/Nexmo/node-call-whispher",
"dependencies": {
"dotenv": "^4.0.0",
"express": "^4.14.1",
"nexmo": "^1.2.0"
"express": "^4.14.1"
},
"license": "MIT",
"devDependencies": {
Expand Down

0 comments on commit 749bd4f

Please sign in to comment.