@unboundcx/sdk 4.8.16 → 4.8.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/services/voice.js +18 -11
package/README.md
CHANGED
|
@@ -352,7 +352,7 @@ const call = await api.voice.createCall({
|
|
|
352
352
|
// Call controls
|
|
353
353
|
await api.voice.mute(call.callControlId);
|
|
354
354
|
await api.voice.hold(call.callControlId);
|
|
355
|
-
await api.voice.sendDtmf(call.
|
|
355
|
+
await api.voice.sendDtmf({ callId: call.callId, dtmf: '1234' }); // mode: 'auto'|'rtp'|'inband'|'info'; target: 'leg' (default) | 'peer'
|
|
356
356
|
await api.voice.transfer(call.callControlId, '+1555555555');
|
|
357
357
|
await api.voice.hangup(call.callControlId);
|
|
358
358
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.18",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/voice.js
CHANGED
|
@@ -250,25 +250,32 @@ export class VoiceService {
|
|
|
250
250
|
return this.mute(voiceChannelId, 'unmute', direction);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Send DTMF digits on a live call (SIP call ID).
|
|
255
|
+
* mode: 'auto' (default — RFC4733 RTP if negotiated, else in-band tones)
|
|
256
|
+
* | 'rtp' | 'inband' | 'info' (SIP INFO application/dtmf-relay).
|
|
257
|
+
* target: 'leg' (default) — transmit on callId's media toward its far end
|
|
258
|
+
* (e.g. a bot sending digits on the PSTN leg it dialed);
|
|
259
|
+
* 'peer' — as if the party on callId pressed the keys: the bridge
|
|
260
|
+
* relays to the other side (a user's keypad on their own leg).
|
|
261
|
+
*/
|
|
262
|
+
async sendDtmf({ callId, dtmf, mode, target }) {
|
|
254
263
|
this.sdk.validateParams(
|
|
255
|
-
{
|
|
264
|
+
{ callId, dtmf, mode, target },
|
|
256
265
|
{
|
|
257
|
-
|
|
266
|
+
callId: { type: 'string', required: true },
|
|
258
267
|
dtmf: { type: 'string', required: true },
|
|
259
268
|
mode: { type: 'string', required: false },
|
|
269
|
+
target: { type: 'string', required: false },
|
|
260
270
|
},
|
|
261
271
|
);
|
|
262
272
|
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
273
|
+
const body = { callId, dtmf };
|
|
274
|
+
if (mode) body.mode = mode;
|
|
275
|
+
if (target) body.target = target;
|
|
276
|
+
const params = { body };
|
|
266
277
|
|
|
267
|
-
const result = await internalRequest(this.sdk,
|
|
268
|
-
`/voice/calls/dtmf/${voiceChannelId}`,
|
|
269
|
-
'POST',
|
|
270
|
-
params,
|
|
271
|
-
);
|
|
278
|
+
const result = await internalRequest(this.sdk, `/voice/dtmf`, 'POST', params);
|
|
272
279
|
return result;
|
|
273
280
|
}
|
|
274
281
|
|