Skip to content

@signalwire/realtime-api v3.0.0

Compare
Choose a tag to compare
@rsowald rsowald released this 20 May 01:20
· 599 commits to main since this release
ad778c3

This release marks the beginning of the RELAY Realtime SDK with the integration of Voice and Messaging RELAY with our existing Realtime SDK for Video and Chat.

Highlights

Voice

You can now instantiate a Voice Client, subscribe to events, and make and answer calls. For example:

import { Voice } from '@signalwire/realtime-api';

const client = new Voice.Client({
  project: '<project-id>',
  token: '<project-token>',
  contexts: '<context>'
});

client.on('call.received', async (call) => {
  console.log('Got call', call.id, call.from, call.to, call.direction);
});

try {
  const call = await client.dialPhone({
      to: 'to number',
      from: 'from number',
      timeout: 30,
  })
  console.log('Dial resolved!', call.id)
} catch (error) {
  console.error('Connect Error', error)
};

With Voice, you can also

  • record audio
  • play audio
  • listen for digits or speech using prompt()

Messaging

You can use the same structure to instantiate a Messaging Client, subscribe to events, and send and receive messages.

import { Messaging } from '@signalwire/realtime-api';

const client = new Messaging.Client({
  project: '<project-id>',
  token: '<project-token>',
  contexts: '<context>'
});

client.on('message.received', (message) => {
  console.log('message.received', message)
})

try {
  const response = await client.send({
    from: '+1xxx',
    to: '+1yyy',
    body: 'Hello World!',
  })
  console.log('>> send response', response)
} catch (error) {
  console.log('>> send error', error)
}

Fixes

  • Fix: expose all the active recordings on the room.joined event (#501) 5c96bf8

Improvements

  • We have introduced the PubSub namespace to keep the minimal PubSub functionality available to users as Chat continues to develop (#533) b6d5bb3