Skip to content

Commit 4f05970

Browse files
committed
Adding in notification when a line is busy, failed or no-answer
1 parent dc8b4dd commit 4f05970

File tree

7 files changed

+29
-8
lines changed

7 files changed

+29
-8
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "plugin-outbound-dialing-with-conference",
33
"description": "Example front end implementation of a dialpad that creates outbound calls via a voice sdk and sends call to worker via task router",
4-
"version": "1.2.3",
4+
"version": "1.2.4",
55
"author": "Jared Hunter <jhunter@twilio.com>",
66
"private": true,
77
"scripts": {

public/plugins.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"name": "OutboundDialingWithConferencePlugin",
4-
"version": "1.2.3",
4+
"version": "1.2.4",
55
"class": "OutboundDialingWithConferencePlugin",
66
"requires": [
77
{

public/plugins.local.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"name": "OutboundDialingWithConferencePlugin",
4-
"version": "1.2.3",
4+
"version": "1.2.4",
55
"class": "OutboundDialingWithConferencePlugin",
66
"requires": [
77
{

src/components/dialpad/DialPadLauncher.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DialPadDialog extends React.Component {
3636

3737

3838
componentDidMount() {
39-
console.log("OUTBOUND DIALPAD: Mounting DialPadLauncher v1.2.3");
39+
console.log("OUTBOUND DIALPAD: Mounting DialPadLauncher v1.2.4");
4040
this.initSyncListener();
4141
}
4242

@@ -131,6 +131,11 @@ class DialPadDialog extends React.Component {
131131
this.setAgentAvailable().then(() => closeDialpad()).catch(() => closeDialpad());
132132
} else if (CallStatus.isTerminalState(call)) {
133133
console.log("OUTBOUND DIALPAD: Call Status Update Terminal State");
134+
if (CallStatus.isExceptionState(call)) {
135+
Notifications.showNotification("UnableToConnect", {
136+
message: call.callStatus
137+
});
138+
}
134139
// any termination state will reset the sync doc
135140
// and make sure the dialpad isnt ringing
136141
RingingService.stopRinging();

src/notifications/CustomNotifications.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,15 @@ if (!manager.strings.cantCloseDialpad) {
5151
content: "cantCloseDialpad",
5252
type: NotificationType.warning
5353
});
54+
}
55+
56+
if (!manager.strings.unableToConnect) {
57+
manager.strings.unableToConnect = "The number you are dialing responded with: {{message}}";
58+
59+
Notifications.registerNotification({
60+
id: "UnableToConnect",
61+
content: "unableToConnect",
62+
type: NotificationType.warning,
63+
timeout: 6000
64+
});
5465
}

src/utilities/DialPadUtil.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,19 @@ class CallControlsClass {
9090

9191
class CallStatusClass {
9292

93-
isTerminalState(call) {
94-
return (call && (call.callStatus === "completed" ||
95-
call.callStatus === "canceled" ||
93+
isExceptionState(call) {
94+
return (call && (
9695
call.callStatus === "failed" ||
9796
call.callStatus === "busy" ||
9897
call.callStatus === "no-answer")) ? true : false
9998
}
10099

100+
isTerminalState(call) {
101+
return (call && (call.callStatus === "completed" ||
102+
call.callStatus === "canceled" ||
103+
this.isExceptionState(call))) ? true : false
104+
}
105+
101106
// canDial includes an empty callStatus and is distinct with isTermanlState
102107
// isTerminalState is used to determine if syncDoc should be updated
103108
// it needs to exclude the end state or it will peruputally update itself

0 commit comments

Comments
 (0)