0

I'm trying to use this dialpad plugin for Twilio Flex to make phone calls. I'm newbie on this so maybe I'm forgetting something to do in the process. I will detail the steps I made:

git clone https://github.com/lehel-twilio/plugin-dialpad.git
npm install
cp public/appConfig.example.js public/appConfig.js

appConfig.js file code:

// your account sid
var accountSid = 'ACXXxxxxXXXXxxxxxxXXXXXXxxxx35'; //my accountSid

// set to /plugins.json for local dev
// set to /plugins.local.build.json for testing your build
// set to "" for the default live plugin loader

var pluginServiceUrl = '/plugins.json';

var appConfig = {
  pluginService: {
     enabled: true,
     url: pluginServiceUrl,
  },
  sso: {
    accountSid: accountSid
  },
  ytica: false,
  logLevel: 'debug',
  showSupervisorDesktopView: true,
};

I deploy functions according to github docs: Hold Call (/hold-call), Create New Task (/create-new-task), Cleanup Rejected Task (/cleanup-rejected-task), Flex Dialpad Add Conference Participant (/add-conference-participant)

enter image description here

According to plugin-dialpad documentation, all these functions have the option Check for valid Twilio signature unchecked:

enter image description here

Configuring Functions :

enter image description here

Task channel 'custom1' is created:

enter image description here

I added my phone number as an attribute value to every Worker:

enter image description here

And finally, I added the filter:

enter image description here

At the beginning it displayed this error when I tried to make a phone call:

enter image description here

I could fix it applying CORS headers in Create New Task function which It's showing the error, I changed this line: "Access-Control-Allow-Origin":"https://flex.twilio.com":

enter image description here

But now it shows me an error in dialpad-plugin.js and I still can't make phone calls:

enter image description here

  • Flex version 1.11.1 (same happens with 1.10.0)
  • plugin-dialpad version 4.0

How can I fix it? I'd like your help.

NekoLopez
  • 579
  • 1
  • 9
  • 28

2 Answers2

1

Are you sure you created the function as details in the github repo? For example, the create-new-task function looks very different then what you posted.

https://github.com/lehel-twilio/plugin-dialpad/blob/master/src/functions/create-new-task.js

All the functions are located here: https://github.com/lehel-twilio/plugin-dialpad/tree/master/src/functions

Alan
  • 10,465
  • 2
  • 8
  • 9
  • Yes! You were right, I had to create all the functions according to functions folder, but now when I want to make a phone call it shows an error on Twilio debugger: `Got HTTP 500 response from https://*****.twil.io/call-outbound-join Error: 'From' phone number not verified`. How can I fix it? – NekoLopez Jul 12 '19 at 18:35
  • You can login into the Twilio Console and in the upper right corner, search on Verified Caller ID and follow the process. Trial accounts have certain restrictions, where you only call a Verified Caller ID in your account. You can only use a Verified CallerID or a Twilio Number in your account as the CallerID in an upgraded account. Also, make sure geographic permissions allow calling the countries you intend to call. – Alan Jul 13 '19 at 19:15
0

Ok, finally I could fix my problem.

First, I had to create Twilio functions according to github: https://github.com/lehel-twilio/plugin-dialpad/tree/master/src/functions

After that, when I make a phone call it's showing me an error message on Twilio Debugger: Got HTTP 500 response from https://*****.twil.io/call-outbound-join Error: 'From' phone number not verified.

My Twilio Phone Number is from another country, so I fixed adding this additional code on "Create New Task" function which allows so add "+" sign automatically:

const numbx = "+" + event.From; const wnumbx = numbx.replace(/\s/g,'');
console.log(wnumbx); const numbt = "+" + event.To; const wnumbt = 
numbt.replace(/\s/g,''); console.log(wnumbt);

client.taskrouter.workspaces(workspace) .tasks .create( { attributes: JSON.stringify( { to: wnumbt, direction: 'outbound', name: 'MY COMPANY', from: wnumbx,...

This is not necessary on Twilio phone numbers of US.

NekoLopez
  • 579
  • 1
  • 9
  • 28