@cemscale-voip/voip-sdk 1.55.0 → 1.55.1

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.
Files changed (2) hide show
  1. package/README.md +34 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -124,13 +124,14 @@ import type {
124
124
  CallAnsweredEvent,
125
125
  CallForwardedEvent,
126
126
  CallEndedEvent,
127
+ VoicemailNewEvent,
127
128
  } from '@cemscale-voip/voip-sdk';
128
129
 
129
130
  // Register a webhook subscription
130
131
  await voip.createWebhook({
131
132
  name: 'CRM Events',
132
133
  url: 'https://your-crm.com/api/voip-webhook',
133
- events: ['call.started', 'call.answered', 'call.forwarded', 'call.ended'],
134
+ events: ['call.started', 'call.answered', 'call.forwarded', 'call.ended', 'voicemail.new'],
134
135
  secret: 'your-hmac-secret', // optional — enables X-Webhook-Signature header
135
136
  });
136
137
  ```
@@ -185,11 +186,26 @@ app.post('/api/voip-webhook', (req, res) => {
185
186
 
186
187
  case 'call.ended': {
187
188
  const ended = envelope.data as CallEndedEvent;
189
+ // ended.status: 'completed' | 'failed' | 'missed' | 'voicemail'
188
190
  // ended.forwardedTo is non-null when the call was forwarded
191
+ // ended.was_voicemail is true when a voicemail message was left
192
+ if (ended.status === 'voicemail') {
193
+ console.log(`Voicemail left for ${ended.destination}`);
194
+ }
189
195
  saveCdr(ended);
190
196
  break;
191
197
  }
192
198
 
199
+ case 'voicemail.new': {
200
+ const vm = envelope.data as VoicemailNewEvent;
201
+ // vm.extension: '1001' (extension that received the voicemail)
202
+ // vm.caller: '+17861234567'
203
+ // vm.duration: 23 (seconds)
204
+ // vm.recordingFile: '/var/lib/voip-voicemail/.../msg.mp3'
205
+ notifyVoicemail(vm);
206
+ break;
207
+ }
208
+
193
209
  case 'call.answered': {
194
210
  const answered = envelope.data as CallAnsweredEvent;
195
211
  // answered.forwardedTo is present when a forwarded call was answered
@@ -248,6 +264,23 @@ app.post('/api/voip-webhook', (req, res) => {
248
264
  }
249
265
  ```
250
266
 
267
+ **`voicemail.new`:**
268
+ ```json
269
+ {
270
+ "event": "voicemail.new",
271
+ "timestamp": "2026-05-14T18:15:30Z",
272
+ "data": {
273
+ "callUuid": "a1b2c3d4-...",
274
+ "extension": "1001",
275
+ "caller": "+17861234567",
276
+ "callerName": "John Doe",
277
+ "duration": 23,
278
+ "recordingFile": "/var/lib/voip-voicemail/.../msg.mp3",
279
+ "timestamp": "2026-05-14T18:15:30Z"
280
+ }
281
+ }
282
+ ```
283
+
251
284
  ### Call Queues
252
285
 
253
286
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cemscale-voip/voip-sdk",
3
- "version": "1.55.0",
3
+ "version": "1.55.1",
4
4
  "description": "VoIP SDK for CemScale multi-tenant platform — API client, WebRTC, React hooks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",