@micdrop/telephony 0.1.0 → 0.2.0
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 +16 -3
- package/dist/index.d.mts +810 -23
- package/dist/index.d.ts +810 -23
- package/dist/index.js +1794 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1770 -79
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Phone calls with a Micdrop voice agent, on your own Node.js server. The transpor
|
|
|
16
16
|
| Plivo | `PlivoTransport` | μ-law, 8 kHz | `plivoStreamXml()` |
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install @micdrop/server @micdrop/telephony @micdrop/
|
|
19
|
+
npm install @micdrop/server @micdrop/telephony @micdrop/silero onnxruntime-node
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Quick start
|
|
@@ -24,7 +24,7 @@ npm install @micdrop/server @micdrop/telephony @micdrop/vad onnxruntime-node
|
|
|
24
24
|
```typescript
|
|
25
25
|
import { MicdropServer, waitForParams } from '@micdrop/server'
|
|
26
26
|
import { TwilioTransport, twilioStreamTwiml } from '@micdrop/telephony'
|
|
27
|
-
import '@micdrop/
|
|
27
|
+
import '@micdrop/silero/node'
|
|
28
28
|
|
|
29
29
|
// The voice webhook of the number
|
|
30
30
|
app.post('/twilio/voice', async (request, reply) => {
|
|
@@ -38,7 +38,7 @@ app.get('/twilio/stream', { websocket: true }, async (socket) => {
|
|
|
38
38
|
const params = await waitForParams(transport, (value) => value)
|
|
39
39
|
|
|
40
40
|
new MicdropServer(transport, {
|
|
41
|
-
vad: 'silero', // A phone line needs the server to find the turns
|
|
41
|
+
turns: { vad: 'silero' }, // A phone line needs the server to find the turns
|
|
42
42
|
firstMessage: 'Hello, thanks for calling. How can I help?',
|
|
43
43
|
agent,
|
|
44
44
|
stt,
|
|
@@ -54,6 +54,19 @@ app.get('/twilio/stream', { websocket: true }, async (socket) => {
|
|
|
54
54
|
- Hangs up once the goodbye has played when the agent ends the call, confirmed by the marks of the provider
|
|
55
55
|
- Hands the parameters of the call to `waitForParams`, and the call identifiers to `transport.call`
|
|
56
56
|
- Emits the keys of the keypad as `Dtmf` events
|
|
57
|
+
- Ends the call with a clear error when the stream comes in another format than it reads
|
|
58
|
+
|
|
59
|
+
## Production features
|
|
60
|
+
|
|
61
|
+
Each one is optional, added when you need it:
|
|
62
|
+
|
|
63
|
+
- `transferCallTool()`: the agent transfers the call, cold or warm (the person hears a summary first)
|
|
64
|
+
- `sendDtmfTool()` and `transport.sendDtmf()`: press keys in a phone menu
|
|
65
|
+
- `twilioCall()`, `vonageCall()`, `telnyxCall()`, `plivoCall()`: place outbound calls
|
|
66
|
+
- `answeringMachine()`, `voicemailTool()`: detect a voicemail, leave a message and hang up
|
|
67
|
+
- `validateTwilioSignature()`, `validateTelnyxSignature()`, `validateVonageSignature()`, `validatePlivoSignature()`: refuse the webhooks your provider did not sign
|
|
68
|
+
- `TelephonyCalls`: routes the webhooks of the providers (machine detection, Telnyx transfers) to their calls
|
|
69
|
+
- From `@micdrop/server`: `dtmfInput()` adds the keys of the caller to the conversation, `idleTimeout()` checks in when the caller stays silent
|
|
57
70
|
|
|
58
71
|
## License
|
|
59
72
|
|