Skip to content

Commit c5f0c18

Browse files
bharatmuralirobinskesnyk-bot
authored
Manifest and ivr app fixes (#147)
Co-authored-by: Kelley Robinson <[email protected]> Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Kelley Robinson <[email protected]> Co-authored-by: bharatmurali <[email protected]>
1 parent b3e1030 commit c5f0c18

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

video/.env

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# description: API key for your Twilio Account
22
# format: text
3-
# link: https://www.twilio.com/console/runtime/api-keys/create
3+
# link: https://www.twilio.com/console/project/api-keys
44
# required: true
55
API_KEY=
66

77
# description: API secret for your API Key
88
# format: secret
9-
# link: https://www.twilio.com/console/runtime/api-keys/create
9+
# link: https://www.twilio.com/console/project/api-keys
1010
# required: true
1111
API_SECRET=
1212

1313
# description: Passcode for your Video chat app
1414
# format: text
1515
# required: true
16-
PASSCODE=
16+
PASSCODE=

voice-ivr/.env

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# description: Your phone number
2+
# format: phone_number
3+
# required: true
4+
MY_PHONE_NUMBER=+12223334444
5+
16
# description: The path to the webhook
27
# configurable: false
3-
TWILIO_VOICE_WEBHOOK_URL=/voice-ivr
8+
TWILIO_VOICE_WEBHOOK_URL=/voice-ivr

voice-ivr/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In your `.env` file, set the following values:
1212

1313
| Variable | Description | Required |
1414
| :------- | :---------- | :------- |
15-
15+
MY_PHONE_NUMBER Your phone number true
1616

1717
### Function Parameters
1818

voice-ivr/functions/handle-user-input.protected.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ exports.handler = function (context, event, callback) {
4040

4141
switch (UserInput) {
4242
case '1':
43-
twiml.say(
44-
'You have not configured forwarding yet. Please find this section in your code and add a phone number'
45-
);
46-
//twiml.dial('+1222333444');
43+
twiml.say("Thank you. You will now be forwarded to our sales department.")
44+
twiml.dial(context.MY_PHONE_NUMBER);
4745
break;
4846
case '2':
4947
twiml.say('We are open from 9am to 5pm every day but Sunday.');

voice-ivr/tests/handle-user-input.test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const mockTwilioClient = {
1919

2020
const context = {
2121
getTwilioClient: () => mockTwilioClient,
22+
MY_PHONE_NUMBER: 'TwilioNumber'
2223
};
2324
const baseEvent = {
2425
From: '+12223334444',
@@ -54,7 +55,7 @@ describe('handles digit inputs', () => {
5455
const callback = (err, result) => {
5556
const twiml = result.toString();
5657
expect(twiml).toMatch(
57-
'<Response><Say>You have not configured forwarding yet. Please find this section in your code and add a phone number</Say></Response>'
58+
'<Response><Say>Thank you. You will now be forwarded to our sales department.</Say><Dial>' + context.MY_PHONE_NUMBER + '</Dial></Response>'
5859
);
5960
expect(mockTwilioClient.messages.create).not.toHaveBeenCalled();
6061
done();
@@ -121,7 +122,7 @@ describe('handles speech inputs', () => {
121122
const callback = (err, result) => {
122123
const twiml = result.toString();
123124
expect(twiml).toMatch(
124-
'<Response><Say>You have not configured forwarding yet. Please find this section in your code and add a phone number</Say></Response>'
125+
'<Response><Say>Thank you. You will now be forwarded to our sales department.</Say><Dial>' + context.MY_PHONE_NUMBER + '</Dial></Response>'
125126
);
126127
expect(mockTwilioClient.messages.create).not.toHaveBeenCalled();
127128
done();

0 commit comments

Comments
 (0)