tciv-client 0.0.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.
package/README.md ADDED
@@ -0,0 +1,443 @@
1
+ # tciv-client
2
+
3
+ [![npm](https://img.shields.io/npm/v/tciv-client?color=818cf8&label=npm&style=flat-square)](https://www.npmjs.com/package/tciv-client)
4
+ [![license](https://img.shields.io/npm/l/tciv-client?color=818cf8&style=flat-square)](https://github.com/pinecall/tciv-client/blob/master/LICENSE)
5
+
6
+ > TypeScript HTTP client for TCIV-series intercom systems โ€” device administration, network discovery, and CLI.
7
+
8
+ Zero runtime dependencies ยท Native `fetch` (Node 18+) ยท Tested on **TCIV-2+** firmware **9.2.3.0**
9
+
10
+ > **Trademark Notice:** This project is **not affiliated with, endorsed by, or sponsored by Zenitel AS.** "Zenitel" and "TCIV" are trademarks of their respective owners. This library is an independent tool for authorized administrators to manage their own intercom systems.
11
+
12
+ ## Table of Contents
13
+
14
+ - [Install](#install)
15
+ - [Quick Start](#quick-start)
16
+ - [CLI](#cli)
17
+ - [Device Discovery](#device-discovery)
18
+ - [Device Info](#device-information)
19
+ - [Call & Relay Control](#call-status--relays)
20
+ - [SIP Configuration](#sip-configuration)
21
+ - [Webcall Management](#webcall-api-management)
22
+ - [Audio Settings](#audio-settings)
23
+ - [Config Backup & Restore](#config-backup--restore)
24
+ - [Call Button (DAK)](#call-button-dak-configuration)
25
+ - [Provisioning](#full-device-provisioning)
26
+ - [Video](#video)
27
+ - [Reboot](#device-reboot)
28
+ - [API](#api)
29
+ - [Connectivity](#connectivity)
30
+ - [Device Info](#device-info)
31
+ - [Calls](#webcall-place--stop--answer-calls)
32
+ - [Relay / Door Control](#relay--door-control)
33
+ - [SIP Config](#sip-configuration-1)
34
+ - [Webcall Toggle](#webcall-management)
35
+ - [Config Backup](#config-backup--restore-1)
36
+ - [Video URLs](#video-1)
37
+ - [Call Button (DAK)](#call-button-dak-configuration-1)
38
+ - [Provisioning](#full-device-provisioning-1)
39
+ - [Audio Settings](#audio-settings)
40
+ - [Reboot](#reboot)
41
+ - [Network Scanner](#scannetwork)
42
+ - [Supported Hardware](#supported-hardware)
43
+ - [Goform Endpoint Map](#goform-endpoint-map)
44
+
45
+ ---
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ npm install tciv-client
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ```typescript
56
+ import { ZenitelClient } from 'tciv-client';
57
+
58
+ const z = new ZenitelClient({ host: '192.168.1.143' });
59
+
60
+ // Check if device is reachable
61
+ await z.isReachable(); // true
62
+
63
+ // Get device info
64
+ const info = await z.getDeviceInfo();
65
+ console.log(info.model); // "TCIV-2+"
66
+
67
+ // Open the door for 7 seconds
68
+ await z.activateRelay({ timer: 7 });
69
+
70
+ // Read audio settings
71
+ const audio = await z.getAudioSettings();
72
+ console.log(audio.speaker.gain); // 0
73
+
74
+ // Set speaker volume to +3 dB
75
+ await z.setAudioSettings({ speaker: { gain: 3 } });
76
+ ```
77
+
78
+ ---
79
+
80
+ ## CLI
81
+
82
+ The `zenitel` CLI is included for hardware testing and debugging.
83
+
84
+ ```bash
85
+ npx tciv <command> [options]
86
+ ```
87
+
88
+ ### Device Discovery
89
+
90
+ ```bash
91
+ zenitel scan
92
+
93
+ # ๐Ÿ” Scanning network for Zenitel devices...
94
+ #
95
+ # ๐ŸŸข 192.168.1.143
96
+ # MAC: 00:13:cb:28:35:ca
97
+ # Model: TCIV-2+
98
+ # Firmware: 9.2.3.0
99
+ # Hostname: zenitel01
100
+ # Mode: sip
101
+ # Camera: Yes
102
+ #
103
+ # Found 1 device(s).
104
+ ```
105
+
106
+ ### Device Information
107
+
108
+ ```bash
109
+ zenitel info -h 192.168.1.143
110
+
111
+ # ๐Ÿ“‹ Device info:
112
+ # Model: TCIV-2+
113
+ # System: Turbine Compact - Video Plus
114
+ # Firmware: 9.2.3.0
115
+ # MAC: 00:13:cb:28:35:ca
116
+ # Serial: 22040000
117
+ # Hostname: zenitel01
118
+ # Mode: sip
119
+ # Camera: Yes
120
+ # Webcall: Enabled
121
+ # SIP Registered: Yes
122
+ ```
123
+
124
+ ### Call Status & Relays
125
+
126
+ ```bash
127
+ zenitel status -h 192.168.1.143 # Full status
128
+ zenitel relay -h 192.168.1.143 # Open door (relay1, 3s)
129
+ zenitel relay -h 192.168.1.143 --id gpio2 --timer 5 # GPIO output
130
+ zenitel relay -h 192.168.1.143 --off # Deactivate
131
+ zenitel call 122 -h 192.168.1.143 # Place SIP call
132
+ zenitel stop -h 192.168.1.143 # Hang up
133
+ ```
134
+
135
+ ### SIP Configuration
136
+
137
+ ```bash
138
+ zenitel sip get -h 192.168.1.143 # Read SIP config
139
+ zenitel sip set -h 192.168.1.143 \
140
+ --domain my-trunk.sip.twilio.com \
141
+ --number station01
142
+ ```
143
+
144
+ ### Webcall API Management
145
+
146
+ ```bash
147
+ zenitel webcall -h 192.168.1.143 # Check status
148
+ zenitel webcall enable -h 192.168.1.143 # Enable HTTP API
149
+ zenitel webcall disable -h 192.168.1.143 # Disable
150
+ ```
151
+
152
+ ### Audio Settings
153
+
154
+ ```bash
155
+ # Read current audio config
156
+ zenitel audio -h 192.168.1.143
157
+
158
+ # ๐ŸŽต Audio settings for 192.168.1.143:
159
+ #
160
+ # Speaker: -5 dB (range: -10 to +13)
161
+ # Mic: 0 dB (range: -10 to +10)
162
+ # AEC: โœ… ON (moderate)
163
+ # ANC: โœ… ON (moderate)
164
+ # DRC: โŒ OFF (5 dBA)
165
+ # AVC: โŒ OFF
166
+ # FESS: โŒ OFF (threshold: -60 dBFS)
167
+ # Mode: Voice
168
+
169
+ # Adjust speaker and mic
170
+ zenitel audio set -h 192.168.1.143 --speaker 3 --mic 3
171
+
172
+ # Toggle DSP features
173
+ zenitel audio set -h 192.168.1.143 --aec-on --drc-on --anc-off
174
+
175
+ # Backup raw audio config as JSON
176
+ zenitel audio backup -h 192.168.1.143 -o audio-backup.json
177
+ ```
178
+
179
+ ### Config Backup & Restore
180
+
181
+ ```bash
182
+ zenitel backup -h 192.168.1.143 -o backup.tar.gz
183
+ zenitel restore backup.tar.gz -h 192.168.1.143
184
+ ```
185
+
186
+ ### Video
187
+
188
+ ```bash
189
+ zenitel video -h 192.168.1.143
190
+ # ๐Ÿ“ท Video URLs:
191
+ # MJPG: http://192.168.1.143/mjpg/video.mjpg
192
+ # RTSP: rtsp://192.168.1.143:554/1/RTSP
193
+ ```
194
+
195
+ ### Call Button (DAK) Configuration
196
+
197
+ ```bash
198
+ zenitel dak get -h 192.168.1.143
199
+ zenitel dak set --number portia-ae3c -h 192.168.1.143
200
+ ```
201
+
202
+ > Downloads config โ†’ modifies XML โ†’ re-uploads โ†’ reboots. Zero external dependencies.
203
+
204
+ ### Full Device Provisioning
205
+
206
+ One command to configure a factory-reset Zenitel:
207
+
208
+ ```bash
209
+ zenitel provision -h 192.168.1.143 \
210
+ --domain testing-mo16m3gw.sip.twilio.com \
211
+ --sip-user zenitel01 \
212
+ --sip-pass 'your-sip-password' \
213
+ --number portia-ae3c
214
+
215
+ # โœ… Provisioned! Device is rebooting (~30s).
216
+ ```
217
+
218
+ ### Device Reboot
219
+
220
+ ```bash
221
+ zenitel reboot -h 192.168.1.143
222
+ ```
223
+
224
+ ### CLI Options
225
+
226
+ | Flag | Short | Description | Default |
227
+ |------|-------|-------------|---------|
228
+ | `--host` | `-h` | Device IP address | required |
229
+ | `--user` | `-u` | Web UI username | `admin` |
230
+ | `--pass` | `-p` | Web UI password | `alphaadmin` |
231
+ | `--id` | | Relay ID (`relay1`, `gpio1`โ€“`gpio6`) | `relay1` |
232
+ | `--timer` | | Relay timer (seconds) | `3` |
233
+ | `--timeout` | | Scan timeout (ms) | `5000` |
234
+ | `--off` | | Deactivate relay | |
235
+ | `--domain` | | SIP domain | |
236
+ | `--number` | | SIP number / agent number | |
237
+ | `--proxy` | | Outbound proxy | |
238
+ | `--transport` | | SIP transport (`udp`/`tcp`/`tls`) | |
239
+ | `--out` | `-o` | Backup output filename | `ipst_config.tar.gz` |
240
+ | `--no-reboot` | | Skip reboot after DAK set | |
241
+ | `--sip-user` | | SIP auth username (provision) | |
242
+ | `--sip-pass` | | SIP auth password (provision) | |
243
+
244
+ ---
245
+
246
+ ## API
247
+
248
+ ### `ZenitelClient`
249
+
250
+ ```typescript
251
+ import { ZenitelClient } from 'tciv-client';
252
+
253
+ const z = new ZenitelClient({
254
+ host: '192.168.1.143',
255
+ user: 'admin', // default
256
+ password: 'alphaadmin', // default
257
+ timeout: 5000, // ms, default
258
+ });
259
+ ```
260
+
261
+ #### Connectivity
262
+
263
+ ```typescript
264
+ const reachable = await z.isReachable(); // true | false
265
+ ```
266
+
267
+ #### Device Info
268
+
269
+ ```typescript
270
+ const info = await z.getDeviceInfo();
271
+ // { model, firmware, mac, ip, hostname, serialNumber, hardwareType,
272
+ // mode, hasCamera, sipDomain, sipRegistered, webcallEnabled, ... }
273
+ ```
274
+
275
+ #### Webcall (Place / Stop / Answer calls)
276
+
277
+ ```typescript
278
+ await z.placeCall('122');
279
+ await z.stopCall();
280
+ await z.answerCall();
281
+ const status = await z.getCallStatus(); // 'Idle' | 'Calling' | 'Connected' | 'Ringing'
282
+ ```
283
+
284
+ #### Relay / Door Control
285
+
286
+ ```typescript
287
+ await z.activateRelay({ relayId: 'relay1', timer: 3 });
288
+ await z.activateRelay({ relayId: 'gpio2', timer: 5 });
289
+ await z.deactivateRelay('relay1');
290
+ const relays = await z.getRelayStatus();
291
+ // { relay1: 'Deactivated', gpio1: ..., gpio6: ... }
292
+ ```
293
+
294
+ Relay IDs: `relay1`, `gpio1`โ€“`gpio6`
295
+
296
+ #### SIP Configuration
297
+
298
+ ```typescript
299
+ const sip = await z.getSIPConfig();
300
+ // { displayName, directoryNumber, domain, authUsername, outboundProxy, transport }
301
+
302
+ await z.setSIPConfig({ domain: 'my-trunk.sip.twilio.com' });
303
+ await z.reboot(); // Required for SIP changes
304
+ ```
305
+
306
+ #### Webcall Management
307
+
308
+ ```typescript
309
+ await z.enableWebcall();
310
+ await z.disableWebcall();
311
+ ```
312
+
313
+ > Firmware โ‰ฅ4.11.3.1 disables webcall by default. Enable it for relay/call HTTP control.
314
+
315
+ #### Config Backup & Restore
316
+
317
+ ```typescript
318
+ const backup = await z.downloadConfig();
319
+ fs.writeFileSync('backup.tar.gz', backup);
320
+
321
+ const tarGz = fs.readFileSync('backup.tar.gz');
322
+ await z.uploadConfig(tarGz);
323
+ await z.reboot();
324
+ ```
325
+
326
+ #### Video
327
+
328
+ ```typescript
329
+ z.getMJPGUrl(); // "http://192.168.1.143/mjpg/video.mjpg"
330
+ z.getRTSPUrl(); // "rtsp://192.168.1.143:554/1/RTSP"
331
+ z.getVideoAuth(); // { user: 'admin', password: '...' }
332
+ ```
333
+
334
+ #### Call Button (DAK) Configuration
335
+
336
+ ```typescript
337
+ const dak = await z.readDAK();
338
+ // { number: '222', domain: 'sip.twilio.com', raw: '222@sip.twilio.com' }
339
+
340
+ await z.configureCallButton('portia-ae3c');
341
+ // Downloads backup โ†’ modifies XML โ†’ uploads โ†’ reboots (~2s)
342
+ ```
343
+
344
+ #### Full Device Provisioning
345
+
346
+ ```typescript
347
+ await z.provisionDevice({
348
+ sipDomain: 'testing-mo16m3gw.sip.twilio.com',
349
+ sipAuthUser: 'zenitel01',
350
+ sipAuthPassword: 'your-sip-password',
351
+ agentNumber: 'portia-ae3c',
352
+ enableWebcall: true, // default
353
+ autoAnswer: true, // default
354
+ });
355
+ ```
356
+
357
+ #### Audio Settings
358
+
359
+ Read and write the full audio configuration โ€” speaker/mic gain, echo cancellation, noise suppression, compression, and automatic volume control.
360
+
361
+ > The Zenitel config endpoint requires the **complete** JSON payload. `setAudioSettings()` handles this automatically โ€” it reads, merges your changes, and writes back.
362
+
363
+ ```typescript
364
+ const audio = await z.getAudioSettings();
365
+ // { speaker, mic, aec, anc, drc, avc, fess, lineOut, mode }
366
+
367
+ await z.setAudioSettings({ speaker: { gain: 3 } });
368
+ await z.setAudioSettings({ mic: { gain: 3 } });
369
+ await z.setAudioSettings({ drc: { enabled: true, gain: 8 } });
370
+ await z.setAudioSettings({
371
+ speaker: { gain: 2 },
372
+ aec: { enabled: true, mode: 'aggressive' },
373
+ });
374
+
375
+ // Backup raw config
376
+ const raw = await z.getAudioSettingsRaw();
377
+ fs.writeFileSync('audio-backup.json', JSON.stringify(raw, null, 2));
378
+ ```
379
+
380
+ | Setting | Property | Range | Description |
381
+ |---------|----------|-------|-------------|
382
+ | Speaker Volume | `speaker.gain` | -10 to +13 dB | Playback level |
383
+ | Mic Sensitivity | `mic.gain` | -10 to +10 dB | Input level |
384
+ | Echo Cancel | `aec.enabled` / `.mode` | `moderate` ยท `aggressive` | Removes speaker bleed from mic |
385
+ | Noise Suppress | `anc.enabled` / `.mode` | `moderate` ยท `aggressive` | Filters ambient noise |
386
+ | Compression | `drc.enabled` / `.gain` | 0โ€“20 dBA | Normalizes volume |
387
+ | Auto Volume | `avc.enabled` | bool | Adjusts to ambient noise |
388
+ | Squelch | `fess.enabled` / `.threshold` | -92โ€“0 dBFS | Silences weak signals |
389
+ | Line Out | `lineOut.gain` | -20 to +20 dB | External speaker |
390
+
391
+ #### Reboot
392
+
393
+ ```typescript
394
+ await z.reboot(); // ~30 seconds offline
395
+ ```
396
+
397
+ ---
398
+
399
+ ### `scanNetwork()`
400
+
401
+ ```typescript
402
+ import { scanNetwork } from 'tciv-client';
403
+
404
+ const devices = await scanNetwork({ timeout: 5000 });
405
+ // [{ ip, mac, model, firmware, hasCamera, hostname, mode }]
406
+ ```
407
+
408
+ | Strategy | Method | Speed |
409
+ |----------|--------|-------|
410
+ | `arp-oui` | ARP table + MAC prefix `00:13:CB` | Fast |
411
+ | `http-probe` | Probe every IP for `zenitel.js` | Thorough |
412
+
413
+ ---
414
+
415
+ ## Supported Hardware
416
+
417
+ | Model | Camera | Relay | Webcall | Audio | Firmware |
418
+ |-------|--------|-------|---------|-------|----------|
419
+ | **TCIV-2+** | โœ… | โœ… relay1 + gpio1โ€“6 | โœ… | โœ… | 9.2.3.0 |
420
+ | TCIV-3+ | โœ… | โœ… | โœ… | โœ… | Expected |
421
+ | TCIS-2 | โ€” | โœ… | โœ… | โœ… | Expected |
422
+
423
+ ## Goform Endpoint Map
424
+
425
+ | Endpoint | Method | Purpose |
426
+ |----------|--------|---------|
427
+ | `/goform/zForm_header` | GET | Device metadata |
428
+ | `/goform/zForm_stn_info` | GET | Station info table |
429
+ | `/goform/zForm_webcall` | GET/POST | Webcall + relay control |
430
+ | `/goform/zForm_sip_configuration` | GET | SIP config |
431
+ | `/goform/zForm_save_changes` | POST | Write SIP config |
432
+ | `/goform/zForm_audio_configuration` | GET | Audio config (JSON) |
433
+ | `/goform/zForm_auto_config` | POST | Write audio/DSP config |
434
+ | `/goform/zForm_config_backup` | POST | Config restore (upload) |
435
+ | `/ipst_config.tar.gz` | GET | Config backup download |
436
+ | `/goform/zForm_system_prefs` | POST | Reboot device |
437
+ | `/mjpg/video.mjpg` | GET | Live MJPG stream |
438
+
439
+ Auth: **HTTP Basic** on all endpoints.
440
+
441
+ ## License
442
+
443
+ Apache-2.0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * zenitel โ€” CLI for testing Zenitel intercom interaction
4
+ *
5
+ * Usage:
6
+ * zenitel scan Discover Zenitel devices on the network
7
+ * zenitel info -h 192.168.1.143 Get device info
8
+ * zenitel relay -h 192.168.1.143 Activate relay1 for 3 seconds
9
+ * zenitel relay -h ... --id gpio1 --timer 5
10
+ * zenitel call 122 -h 192.168.1.143 Place a call
11
+ * zenitel stop -h 192.168.1.143 Stop current call
12
+ * zenitel status -h 192.168.1.143 Get relay + call status
13
+ */
14
+ export {};