Assisted transfer flow
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
public
readme_images
views
.editorconfig
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
ISSUE_TEMPLATE.md
LICENSE
PULLREQUEST.md
PULL_REQUEST_TEMPLATE.md
Procfile
README.md
app.json
index.js
models.js
package.json
yarn.lock

README.md

Business Grade Assisted Transfer App

This application is outdated, but will be updated soon!

This example app shows how you can use the Conference feature on the App Platform for an assisted transfer use-case. In this flow, there are 2 Agents and 1 contact. The system calls out to a contact and adds them into a conference. Then 'Agent 1' is added in, this is one of your call center agents, maybe a real-estate agent or a help desk. Once Agent 1 and the contact are connected, Agent 1 selects the number for another agent, 'Agent 2', and they are added into the conference. Agent 1 can now drop while Agent 2 and the contact continue the discussion.

Demos the:

Deploy

Prerequisites

Deploy To PaaS

Env Variables Required To Run

  • CATAPULT_USER_ID
  • CATAPULT_API_TOKEN
  • CATAPULT_API_SECRET
  • PHONE_NUMBER (your number for incoming calls, your cell phone for example)

Deploy

Demo

Screen Shot Open the app in web browser. You will see phone numbers list (you should fill it first) to make call and recorded calls (if they exist).

All recorded voice messages for agents you can find on http://<your-site>/voiceMessages/<agent-phone-number>.

How it works

Basic Flow Chart

Create Call to Owner and set callback URL for events

yield Call.create({
  from: this.servicePhoneNumber,
  to: process.env.PHONE_NUMBER,
  callbackUrl: "http://" + this.req.headers.host + "/called-to-owner"
});

Speak Sentence then Create Bridge and set callbackURL for conference related events

yield call.speakSentence("Welcome to the conference");
router.call = call;
yield Conference.create({
  from: this.servicePhoneNumber,
  callbackUrl: "http://" + this.req.headers.host + "/conference-callback"
});

Add Member to conference then create new call to agent with recordingEnabled

router.conference = new catapult.Conference();
router.conference.id = ev.conferenceId;
router.conference.client = new catapult.Client();
router.conferenceMember = yield router.conference.createMember({callId: router.call.id});
yield Call.create({
  from: this.servicePhoneNumber,
  to: router.contactPhoneNumber,
  recordingEnabled: true,
  callbackUrl: "http://" + this.req.headers.host + "/called-to-contact"
});

Add first agent to the conference

yield router.conference.createMember({callId: ev.callId});

2nd Agent is requested to join call and callbackURL is set for events

yield Call.create({
  from: this.servicePhoneNumber,
  to: phoneNumber,
  callbackUrl: "http://" + this.req.headers.host + "/called-to-agent"
});

After 2nd Agent Answers, create gather

yield call.createGather("Agent from " + process.env.PHONE_NUMBER + " would like to join you to the conference. Press 1 to accept, Press 2 to decline.");

Run some logic on the gathered digits, hangup if press 2.

if(ev.digits[0] === "1"){
  if(router.conference){
    yield router.conference.createMember({callId: ev.callId});
  }
}
if(ev.digits[0] === "2"){
  yield call.hangUp();
}

At hangup, create gather to either speak Sentence or play message

if(router.agentPhoneNumber){
  yield router.conferenceMember.update({hold: true});
  if(ev.digits[0] === "1"){
    yield call.speakSentence("Leave you message after signal. Press # to complete recording.", "start-recording-message");
  }
  if(ev.digits[0] === "2"){
    debug("Play voice messages");
    yield playVoiceMessage();
  }
}

Install

Before running export next environment variables :

PHONE_NUMBER - your phone number for incoming calls,

CATAPULT_USER_ID, CATAPULT_API_TOKEN, CATAPULT_API_TOKEN - auth data for Catapult API (to search and reserve a phone number, etc)

After that run npm install to install dependencies.

You can run this demo like node index.js on local machine if you have ability to handle external requests or use any external hosting.

Deploy on Heroku Manually

Create account on Heroku and install Heroku Toolbel if need.

Run heroku create to create new app on Heroku and link it with current project.

Run heroku addons:create mongolab to add mongodb support.

Configure the app by commands

 heroku config:set PHONE_NUMBER=your-number
 heroku config:set CATAPULT_USER_ID=your-user-id
 heroku config:set CATAPULT_API_TOKEN=your-token
 heroku config:set CATAPULT_API_SECRET=your-secret

Run git push heroku master to deploy this project.

Run heroku open to see home page of the app in the browser