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

Split state and Dial events #493

Merged
merged 10 commits into from
Apr 11, 2022
Merged

Conversation

framini
Copy link
Contributor

@framini framini commented Apr 7, 2022

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Apr 7, 2022

⚠️ No Changeset found

Latest commit: 3b20341

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@framini framini changed the title WIP: Split state and Dial events Split state and Dial events Apr 8, 2022
@framini framini requested a review from edolix April 8, 2022 08:16
packages/realtime-api/src/voice/Call.ts Show resolved Hide resolved
this.callId = payload.call.call_id
this.nodeId = payload.node_id

resolve(this)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove the listener for SYNTHETIC_CALL_DIAL_FAILED_EVENT?

this.off(SYNTHETIC_CALL_DIAL_FAILED_EVENT, ..)

packages/realtime-api/src/voice/Call.ts Show resolved Hide resolved
SYNTHETIC_CALL_DIAL_FAILED_EVENT,
} from './'

const TARGET_DIAL_STATES = ['answered', 'failed']
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: can we type this array to be valid "CallingCallDial" states? I think we don't have that union type yet.

Comment on lines 32 to 37
// To avoid mixing events on `connect` we check for `instance.id`
// if there's already a callId value.
if (instance.id) {
return instance.id === action.payload.call?.call_id
}
return instance.tag === action.payload.tag
Copy link
Contributor

Choose a reason for hiding this comment

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

For the call.dial events, i think we could just check for tag.

The value of action.payload.call?.call_id will be the "answered" leg so the remote peer

@framini framini merged commit fa84d8c into eg/rt-api-voice-namespace Apr 11, 2022
@framini framini deleted the fr/dial-event branch April 11, 2022 08:00
framini added a commit that referenced this pull request Apr 14, 2022
* 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
framini added a commit that referenced this pull request Apr 20, 2022
* 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
framini added a commit that referenced this pull request Apr 20, 2022
* 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
edolix pushed a commit that referenced this pull request Apr 20, 2022
* 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
edolix pushed a commit that referenced this pull request May 2, 2022
* 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
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