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

Voice CreatePlaylist Interface #508

Merged
merged 5 commits into from
Apr 25, 2022

Conversation

edolix
Copy link
Contributor

@edolix edolix commented Apr 21, 2022

Same logic as #507 but for call.play() method

@changeset-bot
Copy link

changeset-bot bot commented Apr 21, 2022

🦋 Changeset detected

Latest commit: 1c3e6ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@sw-internal/playground-realtime-api Minor
@signalwire/core Minor
@signalwire/realtime-api Minor
@signalwire/js Patch
@signalwire/react-native Patch
@signalwire/web-api Patch
@signalwire/webrtc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@edolix edolix requested a review from framini April 22, 2022 08:29
Comment on lines 183 to 194
const playlist = client
.createPlaylist({ volume: 2 })
.playAudio({
url: 'https://cdn.signalwire.com/default-music/welcome.mp3',
})
.playSilence({
duration: 5,
})
.playTTS({
text: 'Thank you, you are now disconnected from the peer',
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be an option 3 (following the same ideas as in here):

option 3
 const playlist = client
    .new Playlist({ volume: 2 })
    .add({
      type: 'audio'
      url: 'https://cdn.signalwire.com/default-music/welcome.mp3',
    })
    .add({
      type: 'silence',
      duration: 5,
    })
    .add({
      type: 'tts',
      text: 'Thank you, you are now disconnected from the peer',
    })

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In 3c8358a i expose just createPlaylist on the Voice namespace.

I like the option 3 using .add() but we can add it later (?)

@edolix edolix changed the title WIP: Voice CreatePlaylist Interface Voice CreatePlaylist Interface Apr 22, 2022
@edolix edolix requested a review from framini April 22, 2022 11:31
@edolix edolix force-pushed the eg/rt-api-voice-playlist-interface branch from 78b0e9d to 1c3e6ff Compare April 25, 2022 08:01
@edolix
Copy link
Contributor Author

edolix commented Apr 25, 2022

Rebased

@edolix edolix merged commit 231a2ba into eg/rt-api-voice-namespace Apr 25, 2022
@edolix edolix deleted the eg/rt-api-voice-playlist-interface branch April 25, 2022 08:33
edolix added a commit that referenced this pull request May 2, 2022
* add createPlaylist and types

* update methods in Call and playground

* expose createPlaylist from the Voice namespace instead of the Client

* changeset

* move tests
edolix added a commit that referenced this pull request May 2, 2022
* Voice Inbound (#474)

* Add call answer and update Voice workers

* voice playground with ENVs

* remove call.state handle from playground

* improve types

* remove types for created/ended voice events

* add changeset

* type voice worker

* Realtime-API Voice Play Methods (#475)

* Voice call is not a BaseConsumer anymore

* add voice play types and split workers on different files

* add play method on Call

* [ot] fix jest warnings and use room_session instead of room from room.subscribed event

* realtime-api jest fixes

* test coverage for CallPlayback

* improve types and remove ts-x notations

* add derived methods

* changeset

* Proper typing for call.received and review VoiceClient (#476)

* fix import

* rename CallClient into VoiceClient

* types

* welcome AutoApplyTransformsConsumer

* move createCallObject to its own emitter transform

* Realtime-API Voice Record Methods (#478)

* add types

* CallRecording object

* add worker voiceCallRecordWorker

* implement record/recordAudio methods

* update playground example with record

* add changeset

* Realtime-API Voice Prompt Methods (#479)

* add prompt types

* CallPrompt object and specs

* add voiceCallPromptWorker

* add prompt method to Voice Call object

* improve CallPrompt public interface

* update playground with prompt example

* changeset

* passing tests

* add waitForResult in CallPrompt object

* Realtime-API Voice Tap Methods (#482)

* add types for tap

* CallTap obj and specs

* add voiceCallTapWorker

* implement tap/tapAudio methods on Voice Call

* changeset

* tweaks

* add derived prompt methods (#486)

* Realtime-API Voice Connect/Disconnect Methods (#485) (#488)

* add types for relay connect methods/events

* update toInternalDevices for sip case

* add voiceCallConnectWorker

* update voiceCallStateWorker to always dispatch an event and filter for state event by call_id

* add connect, disconnect and waitUntilConnected on the Call and provide a playground

* changeset

* move call.state listener on constructor

* Change params casing for Voice RPC methods (#489)

* add util for converting a record's props to snake_case

* export util from core

* update `record` method to use camelCase

* improve typings for toSnakeCaseProps

* rename function, update prompt method

* convert remaining prompt params

* use camelCase for devices and add conversion for the internal util

* convert digit props

* add util for checking typeof

* add ability to convert deeply nested arrays

* fix typeof

* fix condition

* remove need of the util

* Split state and Dial events (#493)

* rename var to match other workers

* split sagas into state and dial events

* wip for having the dialWorker handling dial events

* restore type

* remove call_state filter so the worker can update the instance with all the call.state events

* add ability to handle errors on dial, remove loop

* remove unused event

* remove handlers when the first event occurs

* type array

* remove unnecessary check

* New Workers API + removal of Synthetic events for dial/answer/hangup (#496)

* add new apis for handling workers

* wip for moving to the new api, remove synthetic events

* add option to skip caching the base instance

* remove last call of attachWorkers

* add dirty debugging files

* fix hangup logic

* add logs for callId/tag in voiceCallStateWorker

* do override for "tag" in calling.call.state" events

* kill the voiceCallStateWorker on ended

* prettier

* fix params access

* remove todos

* update comment in voiceCalStateWorker

* add comment on voiceCallPlayWorker

* remove commented import

* fix casing

* format comments

* add changeset

Co-authored-by: Edoardo Gallo <edo91.gallo@gmail.com>

* Calling sendDigits (#500)

* change signature for the onError

* add types for sendDigits

* add sendDigits method

* add changeset

* update error message

* update types to allow passing an initialState, filter by controlid

* pr feedback

* Voice CreateDialer Interface (#507)

* initial proposal for voice createDialer

* move createDialer from VoiceClient to an util - moved tests

* remove from client and update playground

* change dialX with addX

* changeset

* add method to dialPhone and dialSip directly

* update playground with examples

* Voice CreatePlaylist Interface (#508)

* add createPlaylist and types

* update methods in Call and playground

* expose createPlaylist from the Voice namespace instead of the Client

* changeset

* move tests

* Realtime-API Voice Detect Methods (#492)

* add types for detect

* CallDetect object

* add voiceCallDetectWorker

* initial implementation for voice call detect

* update detect method

* more detect types

* on vs once

* add waitForResult to Detect

* update voiceCallDetectWorker

* logger info to trace

* add trace debug on pubSubSaga

* make CallDetect work and expose Detector type

* update playground with detect

* derived methods for detect and snake_case vs camelCase params

* add method to call contract and update playground

* changeset

* update detect typing

* Migration to `runWorker` (#511)

* make api as internal

* move play to runWorker, fix play return type

* move record to runWorker

* move prompt to runWorker

* move tap to runWorker

* replace payload with initialState, change signature to give room for passing the params coming from the server

* move detect to runWorker

* move voiceCallReceiveWorker to runWorker

* add ability to pass custom types for worker hooks

* add proper typings to each of the onDone/onFail for all workers

* rollback changes for connect worker

* make generic optional for backwards compat

* prettier

* add changeset

* Add payload to `dial` failed (#514)

* split types for CallingCallDialEventParams

* export ToExternalJSONResult

* return error on dial.failed

* add changeset

* Update createDialer/createPlaylist Interface (#517)

* create Dialer class

* move implementation to use new Dialer()

* add Playlist object

* update implementation to use the new Playlist constructor

* changeset

* fix VoicePlaylist add signature

* Add method to wait playback ended events (#515)

* change on to once on CallPrompt

* add waitForEnded in CallPlayback

* dispatch proper event from worker to update CallPlayback

* update playground

* add changeset

* Update packages/realtime-api/src/voice/workers/voiceCallPlayWorker.ts

Co-authored-by: Francisco Ramini <framini@gmail.com>

Co-authored-by: Francisco Ramini <framini@gmail.com>

* E2E Voice (#519)

* add e2e for voice namespace

* update drone.yml

Co-authored-by: Edoardo Gallo <edo91.gallo@gmail.com>

* add refs to the PR discussion

* add comment about missing `tag` in some calling events

* add warnings for unknow Call device type

* add comment on calling.connect.connected event transform

Co-authored-by: Francisco Ramini <framini@gmail.com>
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.

2 participants