Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update victorops-twilio.js #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update victorops-twilio.js #28

wants to merge 3 commits into from

Conversation

cmillane
Copy link
Collaborator

Adjustments to accommodate Twilio's Dialverb changes. Also updated branding from VictorOps to Splunk On-Call

Adjustments to accommodate Twilio's Dialverb changes.  Also updated rebranding from VictorOps to Splunk On-Call
noTeam: (team) => `Team ${team} does not exist. Please contact your administrator to fix the problem.`
voCallNotAnswered: (caller) => `Missed call from ${caller}.`,
voCallCompleted: (user, caller, log) => `${user} answered a call from ${caller}. ${log}`,
noTeam: (team) => `Team ${team} does not exist. Please contact your administrator to fix the problem.`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra space

Copy link
Collaborator

@cphillips2 cphillips2 Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -544,7 +545,7 @@ function buildOnCallList (twiml, context, payload) {
// Creates a list of phone numbers based on the first 3 escalation policies
const escPolicyUrlArray = createEscPolicyUrls(context, teamsArray[0].slug);
const phoneNumberArray = escPolicyUrlArray.map(url => getPhoneNumbers(context, url, teamsArray[0].name, teamsArray[0].escPolicyName));

phoneNumberArray.length = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this, it was added so we wouldn't have to wait through multiple calls for testing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

const {callerId, firstCall, goToVM, phoneNumbers, teamsArray, voice} = payload;
let {detailedLog, realCallerId} = payload;
let phoneNumber;

let phoneNumber;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: trailing space

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

phoneNumber.phone
);
}
return postToVictorOps(event,context,payload);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
return postToVictorOps(event, context, payload);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

}
else{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
} else {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

detailedLog,
phoneNumber,
phoneNumbers,
realCallerId,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated realCallerId, delete second one

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

`${messages.attemptTranscription} ${messages.goodbye}`
);
if (DialCallStatus == 'completed' && DialBridged == 'true') {
return postToVictorOps(event,context,payload);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
return postToVictorOps(event, context, payload);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

);
if (DialCallStatus == 'completed' && DialBridged == 'true') {
return postToVictorOps(event,context,payload);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
} else {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

} else {
resolve('');
return;
}

//console.log(alert)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

{voice},
`${messages.attemptTranscription} ${messages.goodbye}`
);
if (DialCallStatus == 'completed' && DialBridged == 'true') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (DialCallStatus === 'completed' && DialBridged == 'true') {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using === prevents recovery alerts when the callee hangs up.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever gets the result we want :)

{voice},
`${messages.otherPartyDisconnect} ${messages.goodbye}`
);
resolve(DialCallStatus == 'completed' && TranscriptionStatus !== 'failed' ? twiml : '');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve(DialCallStatus === 'completed' && TranscriptionStatus !== 'failed' ? twiml : '');

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using === prevents recovery alerts when the callee hangs up.

cmillane added 2 commits July 8, 2021 09:46
Performed further testing and revised the code
Addresses Twilio's upcoming Dialverb changes, VOSE-1461, and VOSE-1463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants