-
Notifications
You must be signed in to change notification settings - Fork 10
CHI-3708: add recordingCompleteCallback scafold #4501
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
Draft
gpaoloni
wants to merge
19
commits into
master
Choose a base branch
from
CHI-3708
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d7ac2ae
chore: add recordingCompleteCallback scafold
gpaoloni 7ddc453
chore: expose route
gpaoloni dfc15e0
chore: create voicemail task
gpaoloni d7af718
chore: use voicemail task channel
gpaoloni ce94f7d
fix: remove explicit task queue
gpaoloni c398609
fix: stringify task attributes
gpaoloni ce4107c
chore: attach conversation media on contact creation
gpaoloni 5943e68
chore: debug
gpaoloni fe11565
fix: add customChannelType task attr
gpaoloni 132bb1e
fix: add channelType task attr
gpaoloni 44330aa
chore: add conversation media using dedicated endpoint
gpaoloni 212c57e
debug
gpaoloni 70b3c44
fix: path
gpaoloni e77ff0c
chore: add voicemail PoC UI
gpaoloni 20a6b76
fix: add attribute needed for task assignment
gpaoloni 5701a7b
fix: add attribute needed for task assignment
gpaoloni cf8cbf1
fix: canTransferConference only check for voice tasks
gpaoloni 43c9fc5
chore: routing attr
gpaoloni 887f814
Merge branch 'master' into CHI-3708
stephenhand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
lambdas/account-scoped/src/voicemail/recordingCompleteCallback.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /** | ||
| * Copyright (C) 2021-2023 Technology Matters | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published | ||
| * by the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see https://www.gnu.org/licenses/. | ||
| */ | ||
|
|
||
| import { getTwilioClient, getWorkspaceSid } from '@tech-matters/twilio-configuration'; | ||
| import { AccountScopedHandler, HttpError } from '../httpTypes'; | ||
| import { newOk, Result } from '../Result'; | ||
|
|
||
| export type RecordingCompleteCallbackRequestBody = { | ||
| callFrom: string; | ||
| }; | ||
|
|
||
| export const recordingCompleteCallback: AccountScopedHandler = async ( | ||
| { body }, | ||
| accountSid, | ||
| ): Promise<Result<HttpError, any>> => { | ||
| console.debug('recordingCompleteCallback body', JSON.stringify(body, null, 2)); | ||
| // const { callFrom } = body as RecordingCompleteCallbackRequestBody; | ||
|
|
||
| // if (!callFrom) { | ||
| // return newErr({ | ||
| // message: 'callFrom parameter is missing', | ||
| // error: { statusCode: 400 }, | ||
| // }); | ||
| // } | ||
|
|
||
| const twilioClient = await getTwilioClient(accountSid); | ||
|
|
||
| const workspaceSid = await getWorkspaceSid(accountSid); | ||
| const voicemailTask = await twilioClient.taskrouter.v1 | ||
| .workspaces(workspaceSid) | ||
| .tasks.create({ | ||
| timeout: 604800, // 7 days | ||
| attributes: JSON.stringify({ | ||
| ...(body.routingAttributes ? JSON.parse(body.routingAttributes) : {}), | ||
| isVoicemail: true, | ||
| callSid: body.callSid, | ||
| from: body.from, | ||
| name: body.from, | ||
| channelType: 'voicemail', | ||
| customChannelType: 'voicemail', | ||
| ignoreAgent: '', | ||
| transferTargetType: '', | ||
| }), | ||
| workflowSid: body.voicemailWorkflowSid, | ||
| // TODO: factor out channel types into an enum | ||
| taskChannel: 'voicemail', | ||
| }); | ||
|
|
||
| return newOk({ voicemailTask }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
plugin-hrm-form/src/components/common/icons/VoicemailIcon.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /** | ||
| * Copyright (C) 2021-2023 Technology Matters | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published | ||
| * by the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see https://www.gnu.org/licenses/. | ||
| */ | ||
|
|
||
| /* eslint-disable react/prop-types */ | ||
| import React from 'react'; | ||
|
|
||
| type Props = { | ||
| width: string; | ||
| height: string; | ||
| color?: string; | ||
| }; | ||
| /* eslint-disable react/prop-types */ | ||
| const VoicemailIcon: React.FC<Props> = ({ width, height, color }) => { | ||
| return ( | ||
| // <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> | ||
| <svg width={width} height={height} viewBox="0 0 48 48" fill={color} version="1.1" aria-label="Voicemail"> | ||
| <path d="M0 0h24v24H0z" fill="none" /> | ||
| <path d="M18.5 6C15.46 6 13 8.46 13 11.5c0 1.33.47 2.55 1.26 3.5H9.74c.79-.95 1.26-2.17 1.26-3.5C11 8.46 8.54 6 5.5 6S0 8.46 0 11.5 2.46 17 5.5 17h13c3.04 0 5.5-2.46 5.5-5.5S21.54 6 18.5 6zm-13 9C3.57 15 2 13.43 2 11.5S3.57 8 5.5 8 9 9.57 9 11.5 7.43 15 5.5 15zm13 0c-1.93 0-3.5-1.57-3.5-3.5S16.57 8 18.5 8 22 9.57 22 11.5 20.43 15 18.5 15z" /> | ||
| </svg> | ||
| ); | ||
| }; | ||
|
|
||
| VoicemailIcon.displayName = 'VoicemailIcon'; | ||
| VoicemailIcon.defaultProps = { | ||
| color: '#00C300', | ||
| }; | ||
| export default VoicemailIcon; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we attempt to consolidate setting recordings on the backend instead of having this as a special case for the productionising step?