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 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
- /** Write SIP config via POST to zForm_save_changes */
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
- /** Write SIP config via POST to zForm_save_changes */
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
- const fields = {};
194
- if (config.displayName !== undefined)
195
- fields.sip_nick = config.displayName;
196
- if (config.directoryNumber !== undefined)
197
- fields.sip_id = config.directoryNumber;
198
- if (config.domain !== undefined)
199
- fields.sip_domain = config.domain;
200
- if (config.authUsername !== undefined)
201
- fields.sip_auth_user = config.authUsername;
202
- if (config.authPassword !== undefined)
203
- fields.sip_auth_pwd = config.authPassword;
204
- if (config.outboundProxy !== undefined)
205
- fields.sip_ppa = config.outboundProxy;
206
- if (config.transport !== undefined)
207
- fields.sip_outbound_transport = config.transport.toUpperCase();
208
- fields.save_changes = 'Save';
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
- const match = html.match(new RegExp(`name='dak_value${buttonIndex}'[^>]*value='([^']*)'`));
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.5",
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": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
11
- "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
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": { "types": "./dist/scanner.d.ts", "default": "./dist/scanner.js" },
15
- "require": { "types": "./dist/scanner.d.ts", "default": "./dist/scanner.js" }
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": ["dist", "README.md"],
45
+ "files": [
46
+ "dist",
47
+ "README.md"
48
+ ],
34
49
  "keywords": [
35
- "intercom", "TCIV", "SIP", "door-access",
36
- "relay", "DTMF", "webcall", "building-automation", "tciv-client"
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": {