o2g-node-sdk 2.5.3 → 2.5.5

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 (85) hide show
  1. package/README.md +310 -21
  2. package/dist/o2g-node-sdk.js +3806 -3166
  3. package/dist/o2g-node-sdk.js.map +1 -1
  4. package/dist/types/events/chunk-eventing.d.ts.map +1 -0
  5. package/dist/types/events/event-dispatcher.d.ts.map +1 -0
  6. package/dist/types/events/event-packages.d.ts.map +1 -0
  7. package/dist/types/internal/o2g-application.d.ts +7 -1
  8. package/dist/types/internal/o2g-application.d.ts.map +1 -1
  9. package/dist/types/internal/rest/ccStatistics-rest.d.ts +1 -1
  10. package/dist/types/internal/rest/ccStatistics-rest.d.ts.map +1 -1
  11. package/dist/types/internal/util/logger.d.ts +3 -7
  12. package/dist/types/internal/util/logger.d.ts.map +1 -1
  13. package/dist/types/log-level.d.ts +17 -0
  14. package/dist/types/log-level.d.ts.map +1 -0
  15. package/dist/types/o2g-node-sdk.d.ts +126 -59
  16. package/dist/types/o2g-node-sdk.d.ts.map +1 -1
  17. package/dist/types/o2g-servers.d.ts +111 -0
  18. package/dist/types/o2g-servers.d.ts.map +1 -0
  19. package/dist/types/{o2g-analytics.d.ts → services/o2g-analytics.d.ts} +4 -4
  20. package/dist/types/services/o2g-analytics.d.ts.map +1 -0
  21. package/dist/types/{o2g-cc-agent.d.ts → services/o2g-cc-agent.d.ts} +4 -4
  22. package/dist/types/services/o2g-cc-agent.d.ts.map +1 -0
  23. package/dist/types/{o2g-cc-mngt.d.ts → services/o2g-cc-mngt.d.ts} +7 -7
  24. package/dist/types/services/o2g-cc-mngt.d.ts.map +1 -0
  25. package/dist/types/services/o2g-cc-pilot.d.ts.map +1 -0
  26. package/dist/types/{o2g-cc-rt.d.ts → services/o2g-cc-rt.d.ts} +3 -3
  27. package/dist/types/services/o2g-cc-rt.d.ts.map +1 -0
  28. package/dist/types/{o2g-cc-stat.d.ts → services/o2g-cc-stat.d.ts} +12 -12
  29. package/dist/types/services/o2g-cc-stat.d.ts.map +1 -0
  30. package/dist/types/{o2g-comlog.d.ts → services/o2g-comlog.d.ts} +4 -4
  31. package/dist/types/services/o2g-comlog.d.ts.map +1 -0
  32. package/dist/types/{o2g-directory.d.ts → services/o2g-directory.d.ts} +2 -2
  33. package/dist/types/services/o2g-directory.d.ts.map +1 -0
  34. package/dist/types/{o2g-eventSummary.d.ts → services/o2g-eventSummary.d.ts} +1 -1
  35. package/dist/types/services/o2g-eventSummary.d.ts.map +1 -0
  36. package/dist/types/{o2g-maint.d.ts → services/o2g-maint.d.ts} +1 -1
  37. package/dist/types/services/o2g-maint.d.ts.map +1 -0
  38. package/dist/types/{o2g-messaging.d.ts → services/o2g-messaging.d.ts} +3 -3
  39. package/dist/types/services/o2g-messaging.d.ts.map +1 -0
  40. package/dist/types/{o2g-pbx-mngt.d.ts → services/o2g-pbx-mngt.d.ts} +5 -5
  41. package/dist/types/services/o2g-pbx-mngt.d.ts.map +1 -0
  42. package/dist/types/{o2g-phone-set-prog.d.ts → services/o2g-phone-set-prog.d.ts} +5 -5
  43. package/dist/types/services/o2g-phone-set-prog.d.ts.map +1 -0
  44. package/dist/types/{o2g-routing.d.ts → services/o2g-routing.d.ts} +7 -7
  45. package/dist/types/services/o2g-routing.d.ts.map +1 -0
  46. package/dist/types/{o2g-rsi.d.ts → services/o2g-rsi.d.ts} +4 -4
  47. package/dist/types/services/o2g-rsi.d.ts.map +1 -0
  48. package/dist/types/{o2g-telephony.d.ts → services/o2g-telephony.d.ts} +14 -14
  49. package/dist/types/services/o2g-telephony.d.ts.map +1 -0
  50. package/dist/types/{o2g-users-mngt.d.ts → services/o2g-users-mngt.d.ts} +1 -1
  51. package/dist/types/services/o2g-users-mngt.d.ts.map +1 -0
  52. package/dist/types/{o2g-users.d.ts → services/o2g-users.d.ts} +3 -3
  53. package/dist/types/services/o2g-users.d.ts.map +1 -0
  54. package/dist/types/session-monitoring-policy.d.ts +152 -0
  55. package/dist/types/session-monitoring-policy.d.ts.map +1 -0
  56. package/dist/types/subscription.d.ts +1 -1
  57. package/dist/types/subscription.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/dist/types/host.d.ts +0 -18
  60. package/dist/types/host.d.ts.map +0 -1
  61. package/dist/types/internal/events/chunk-eventing.d.ts.map +0 -1
  62. package/dist/types/internal/events/event-dispatcher.d.ts.map +0 -1
  63. package/dist/types/internal/events/event-packages.d.ts.map +0 -1
  64. package/dist/types/o2g-analytics.d.ts.map +0 -1
  65. package/dist/types/o2g-cc-agent.d.ts.map +0 -1
  66. package/dist/types/o2g-cc-mngt.d.ts.map +0 -1
  67. package/dist/types/o2g-cc-pilot.d.ts.map +0 -1
  68. package/dist/types/o2g-cc-rt.d.ts.map +0 -1
  69. package/dist/types/o2g-cc-stat.d.ts.map +0 -1
  70. package/dist/types/o2g-comlog.d.ts.map +0 -1
  71. package/dist/types/o2g-directory.d.ts.map +0 -1
  72. package/dist/types/o2g-eventSummary.d.ts.map +0 -1
  73. package/dist/types/o2g-maint.d.ts.map +0 -1
  74. package/dist/types/o2g-messaging.d.ts.map +0 -1
  75. package/dist/types/o2g-pbx-mngt.d.ts.map +0 -1
  76. package/dist/types/o2g-phone-set-prog.d.ts.map +0 -1
  77. package/dist/types/o2g-routing.d.ts.map +0 -1
  78. package/dist/types/o2g-rsi.d.ts.map +0 -1
  79. package/dist/types/o2g-telephony.d.ts.map +0 -1
  80. package/dist/types/o2g-users-mngt.d.ts.map +0 -1
  81. package/dist/types/o2g-users.d.ts.map +0 -1
  82. /package/dist/types/{internal/events → events}/chunk-eventing.d.ts +0 -0
  83. /package/dist/types/{internal/events → events}/event-dispatcher.d.ts +0 -0
  84. /package/dist/types/{internal/events → events}/event-packages.d.ts +0 -0
  85. /package/dist/types/{o2g-cc-pilot.d.ts → services/o2g-cc-pilot.d.ts} +0 -0
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # o2g-node-sdk
2
2
 
3
- A Node.js SDK for the ALE International O2G (OmniPCX OpenTouch Gateway) platform, providing a comprehensive TypeScript API for telephony, call control, and contact center services.
3
+ A Node.js SDK for the ALE International O2G (OmniPCX OpenTouch Gateway) platform,
4
+ providing a comprehensive TypeScript API for telephony, call control, management
5
+ and contact center services.
4
6
 
5
7
  ## Requirements
6
8
 
@@ -17,12 +19,14 @@ npm install o2g-node-sdk
17
19
  ## Quick Start
18
20
 
19
21
  ```typescript
20
- import { O2G, Subscription, Telephony } from 'o2g-node-sdk';
22
+ import { O2G, O2GServers, Host, Subscription, Telephony } from 'o2g-node-sdk';
21
23
 
22
- // 1. Initialize the SDK, configure the O2G IP address or FQDN
23
- O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
24
+ // 1. Initialize the SDK with the O2G server configuration
25
+ O2G.initialize("MyApp", O2GServers.Builder
26
+ .primaryHost(new Host("192.168.1.1"))
27
+ .build());
24
28
 
25
- // 2. Login
29
+ // 2. Login — retries automatically if the server is not yet reachable
26
30
  const success = await O2G.login("jdoe", "password");
27
31
  if (!success) {
28
32
  console.error("Login failed");
@@ -50,11 +54,221 @@ await O2G.telephony.makeCall("1234", "5678");
50
54
  await O2G.shutdown();
51
55
  ```
52
56
 
57
+ ## What's New in 2.5.5
58
+
59
+ ### Automatic session recovery
60
+
61
+ The SDK now handles O2G server failures transparently. When the server crashes
62
+ or becomes unreachable, the SDK automatically detects the failure, retries the
63
+ connection with exponential backoff, re-subscribes to events, and notifies the
64
+ application when service is restored. No application-level reconnection logic
65
+ is required.
66
+
67
+ ### `SessionMonitoringPolicy` — full control over recovery behaviour
68
+
69
+ A new `SessionMonitoringPolicy` class allows applications to customise how the
70
+ SDK reacts to each failure scenario:
71
+
72
+ | Callback | When called | Returns |
73
+ |---|---|---|
74
+ | `onConnectError(err)` | Initial connection or recovery attempt fails | `Behavior` — retry or abort |
75
+ | `onChunkError(err, consecutiveErrors)` | Chunk stream network error | `Behavior` — retry or abort |
76
+ | `onKeepAliveError(err)` | Keep-alive network error | `Behavior` — retry or abort |
77
+ | `onChunkEstablished()` | Chunk channel confirmed working | — |
78
+ | `onChunkFatalError(httpStatus)` | Chunk HTTP error (e.g. 401, 403) | — |
79
+ | `onKeepAliveDone()` | Keep-alive acknowledged by server | — |
80
+ | `onKeepAliveFatalError()` | Keep-alive rejected by server | — |
81
+ | `onEventError(err)` | Exception in an application event listener | — |
82
+
83
+ ### Session lifecycle events
84
+
85
+ Three new events on the `O2G` facade:
86
+
87
+ - `O2G.O2G_SESSION_LOST` — fired when the session is lost; recovery starts automatically
88
+ - `O2G.O2G_RECONNECTED` — fired when the session has been successfully recovered
89
+ - `O2G.O2G_SERVER_SWITCHED` — fired when the SDK switches to the secondary server (geographic HA only)
90
+
91
+ ### `O2GServers` — server topology configuration
92
+
93
+ A new `O2GServers` class with a fluent builder replaces the plain
94
+ `{ privateAddress }` object. It supports three deployment topologies:
95
+ standalone, local HA (virtual IP), and geographic HA (two distinct hosts).
96
+
97
+ ```typescript
98
+ // Standalone
99
+ O2GServers.Builder.primaryHost(new Host("10.0.0.1")).build()
100
+
101
+ // Geographic HA — automatic permanent failover to secondary
102
+ O2GServers.Builder
103
+ .primaryHost(new Host("10.0.0.1"))
104
+ .secondaryHost(new Host("10.0.0.2"))
105
+ .build()
106
+ ```
107
+
108
+ ### Geographic HA — automatic permanent failover
109
+
110
+ When a secondary host is configured and the primary becomes unreachable, the
111
+ SDK switches to the secondary immediately and stays there permanently — no
112
+ manual intervention required. The `O2G.O2G_SERVER_SWITCHED` event is emitted
113
+ when the switch occurs.
114
+
115
+ ### `O2G.setLogLevel()` — SDK verbosity control
116
+
117
+ A new static method to control internal SDK logging at runtime:
118
+
119
+ ```typescript
120
+ O2G.setLogLevel(LogLevel.DEBUG); // show all internal traces
121
+ O2G.setLogLevel(LogLevel.NONE); // silent
122
+ ```
123
+
124
+ ### `O2G.currentHost` — active server visibility
125
+
126
+ A new getter exposes which server the SDK is currently connected to:
127
+
128
+ ```typescript
129
+ console.log(`Connected to: ${O2G.currentHost}`);
130
+ ```
131
+
132
+ ---
133
+
53
134
  ## Getting Started
54
135
 
55
136
  New to TypeScript or Node.js? Follow the [Getting Started guide](GETTING_STARTED.md)
56
137
  for a complete step-by-step walkthrough from installing the tools to your first login.
57
138
 
139
+ ## Server Configuration
140
+
141
+ Use `O2GServers` to configure the O2G server topology. Three deployment
142
+ configurations are supported:
143
+
144
+ ### Standalone server
145
+
146
+ ```typescript
147
+ O2G.initialize("MyApp", O2GServers.Builder
148
+ .primaryHost(new Host("10.0.0.1"))
149
+ .build());
150
+ ```
151
+
152
+ ### Local HA (virtual IP)
153
+
154
+ Two O2G server instances sharing the same virtual IP address or URL.
155
+ Configure it exactly like a standalone server — the virtual IP routes
156
+ transparently to whichever node is active:
157
+
158
+ ```typescript
159
+ O2G.initialize("MyApp", O2GServers.Builder
160
+ .primaryHost(new Host("vip.example.com"))
161
+ .build());
162
+ ```
163
+
164
+ ### Geographic HA (two distinct hosts)
165
+
166
+ Two O2G server instances at different locations with distinct IP addresses.
167
+ On primary failure, the SDK switches immediately to the secondary and stays
168
+ there permanently. The {@link O2G.O2G_SERVER_SWITCHED} event is emitted when
169
+ the switch occurs:
170
+
171
+ ```typescript
172
+ O2G.initialize("MyApp", O2GServers.Builder
173
+ .primaryHost(new Host("10.0.0.1"))
174
+ .secondaryHost(new Host("10.0.0.2"))
175
+ .build());
176
+ ```
177
+
178
+ A `Host` can also be configured with both a private and a public address:
179
+
180
+ ```typescript
181
+ new Host("10.0.0.1", "93.12.1.1")
182
+ ```
183
+
184
+ The SDK tries the private address first, then falls back to the public address.
185
+
186
+ ## Session Monitoring and Recovery
187
+
188
+ The SDK automatically handles session failures and recovery. When the O2G server
189
+ crashes or becomes unreachable, the SDK:
190
+
191
+ 1. Detects the failure via the chunk stream or keep-alive
192
+ 2. Notifies the application via the `O2G.O2G_SESSION_LOST` event
193
+ 3. Retries the connection with exponential backoff
194
+ 4. Switches to the secondary server permanently if geographic HA is configured
195
+ 5. Re-subscribes to events after recovery
196
+ 6. Notifies the application via the `O2G.O2G_RECONNECTED` event
197
+
198
+ ### Custom monitoring policy
199
+
200
+ Extend `SessionMonitoringPolicy` to control SDK behaviour and receive
201
+ notifications:
202
+
203
+ ```typescript
204
+ import { O2G, SessionMonitoringPolicy, Behavior, LogLevel } from 'o2g-node-sdk';
205
+
206
+ class MyMonitoringPolicy extends SessionMonitoringPolicy {
207
+
208
+ onConnectError(err: Error): Behavior {
209
+ console.warn(`Connection failed: ${err.message} — retrying in 5s`);
210
+ return Behavior.retryAfter(5_000);
211
+ }
212
+
213
+ onChunkError(err: Error, consecutiveErrors: number): Behavior {
214
+ console.warn(`Chunk error #${consecutiveErrors}: ${err.message}`);
215
+ return Behavior.abort(); // trigger session recovery
216
+ }
217
+
218
+ onSessionLost(reason: string): void {
219
+ console.warn(`Session lost (${reason}) — SDK is recovering...`);
220
+ }
221
+
222
+ onSessionRecovered(): void {
223
+ console.log("Session recovered — back online.");
224
+ }
225
+ }
226
+
227
+ O2G.setMonitoringPolicy(new MyMonitoringPolicy());
228
+ ```
229
+
230
+ Set the policy before calling `O2G.login()`. If not set, the
231
+ `DefaultSessionMonitoringPolicy` is used.
232
+
233
+ ### Session lifecycle events
234
+
235
+ ```typescript
236
+ O2G.on(O2G.O2G_SESSION_LOST, ({ reason }) => {
237
+ console.warn(`Session lost: ${reason} — reconnecting...`);
238
+ });
239
+
240
+ O2G.on(O2G.O2G_RECONNECTED, () => {
241
+ console.log("Session recovered — resuming activity.");
242
+ });
243
+
244
+ O2G.on(O2G.O2G_SERVER_SWITCHED, ({ from, to }) => {
245
+ console.warn(`Switched from ${from} to ${to} permanently.`);
246
+ });
247
+ ```
248
+
249
+ ### Default behaviours
250
+
251
+ | Situation | Default behaviour |
252
+ |---|---|
253
+ | Initial connection fails | Retry after 5 seconds |
254
+ | Chunk network error | Abort → trigger session recovery |
255
+ | Keep-alive network error | Abort → trigger session recovery |
256
+ | Keep-alive rejected by server | Trigger session recovery |
257
+ | Server switched to secondary | Permanent — never switches back |
258
+
259
+ ### Logging
260
+
261
+ Control SDK verbosity using `O2G.setLogLevel()`:
262
+
263
+ ```typescript
264
+ import { O2G, LogLevel } from 'o2g-node-sdk';
265
+
266
+ O2G.setLogLevel(LogLevel.DEBUG); // show all internal SDK traces
267
+ O2G.setLogLevel(LogLevel.INFO); // default
268
+ O2G.setLogLevel(LogLevel.ERROR); // errors only
269
+ O2G.setLogLevel(LogLevel.NONE); // silent
270
+ ```
271
+
58
272
  ## Sessions
59
273
 
60
274
  Three types of sessions are supported:
@@ -62,11 +276,14 @@ Three types of sessions are supported:
62
276
  ### User Session
63
277
 
64
278
  Opened with user credentials. Allows the user to access all user-oriented services.
65
- Most service methods that accept a `loginName` parameter will ignore it in a user session —
66
- the session user is used automatically.
279
+ Most service methods that accept a `loginName` parameter will ignore it in a user
280
+ session — the session user is used automatically.
67
281
 
68
282
  ```typescript
69
- O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
283
+ O2G.initialize("MyApp", O2GServers.Builder
284
+ .primaryHost(new Host("192.168.1.1"))
285
+ .build());
286
+
70
287
  await O2G.login("jdoe", "password");
71
288
 
72
289
  // loginName is ignored — operates on the session user
@@ -77,10 +294,10 @@ await O2G.routing.activateDnd();
77
294
  ### Administrator Session
78
295
 
79
296
  Opened with administrator credentials. Allows access to all services for any user.
80
- Methods that accept a `loginName` parameter require it to be specified in an administrator session.
297
+ Methods that accept a `loginName` parameter require it to be specified in an
298
+ administrator session.
81
299
 
82
300
  ```typescript
83
- O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
84
301
  await O2G.login("admin", "password");
85
302
 
86
303
  // loginName is mandatory in an administrator session
@@ -93,12 +310,13 @@ await O2G.callCenterAgent.getState("agent01");
93
310
 
94
311
  Opened with administrator credentials combined with a supervised user identity.
95
312
  Behaves exactly like a user session for the supervised user — `loginName` is ignored.
96
- This allows an application to use user-oriented services on behalf of a specific user.
97
313
 
98
314
  ```typescript
99
- import { O2G, SupervisedAccount } from 'o2g-node-sdk';
315
+ import { O2G, O2GServers, Host, SupervisedAccount } from 'o2g-node-sdk';
100
316
 
101
- O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
317
+ O2G.initialize("MyApp", O2GServers.Builder
318
+ .primaryHost(new Host("192.168.1.1"))
319
+ .build());
102
320
 
103
321
  // Open a supervised session on behalf of jdoe
104
322
  await O2G.login("admin", "password", new SupervisedAccount("jdoe"));
@@ -108,6 +326,50 @@ await O2G.telephony.getCalls();
108
326
  await O2G.routing.activateDnd();
109
327
  ```
110
328
 
329
+ ## Event Subscription
330
+
331
+ ### Chunk eventing (default)
332
+
333
+ The SDK opens an outgoing HTTPS connection to the O2G server and receives events
334
+ as a stream. No server-side endpoint is required from the application.
335
+
336
+ ```typescript
337
+ const subscription = Subscription.Builder
338
+ .addTelephonyEvents([])
339
+ .addRoutingEvents([])
340
+ .setTimeout(10)
341
+ .build();
342
+
343
+ await O2G.subscribe(subscription);
344
+ ```
345
+
346
+ ### Webhook eventing
347
+
348
+ The O2G server sends events via HTTP POST to a URL provided by the application.
349
+ The application must expose an HTTPS endpoint and implement the `WebHook` interface:
350
+
351
+ ```typescript
352
+ import { O2G, Subscription, WebHook, EventDispatcher } from 'o2g-node-sdk';
353
+
354
+ const myWebHook: WebHook = {
355
+ url: "https://myapp.example.com/o2g/events",
356
+ connectDispatcher: (dispatcher: EventDispatcher) => {
357
+ myDispatcher = dispatcher;
358
+ }
359
+ };
360
+
361
+ const subscription = Subscription.Builder
362
+ .addMaintenanceEvents()
363
+ .setWebHook(myWebHook)
364
+ .build();
365
+
366
+ await O2G.subscribe(subscription);
367
+ ```
368
+
369
+ The SDK provides no built-in HTTP server — the application is responsible for
370
+ exposing the endpoint. See the [webhook examples](examples/webhook) for complete
371
+ working examples with common frameworks.
372
+
111
373
  ## Services
112
374
 
113
375
  | Service | Description | License Required |
@@ -123,7 +385,7 @@ await O2G.routing.activateDnd();
123
385
  | `O2G.callCenterPilot` | CCD pilot monitoring | `CONTACTCENTER_SVCS` |
124
386
  | `O2G.callCenterRealtime` | Real-time ACD statistics | `CONTACTCENTER_SVCS` |
125
387
  | `O2G.callCenterStatistics` | Historical ACD statistics | `CONTACTCENTER_SVCS` |
126
- | `O2G.callCenterManagement` | CCD pilot and calendar management | `CONTACTCENTER_SRV` |
388
+ | `O2G.callCenterManagement` | CCD pilot and calendar management | `CONTACTCENTER_SVCS` |
127
389
  | `O2G.maintenance` | System status and PBX health | — |
128
390
  | `O2G.pbxManagement` | PBX object model management | `MANAGEMENT` |
129
391
  | `O2G.phoneSetProgramming` | Phone device keys and settings | — |
@@ -135,7 +397,8 @@ await O2G.routing.activateDnd();
135
397
  ### Forward calls to voicemail when busy
136
398
 
137
399
  ```typescript
138
- import { O2G, ForwardCondition } from 'o2g-node-sdk';
400
+ import { O2G } from 'o2g-node-sdk';
401
+ import { ForwardCondition } from 'o2g-node-sdk';
139
402
 
140
403
  await O2G.routing.forwardOnVoiceMail(ForwardCondition.BUSY);
141
404
  ```
@@ -173,7 +436,6 @@ await O2G.callCenterPilot.monitorStart("60141");
173
436
  ```typescript
174
437
  import { O2G, Criteria, FilterItem, OperationFilter, SearchResult } from 'o2g-node-sdk';
175
438
 
176
- // Search users whose last name begins with "Smith"
177
439
  const criteria = Criteria.create(FilterItem.LAST_NAME, OperationFilter.BEGINS_WITH, "Smith");
178
440
  await O2G.directory.search(criteria, 10);
179
441
 
@@ -181,15 +443,13 @@ let finished = false;
181
443
  while (!finished) {
182
444
  const result = await O2G.directory.getResults();
183
445
  if (result?.status === SearchResult.Status.NOK) {
184
- // Search still in progress — wait before retrying
185
446
  await new Promise(resolve => setTimeout(resolve, 500));
186
447
  } else if (result?.status === SearchResult.Status.OK) {
187
- // Process available results
188
448
  result.items?.forEach(item => {
189
- item.contacts?.forEach(contact => console.log(contact.firstName, contact.lastName));
449
+ item.contacts?.forEach(contact =>
450
+ console.log(contact.firstName, contact.lastName));
190
451
  });
191
452
  } else {
192
- // FINISH or TIMEOUT — search is complete
193
453
  finished = true;
194
454
  }
195
455
  }
@@ -229,6 +489,35 @@ await O2G.callCenterAgent.logon("acd001", "pg001");
229
489
  await O2G.callCenterAgent.setReady();
230
490
  ```
231
491
 
492
+ ### Configure geographic HA
493
+
494
+ ```typescript
495
+ import { O2G, O2GServers, Host } from 'o2g-node-sdk';
496
+
497
+ O2G.initialize("MyApp", O2GServers.Builder
498
+ .primaryHost(new Host("10.0.0.1"))
499
+ .secondaryHost(new Host("10.0.0.2"))
500
+ .build());
501
+
502
+ O2G.on(O2G.O2G_SERVER_SWITCHED, ({ from, to }) => {
503
+ console.warn(`Switched from ${from} to ${to} permanently.`);
504
+ });
505
+ ```
506
+
507
+ ## Migration from previous versions
508
+
509
+ If you were using the old `{ privateAddress }` syntax, update your code as follows:
510
+
511
+ ```typescript
512
+ // Before
513
+ O2G.initialize("MyApp", { privateAddress: "10.0.0.1" });
514
+
515
+ // After
516
+ O2G.initialize("MyApp", O2GServers.Builder
517
+ .primaryHost(new Host("10.0.0.1"))
518
+ .build());
519
+ ```
520
+
232
521
  ## API Reference
233
522
 
234
523
  - [O2G REST API Reference](https://api.dspp.al-enterprise.com/o2g/)
@@ -241,7 +530,7 @@ This SDK follows the O2G API version it targets:
241
530
  - **Minor**: O2G API patch version (currently 7.5 → 5)
242
531
  - **Patch**: SDK release number
243
532
 
244
- For example, `2.5.0` targets O2G API version 2.7.5.
533
+ For example, `2.5.5` targets O2G API version 2.7.5.
245
534
 
246
535
  ## License
247
536