All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
- Updated dependencies [
45991e4c
,e16ec479
,968d226b
,ded3dc7a
,0f4f2b3c
,254016f3
,c370fec8
,3d20672b
,3d6a4fbe
,184c8777
,c8deacef
,229320b3
,d215ef5d
,a08512a3
,6d71362b
]:- @signalwire/[email protected]
-
#881
b39b82fe
Thanks @iAmmar7! - New interface for Voice APIsThe new interface contains a single SW client with Chat and PubSub namespaces
import { SignalWire } from '@signalwire/realtime-api' (async () => { const client = await SignalWire({ host: process.env.HOST, project: process.env.PROJECT, token: process.env.TOKEN, }) const unsubVoiceOffice = await client.voice.listen({ topics: ['office'], onCallReceived: async (call) => { try { await call.answer() const unsubCall = await call.listen({ onStateChanged: (call) => {}, onPlaybackUpdated: (playback) => {}, onRecordingStarted: (recording) => {}, onCollectInputStarted: (collect) => {}, onDetectStarted: (detect) => {}, onTapStarted: (tap) => {}, onPromptEnded: (prompt) => {} // ... more call listeners can be attached here }) // ... await unsubCall() } catch (error) { console.error('Error answering inbound call', error) } } }) const call = await client.voice.dialPhone({ to: process.env.VOICE_DIAL_TO_NUMBER as string, from: process.env.VOICE_DIAL_FROM_NUMBER as string, timeout: 30, listen: { onStateChanged: async (call) => { // When call ends; unsubscribe all listeners and disconnect the client if (call.state === 'ended') { await unsubVoiceOffice() await unsubVoiceHome() await unsubPlay() client.disconnect() } }, onPlaybackStarted: (playback) => {}, }, }) const unsubCall = await call.listen({ onPlaybackStarted: (playback) => {}, onPlaybackEnded: (playback) => { // This will never run since we unsubscribe this listener before the playback stops }, }) // Play an audio const play = await call.playAudio({ url: 'https://cdn.signalwire.com/default-music/welcome.mp3', listen: { onStarted: async (playback) => { await unsubCall() await play.stop() }, }, }) const unsubPlay = await play.listen({ onStarted: (playback) => { // This will never run since this listener is attached after the call.play has started }, onEnded: async (playback) => { await call.hangup() }, }) })
-
#881
b39b82fe
Thanks @iAmmar7! - - New interface for the realtime-api Video SDK.- Listen function with video, room, playback, recording, and stream objects.
- Listen param with
room.play
,room.startRecording
, androom.startStream
functions. - Decorated promise for
room.play
,room.startRecording
, androom.startStream
functions.
import { SignalWire } from '@signalwire/realtime-api' const client = await SignalWire({ project, token }) const unsub = await client.video.listen({ onRoomStarted: async (roomSession) => { console.log('room session started', roomSession) await roomSession.listen({ onPlaybackStarted: (playback) => { console.log('plyaback started', playback) }, }) // Promise resolves when playback ends. await roomSession.play({ url: 'http://.....', listen: { onEnded: () => {} }, }) }, onRoomEnded: (roomSession) => { console.log('room session ended', roomSession) }, })
-
#881
b39b82fe
Thanks @iAmmar7! - New interface for PubSub and Chat APIsThe new interface contains a single SW client with Chat and PubSub namespaces
import { SignalWire } from '@signalwire/realtime-api' ;(async () => { const client = await SignalWire({ host: process.env.HOST, project: process.env.PROJECT, token: process.env.TOKEN, }) // Attach pubSub listeners const unsubHomePubSubListener = await client.pubSub.listen({ channels: ['home'], onMessageReceived: (message) => { console.log('Message received under the "home" channel', message) }, }) // Publish on home channel await client.pubSub.publish({ content: 'Hello There', channel: 'home', meta: { fooId: 'randomValue', }, }) // Attach chat listeners const unsubOfficeChatListener = await client.chat.listen({ channels: ['office'], onMessageReceived: (message) => { console.log('Message received on "office" channel', message) }, onMemberJoined: (member) => { console.log('Member joined on "office" channel', member) }, onMemberUpdated: (member) => { console.log('Member updated on "office" channel', member) }, onMemberLeft: (member) => { console.log('Member left on "office" channel', member) }, }) // Publish a chat message on the office channel const pubRes = await client.chat.publish({ content: 'Hello There', channel: 'office', }) // Get channel messages const messagesResult = await client.chat.getMessages({ channel: 'office', }) // Get channel members const getMembersResult = await client.chat.getMembers({ channel: 'office' }) // Unsubscribe pubSub listener await unsubHomePubSubListener() // Unsubscribe chat listener await unsubOfficeChatListener() // Disconnect the client client.disconnect() })()
-
#881
b39b82fe
Thanks @iAmmar7! - New interface for the Messaging APIThe new interface contains a single SW client with Messaging namespace
const client = await SignalWire({ host: process.env.HOST || 'relay.swire.io', project: process.env.PROJECT as string, token: process.env.TOKEN as string, }) const unsubOfficeListener = await client.messaging.listen({ topics: ['office'], onMessageReceived: (payload) => { console.log('Message received under "office" context', payload) }, onMessageUpdated: (payload) => { console.log('Message updated under "office" context', payload) }, }) try { const response = await client.messaging.send({ from: process.env.FROM_NUMBER_MSG as string, to: process.env.TO_NUMBER_MSG as string, body: 'Hello World!', context: 'office', }) await client.messaging.send({ from: process.env.FROM_NUMBER_MSG as string, to: process.env.TO_NUMBER_MSG as string, body: 'Hello John Doe!', }) } catch (error) { console.log('>> send error', error) }
-
#881
b39b82fe
Thanks @iAmmar7! - Decorated promise for the following APIs:- call.play()
- call.playAudio()
- call.playSilence()
- call.playRingtone()
- call.playTTS()
- call.record()
- call.recordAudio()
- call.prompt()
- call.promptAudio()
- call.promptRingtone()
- call.promptTTS()
- call.tap()
- call.tapAudio()
- call.detect()
- call.amd()
- call.detectFax()
- call.detectDigit
- call.collect()
Playback example 1 - Not resolving promise
const play = call.playAudio({ url: '...' }) await play.id
Playback example 2 - Resolving promise when playback starts
const play = await call.playAudio({ url: '...' }).onStarted() play.id
Playback example 3 - Resolving promise when playback ends
const play = await call.playAudio({ url: '...' }).onEnded() play.id
Playback example 4 - Resolving promise when playback ends - Default behavior
const play = await call.playAudio({ url: '...' }) play.id
All the other APIs work in a similar way.
- call.play()
-
#881
b39b82fe
Thanks @iAmmar7! - Task namespace with new interface
-
#881
b39b82fe
Thanks @iAmmar7! - FixonStarted
function in decorated promises -
#945
300f242e
Thanks @iAmmar7! - Fix tap.started event on Tap instance -
#943
8335cdf3
Thanks @iAmmar7! - Add missing getter for member current position -
#942
cdb4b202
Thanks @iAmmar7! - Bug fix for playback/recording/stream listeners -
Updated dependencies [
03f01c36
,b39b82fe
,6cb639bf
,b39b82fe
,b39b82fe
,b39b82fe
,b39b82fe
,b39b82fe
]:- @signalwire/[email protected]
- #873
6c9d2aa5
Thanks @iAmmar7! - Introduce the hand raise API for the Video SDKs (browser and realtime-api)
- #892
d564c379
Thanks @ayeminag! - - Addedstate
param toCallingCallCollectEventParams
- Made sure
voiceCallCollectWorker
doesn't clean upCallCollect
instance and emitended
/failed
event if thestate
is"collecting"
- Resolve
CallCollect.ended()
promise only whenstate
is NOT"collecting"
ANDfinal
is eitherundefined
/true
ANDresult.type
is one ofENDED_STATES
- Added more test cases for
Call.collect()
in@sw-internal/e2e-realtime-api
- Made sure
- Updated dependencies [
d564c379
,4ee7b6f8
,6c9d2aa5
]:- @signalwire/[email protected]
- Updated dependencies [
e5db7cab
,bcced8ae
,2131bb41
]:- @signalwire/[email protected]
-
#866
1086a1b0
- ExposedetectInterruptions
params for detect methods and handlebeep
in the detect events -
#862
2a9b88d9
- Add a newresult
getter toCallDetect
to retrieve the result of the detector. -
#863
fb45dce7
- Add support for CallRecordingpause()
andresume()
-
#853
5e1ff117
- Enhance shared function between realtime and browser SDK -
#853
5e1ff117
- Introduce the session emitter and eliminate the global emitter -
#853
5e1ff117
- Cleanup the SDK by removing eventsPrefix from the namespaces -
#853
5e1ff117
- Attach listeners without the namespace prefix -
#853
5e1ff117
- Cleanup the SDK by removing applyEmitterTransform -
#853
5e1ff117
- Remove event emitter transform pipeline from browser SDK
- Updated dependencies [
5e1ff117
,5e1ff117
,1086a1b0
,be17e614
,5e1ff117
,5e1ff117
,5e1ff117
,5e1ff117
,fb45dce7
,2a9b88d9
,5e1ff117
,5e1ff117
,e5db0ef9
]:- @signalwire/[email protected]
- Updated dependencies [
bb50b2fb
]:- @signalwire/[email protected]
- Updated dependencies [
af7072b7
]:- @signalwire/[email protected]
- Updated dependencies [
81beb29a
]:- @signalwire/[email protected]
- Updated dependencies [
b44bd6fb
,6a35f0a3
,65b0eea5
]:- @signalwire/[email protected]
- Updated dependencies [
f814685b
,e8141c0e
,4e1116b6
]:- @signalwire/[email protected]
-
#776
602921a6
- Handle failed state forcall.connect
events. -
#776
602921a6
- Return RoomSessionMember object instead of plain Member object.
- Updated dependencies [
602921a6
,602921a6
,9fd8f9cb
,aaa07479
,602921a6
,f3711f17
,602921a6
,602921a6
,602921a6
]:- @signalwire/[email protected]
- Updated dependencies [
aa31e1a0
,4e8e5b0d
,9fb4e5f4
]:- @signalwire/[email protected]
- Updated dependencies [
e299b048
]:- @signalwire/[email protected]
-
#738
ba39c819
- Remove executeActionWatcher and related functions. -
#664
bc56cc42
- Expose theroom.audience_count
event on the RoomSession.
- Updated dependencies [
bc56cc42
,ba39c819
,bc56cc42
,bc56cc42
,ba39c819
,688306f4
,bc56cc42
,ba39c819
,bc56cc42
,bc56cc42
,bc56cc42
,ba39c819
]:- @signalwire/[email protected]
-
#732
9ad158b9
- Emitplayback.failed
event on playback failure Resolve the playback.ended()
promise in case of Playback failure Resolve the playback.ended()
promise in case of Prompt failure Resolve the playback.ended()
promise in case of Recording failure Resolve the playback.ended()
promise in case of Detect failure Resolve the playback.ended()
promise in case of Collect failure Resolve the playback.ended()
promise in case of Tap failure -
#750
fe3b0e29
- Fix bug between getRoomSessions and nested objects in the Video client. -
#711
45536d5f
- Fix error on exposing thestate
property on the Voice Call object.
- Updated dependencies [
41482813
,a937768a
,5b002eab
,bbb9544c
,45536d5f
,95325ec9
,bb216980
,9ad158b9
,0bdda948
,e1e1e336
,55a309f8
,e2c475a7
]:- @signalwire/[email protected]
- Updated dependencies [
583ef730
,3e7ce646
,c82e6576
,a32413d8
,aa5a469c
]:- @signalwire/[email protected]
- #657
50f2e07f
- Hotfix forgetRecordings
,getPlaybacks
andgetStreams
return objects without room_session_id.
- Updated dependencies [
b765449b
,021d9b83
,e3453977
,be8b8dea
]:- @signalwire/[email protected]
- Updated dependencies [
569213c8
,6cf01e1c
,577e81d3
,0e7bffdd
,f1102bb6
,5c3abab6
,577e81d3
,c00b343e
]:- @signalwire/[email protected]
- #615
7b196107
- Expose.disconnect()
method on all the client namespaces: Video, Chat, PubSub, Task, Voice and Messaging.
- #619
d7ce34d3
- Add methods to manage a RoomSession and Membermeta
:updateMeta
,deleteMeta
,setMemberMeta
,updateMemberMeta
,deleteMemberMeta
.
-
#610
eb1c3fe9
- Updated interfaces to match the spec, updateRoomSession.getRecordings
andRoomSession.getPlaybacks
to return stateful objects, deprecatedRoomSession.members
andRoomSession.recordings
in favour of their corresponding getters. -
#601
d8cf078c
- [internal] Updated internals to support ignoring methods coming fromcore
.
- #607
f421f92a
- removeupdateToken
andsession.expiring
event from realtime-api Chat and PubSub namespaces.
- Updated dependencies [
3d202275
,9a6936e6
,fa62d67f
,d8cf078c
,d7ce34d3
,5402ffcf
,2f909c9e
,eb1c3fe9
,7b196107
,7bdd7ab0
,81503784
,819a6772
,4e2284d6
]:- @signalwire/[email protected]
- Updated dependencies [
6bc89d81
]:- @signalwire/[email protected]
- Updated dependencies [
8ec914b6
,9e1bf9d8
,9eb9851f
,bbc21e43
,d308daf8
]:- @signalwire/[email protected]
- #580
e8a54a63
- ExposegetRoomSessions()
andgetRoomSessionById()
on the VideoClient to retrieve in-progress RoomSession objects.
- Updated dependencies [
e8a54a63
,f15032f1
,14c08b89
,b168fc4f
]:- @signalwire/[email protected]
- Updated dependencies [
02d97ded
]:- @signalwire/[email protected]
-
#542
875b2bb8
- AddlayoutName
to the RoomSession interface. -
#546
fc4689df
- Internal changes to migrate fromsetWorker
/attachWorker
torunWorkers
and frompayload
toinitialState
.
- Updated dependencies [
875b2bb8
,fc4689df
,1b95b93b
]:- @signalwire/[email protected]
- #477
c6beec6d
- AddwaitForEnded()
method to the CallPlayback component to easily wait for playbacks to end.
- #539
4c0909dd
- Rename Call methodwaitUntilConnected
towaitForDisconnected
and exposedisconnect
on the VoiceClient
-
#477
c6beec6d
- Add ability to return the payload when the dial fails. -
#531
9e6ad45f
- Fix issue withCall.connect
and inbound calls.
- #529
e09afd5b
- Renamed Dialer to DeviceBuilder, added ability to passregion
todialPhone
anddialSip
.
- Updated dependencies [
f89b8848
,c6beec6d
,c6beec6d
,a0b7b4d0
,c6beec6d
,0b98a9e4
,f69ef584
,c02b694e
,c6beec6d
,c6beec6d
,5c96bf85
,c6beec6d
,c6beec6d
,05bb3c31
,c6beec6d
,12c64580
,c6beec6d
,24ef812a
,cf845603
,7e64fb28
,76e92dd9
,c6beec6d
,b36970ac
,c6beec6d
,c6beec6d
,c6beec6d
,c6beec6d
,b6d5bb3b
,61838b07
,6ebf3f64
,c6beec6d
,c6beec6d
,e09afd5b
,4c0909dd
]:- @signalwire/[email protected]
- Updated dependencies [
a9abe1d5
]:- @signalwire/[email protected]
- #416
8f6e6819
- Initial implementation of theChat
namespace, Updated version of getClient to also cache the internals, Added utility for creating session clients (setupClient) to simplify and abstract all the required steps for creating (or getting from the cache) a client based on the passed credentials.
- Updated dependencies [
8f203450
,c487d29b
,b1b022a4
,46600032
,4a918d56
,058e9a0c
,2c8fc597
,563a31e5
,1944348f
,4d7bcc30
]:- @signalwire/[email protected]
- Updated dependencies [
bc0134e9
,46600032
,d168a035
,edc573f2
]:- @signalwire/[email protected]
- Updated dependencies [
da526347
,3f851e2a
,6d234ccc
,bbbff2c6
,1bda6272
,c557e4e5
,f6290de0
,603d4497
,7c688bb5
,6d94624b
,743168df
,c33a4565
,d1174ec8
]:- @signalwire/[email protected]
- Updated dependencies [
03e5d42
,da52634
,3f851e2
,62c25d8
,ed04e25
,576b667
]:- @signalwire/[email protected]
- Updated dependencies [
bae6985
,fa40510
]:- @signalwire/[email protected]
- #297
2675e5e
- Add support for the Playback APIs:roomSession.play()
and theRoomSessionPlayback
object to control it.
- Updated dependencies [
7d183de
,2675e5e
]:- @signalwire/[email protected]
- #302
2ac7f6d
- AddedsetInputVolume
/setOutputVolume
and markedsetMicrophoneVolume
/setSpeakerVolume
as deprecated.
- #311
febb842
- Allow users to listen theroom.subscribed
event and change theroomSession.subscribe()
to return aPromise<RoomSessionFullState>
.
- Updated dependencies [
3af0ea6
,72eb91b
,2ac7f6d
,cec54bd
,febb842
,b60e9fc
,4d21716
,49b4aa9
,685e0a2
]:- @signalwire/[email protected]
This is the initial release of @signalwire/realtime-api
. Read the Release Notes on GitHub!