tciv-client 0.0.5 → 0.0.6
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/dist/client.d.ts +5 -1
- package/dist/client.js +36 -18
- package/package.json +30 -8
package/dist/client.d.ts
CHANGED
|
@@ -43,7 +43,11 @@ export declare class TcivClient {
|
|
|
43
43
|
};
|
|
44
44
|
/** Read current SIP config by scraping the form fields */
|
|
45
45
|
getSIPConfig(): Promise<SIPConfig>;
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Write SIP config via POST to zForm_save_changes.
|
|
48
|
+
* The Zenitel form requires ALL fields to be present — partial submissions are silently ignored.
|
|
49
|
+
* Submit field is `sipconfig=SAVE` (not signallingMode).
|
|
50
|
+
*/
|
|
47
51
|
setSIPConfig(config: SIPConfig): Promise<void>;
|
|
48
52
|
/** Enable webcall + relay HTTP API (required for FW ≥4.11.3.1) */
|
|
49
53
|
enableWebcall(): Promise<void>;
|
package/dist/client.js
CHANGED
|
@@ -188,24 +188,41 @@ export class TcivClient {
|
|
|
188
188
|
transport: select('sip_outbound_transport'),
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Write SIP config via POST to zForm_save_changes.
|
|
193
|
+
* The Zenitel form requires ALL fields to be present — partial submissions are silently ignored.
|
|
194
|
+
* Submit field is `sipconfig=SAVE` (not signallingMode).
|
|
195
|
+
*/
|
|
192
196
|
async setSIPConfig(config) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
197
|
+
// Read current values first (read-modify-write)
|
|
198
|
+
const current = await this.getSIPConfig();
|
|
199
|
+
const fields = {
|
|
200
|
+
sip_nick: config.displayName ?? current.displayName ?? '',
|
|
201
|
+
sip_id: config.directoryNumber ?? current.directoryNumber ?? '',
|
|
202
|
+
sip_domain: config.domain ?? current.domain ?? '',
|
|
203
|
+
sip_domain2: config.domain ?? current.domain ?? '',
|
|
204
|
+
sip_domain3: config.domain ?? current.domain ?? '',
|
|
205
|
+
registration_method: '0',
|
|
206
|
+
sip_auth_user: config.authUsername ?? current.authUsername ?? '',
|
|
207
|
+
sip_auth_pwd: config.authPassword ?? current.authPassword ?? '',
|
|
208
|
+
register_interval: '100',
|
|
209
|
+
fail_interval: '60',
|
|
210
|
+
sip_ppa: config.outboundProxy ?? current.outboundProxy ?? '',
|
|
211
|
+
sip_ppp: '5060',
|
|
212
|
+
sip_outbound_proxy_backup_address: '',
|
|
213
|
+
sip_outbound_proxy_backup_port: '5060',
|
|
214
|
+
sip_outbound_proxy_backup_address2: '',
|
|
215
|
+
sip_outbound_proxy_backup_port2: '5060',
|
|
216
|
+
sip_outbound_transport: (config.transport ?? current.transport ?? 'udp').toUpperCase(),
|
|
217
|
+
sip_scheme: 'sip',
|
|
218
|
+
rtp_encryption: 'disabled',
|
|
219
|
+
srtp_crypto_type: 'AES_CM_128_HMAC_SHA1_80',
|
|
220
|
+
multicast_relay: '',
|
|
221
|
+
auto_answer_mode: 'on',
|
|
222
|
+
auto_resume_call: 'on',
|
|
223
|
+
mkey_dtmf: 'on',
|
|
224
|
+
sipconfig: 'SAVE',
|
|
225
|
+
};
|
|
209
226
|
await this._post('/goform/zForm_save_changes', fields);
|
|
210
227
|
}
|
|
211
228
|
// ── Webcall Enable/Disable ─────────────────────────────────────────────
|
|
@@ -242,7 +259,8 @@ export class TcivClient {
|
|
|
242
259
|
async getDAK(buttonIndex = 0) {
|
|
243
260
|
const res = await this._fetch('/goform/zForm_speeddial_configuration_basic_auth');
|
|
244
261
|
const html = await res.text();
|
|
245
|
-
|
|
262
|
+
// Attribute order varies: value may come before or after name
|
|
263
|
+
const match = html.match(new RegExp(`dak_value${buttonIndex}[^>]*value='([^']*)'`));
|
|
246
264
|
return match?.[1] || '';
|
|
247
265
|
}
|
|
248
266
|
// ── Config Backup / Restore ────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tciv-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "HTTP client for TCIV-series intercom systems (TCIV-2+, TCIV-3). Control relays, SIP configuration, DAK provisioning, webcall, audio settings, and camera feeds.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": {
|
|
11
|
-
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
12
18
|
},
|
|
13
19
|
"./scanner": {
|
|
14
|
-
"import": {
|
|
15
|
-
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/scanner.d.ts",
|
|
22
|
+
"default": "./dist/scanner.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/scanner.d.ts",
|
|
26
|
+
"default": "./dist/scanner.js"
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
29
|
},
|
|
18
30
|
"bin": {
|
|
@@ -30,10 +42,20 @@
|
|
|
30
42
|
"tsx": "^4.21.0",
|
|
31
43
|
"@types/node": "^22.0.0"
|
|
32
44
|
},
|
|
33
|
-
"files": [
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"README.md"
|
|
48
|
+
],
|
|
34
49
|
"keywords": [
|
|
35
|
-
"intercom",
|
|
36
|
-
"
|
|
50
|
+
"intercom",
|
|
51
|
+
"TCIV",
|
|
52
|
+
"SIP",
|
|
53
|
+
"door-access",
|
|
54
|
+
"relay",
|
|
55
|
+
"DTMF",
|
|
56
|
+
"webcall",
|
|
57
|
+
"building-automation",
|
|
58
|
+
"tciv-client"
|
|
37
59
|
],
|
|
38
60
|
"license": "Apache-2.0",
|
|
39
61
|
"repository": {
|