Skip to navigation

Records which conversation and call a nonce belongs to. Call it from the per-call config callback of the dial that carried the nonce, with callId from the request the platform sent, never from anything the browser supplied.

Registering a nonce that’s already in the table changes nothing, because the callback runs on every config request for the call. The first registration’s call, time, and message count stand, and a nonce redeem() has used stays used until it would have expired. An empty or non-string nonce is ignored.

Parameters

nonce
stringRequired

The nonce put in the dial’s user variables.

opts
{ conversationId: string; callId?: string | null }Required

What the nonce gives access to.

opts.conversationId
stringRequired

The conversation the call belongs to.

opts.callId
string | null

The platform call id. Without one, /handoff has no call to end and /say has no call to speak into.

Returns

void.

Examples

import { ChatGateway, HandoffRouter } from '@signalwire/sdk';
const gateway = new ChatGateway({ configUrl: 'https://bayview-taxi.example.com/dispatch' });
const handoff = new HandoffRouter({ gateway });
// From the per-call config callback of the dial that carried the nonce.
handoff.register('n_7f3a91c2', {
conversationId: 'chat-8f21',
callId: 'b2c0f1e4-5a6d-4f0e-9d1b-3c7e8a9f0b12',
});