o2g-node-sdk 1.0.1 → 2.4.0

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 (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +230 -5
  3. package/dist/o2g-node-sdk.js +41601 -1
  4. package/dist/o2g-node-sdk.js.map +1 -1
  5. package/package.json +40 -8
  6. package/dist/ErrorInfo.d.ts +0 -87
  7. package/dist/host.d.ts +0 -17
  8. package/dist/o2g-analytics.d.ts +0 -66
  9. package/dist/o2g-cc-agent.d.ts +0 -247
  10. package/dist/o2g-cc-mngt.d.ts +0 -32
  11. package/dist/o2g-cc-pilot.d.ts +0 -42
  12. package/dist/o2g-comlog.d.ts +0 -173
  13. package/dist/o2g-directory.d.ts +0 -88
  14. package/dist/o2g-eventSummary.d.ts +0 -33
  15. package/dist/o2g-maint.d.ts +0 -48
  16. package/dist/o2g-messaging.d.ts +0 -115
  17. package/dist/o2g-node-sdk.d.ts +0 -159
  18. package/dist/o2g-pbx-mngt.d.ts +0 -146
  19. package/dist/o2g-phone-set-prog.d.ts +0 -29
  20. package/dist/o2g-routing.d.ts +0 -267
  21. package/dist/o2g-rsi.d.ts +0 -160
  22. package/dist/o2g-telephony.d.ts +0 -795
  23. package/dist/o2g-user-mngt.d.ts +0 -42
  24. package/dist/o2g-users.d.ts +0 -85
  25. package/dist/subscription.d.ts +0 -258
  26. package/dist/types/analytics/call-type.d.ts +0 -24
  27. package/dist/types/analytics/charging-file.d.ts +0 -27
  28. package/dist/types/analytics/charging-result.d.ts +0 -43
  29. package/dist/types/analytics/charging.d.ts +0 -105
  30. package/dist/types/analytics/incident.d.ts +0 -46
  31. package/dist/types/analytics/tel-facility.d.ts +0 -44
  32. package/dist/types/analytics/time-range.d.ts +0 -22
  33. package/dist/types/cc-agent/cc-agent-events.d.ts +0 -54
  34. package/dist/types/cc-agent/cc-agent-types.d.ts +0 -71
  35. package/dist/types/cc-agent/intrusion-mode.d.ts +0 -24
  36. package/dist/types/cc-agent/operator-dyn-state.d.ts +0 -56
  37. package/dist/types/cc-agent/operator-main-state.d.ts +0 -21
  38. package/dist/types/cc-agent/operator-type.d.ts +0 -16
  39. package/dist/types/cc-mngt/calendar/abstract-calendar.d.ts +0 -7
  40. package/dist/types/cc-mngt/calendar/calendar.d.ts +0 -19
  41. package/dist/types/cc-mngt/calendar/day-of-week.d.ts +0 -33
  42. package/dist/types/cc-mngt/calendar/exception-calendar.d.ts +0 -26
  43. package/dist/types/cc-mngt/calendar/normal-calendar.d.ts +0 -27
  44. package/dist/types/cc-mngt/calendar/transition.d.ts +0 -49
  45. package/dist/types/cc-mngt/cc-mngt-types.d.ts +0 -0
  46. package/dist/types/cc-mngt/pilot-rule-set.d.ts +0 -27
  47. package/dist/types/cc-mngt/pilot-rule.d.ts +0 -14
  48. package/dist/types/cc-mngt/pilot.d.ts +0 -56
  49. package/dist/types/cc-pilot/cc-pilot-events.d.ts +0 -111
  50. package/dist/types/comlog/com-record.d.ts +0 -51
  51. package/dist/types/comlog/comlog-events.d.ts +0 -74
  52. package/dist/types/comlog/comlog-types.d.ts +0 -131
  53. package/dist/types/comlog/option.d.ts +0 -23
  54. package/dist/types/comlog/page.d.ts +0 -33
  55. package/dist/types/comlog/query-filter.d.ts +0 -44
  56. package/dist/types/comlog/query-result.d.ts +0 -27
  57. package/dist/types/comlog/reason.d.ts +0 -61
  58. package/dist/types/comlog/role.d.ts +0 -17
  59. package/dist/types/common/common-types.d.ts +0 -78
  60. package/dist/types/directory/criteria.d.ts +0 -90
  61. package/dist/types/directory/directory-types.d.ts +0 -44
  62. package/dist/types/directory/filter-item.d.ts +0 -21
  63. package/dist/types/directory/operation-filter.d.ts +0 -21
  64. package/dist/types/events/events.d.ts +0 -54
  65. package/dist/types/events/o2g-event.d.ts +0 -3
  66. package/dist/types/eventsummary/event-summary-counter.d.ts +0 -44
  67. package/dist/types/eventsummary/event-summary-events.d.ts +0 -15
  68. package/dist/types/maint/maint-events.d.ts +0 -51
  69. package/dist/types/maint/maint-types.d.ts +0 -162
  70. package/dist/types/messaging/messaging-types.d.ts +0 -120
  71. package/dist/types/pbxmngt/attribute-filter.d.ts +0 -30
  72. package/dist/types/pbxmngt/attribute-type.d.ts +0 -34
  73. package/dist/types/pbxmngt/filter.d.ts +0 -46
  74. package/dist/types/pbxmngt/model.d.ts +0 -63
  75. package/dist/types/pbxmngt/pbx-attr-map.d.ts +0 -91
  76. package/dist/types/pbxmngt/pbx-attribute.d.ts +0 -87
  77. package/dist/types/pbxmngt/pbx-object.d.ts +0 -45
  78. package/dist/types/pbxmngt/pbxmngt-events.d.ts +0 -59
  79. package/dist/types/pbxmngt/pbxmngt-types.d.ts +0 -14
  80. package/dist/types/phoneset/device-key.d.ts +0 -27
  81. package/dist/types/phoneset/phoneset-types.d.ts +0 -17
  82. package/dist/types/phoneset/pin-control.d.ts +0 -21
  83. package/dist/types/phoneset/pin.d.ts +0 -50
  84. package/dist/types/phoneset/programmable-key.d.ts +0 -23
  85. package/dist/types/phoneset/softkey.d.ts +0 -17
  86. package/dist/types/routing/destination.d.ts +0 -19
  87. package/dist/types/routing/forward.d.ts +0 -51
  88. package/dist/types/routing/overflow.d.ts +0 -42
  89. package/dist/types/routing/routing-capability.d.ts +0 -31
  90. package/dist/types/routing/routing-events.d.ts +0 -15
  91. package/dist/types/routing/routing-state.d.ts +0 -67
  92. package/dist/types/routing/routing-types.d.ts +0 -10
  93. package/dist/types/rsi/add-digit-coll-criteria.d.ts +0 -16
  94. package/dist/types/rsi/collection-cause.d.ts +0 -21
  95. package/dist/types/rsi/routing-caller-type.d.ts +0 -17
  96. package/dist/types/rsi/routing-reason.d.ts +0 -25
  97. package/dist/types/rsi/rsi-events.d.ts +0 -76
  98. package/dist/types/rsi/rsi-types.d.ts +0 -49
  99. package/dist/types/rsi/tones.d.ts +0 -25
  100. package/dist/types/telephony/RecordingAction.d.ts +0 -6
  101. package/dist/types/telephony/acr-skill.d.ts +0 -29
  102. package/dist/types/telephony/telephony-events.d.ts +0 -292
  103. package/dist/types/telephony/telephony-types.d.ts +0 -587
  104. package/dist/types/users/users-events.d.ts +0 -33
  105. package/dist/types/users/users-types.d.ts +0 -129
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ALE International
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,10 +1,235 @@
1
- # o2g-sdk-node
1
+ # o2g-node-sdk
2
2
 
3
- A Node.js SDK for the O2G platform, providing tools to interact with O2G telephony and call control features.
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.
4
4
 
5
- ## Installation
5
+ ## Requirements
6
+
7
+ - Node.js >= 14
8
+ - An OmniPCX Enterprise node connected to an O2G server
9
+ - An O2G API license appropriate for the services you intend to use
6
10
 
7
- Install via npm:
11
+ ## Installation
8
12
 
9
13
  ```bash
10
- npm install o2g-sdk-node
14
+ npm install o2g-node-sdk
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```typescript
20
+ import { O2G, Subscription, Telephony } from 'o2g-node-sdk';
21
+
22
+ // 1. Initialize the SDK
23
+ O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
24
+
25
+ // 2. Login
26
+ const success = await O2G.login("oxe12000", "password");
27
+ if (!success) {
28
+ console.error("Login failed");
29
+ process.exit(1);
30
+ }
31
+
32
+ // 3. Subscribe to events
33
+ const subscription = Subscription.Builder
34
+ .addTelephonyEvents([])
35
+ .addRoutingEvents([])
36
+ .setTimeout(10)
37
+ .build();
38
+
39
+ await O2G.subscribe(subscription);
40
+
41
+ // 4. Listen for events
42
+ O2G.telephony.on(Telephony.ON_CALL_CREATED, (event) => {
43
+ console.log("New call:", event.callRef);
44
+ });
45
+
46
+ // 5. Make a call
47
+ await O2G.telephony.makeCall("1234", "5678");
48
+
49
+ // 6. Shutdown when done
50
+ await O2G.shutdown();
51
+ ```
52
+
53
+ ## Sessions
54
+
55
+ Three types of sessions are supported:
56
+
57
+ ### User Session
58
+
59
+ Opened with user credentials. Allows the user to access all user-oriented services.
60
+ Most service methods that accept a `loginName` parameter will ignore it in a user session —
61
+ the session user is used automatically.
62
+
63
+ ```typescript
64
+ O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
65
+ await O2G.login("oxe1232", "password");
66
+
67
+ // loginName is ignored — operates on the session user
68
+ await O2G.telephony.getCalls();
69
+ await O2G.routing.activateDnd();
70
+ ```
71
+
72
+ ### Administrator Session
73
+
74
+ Opened with administrator credentials. Allows access to all services for any user.
75
+ Methods that accept a `loginName` parameter require it to be specified in an administrator session.
76
+
77
+ ```typescript
78
+ O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
79
+ await O2G.login("admin", "password");
80
+
81
+ // loginName is mandatory in an administrator session
82
+ await O2G.telephony.getCalls("oxe1234");
83
+ await O2G.usersManagement.getLogins();
84
+ await O2G.callCenterAgent.getState("oxe1234");
85
+ ```
86
+
87
+ ### Supervised Session
88
+
89
+ Opened with administrator credentials combined with a supervised user identity.
90
+ Behaves exactly like a user session for the supervised user — `loginName` is ignored.
91
+ This allows an application to use user-oriented services on behalf of a specific user.
92
+
93
+ ```typescript
94
+ import { O2G, SupervisedAccount } from 'o2g-node-sdk';
95
+
96
+ O2G.initialize("MyApp", { privateAddress: "192.168.1.1" });
97
+
98
+ // Open a supervised session on behalf of jdoe
99
+ await O2G.login("admin", "password", SupervisedAccount.withPhoneNumber("12000"));
100
+
101
+ // Now operates as jdoe — loginName is ignored
102
+ await O2G.telephony.getCalls();
103
+ await O2G.routing.activateDnd();
104
+ ```
105
+
106
+ ## Services
107
+
108
+ | Service | Description | License Required |
109
+ |---|---|---|
110
+ | `O2G.telephony` | Call control, transfer, conference, recording | `TELEPHONY_ADVANCED` |
111
+ | `O2G.routing` | Forward, overflow, Do Not Disturb | `TELEPHONY_ADVANCED` |
112
+ | `O2G.comlog` | Communication history records | `TELEPHONY_ADVANCED` |
113
+ | `O2G.messaging` | Voicemail and mailbox management | `TELEPHONY_ADVANCED` |
114
+ | `O2G.directory` | Enterprise directory search | `TELEPHONY_ADVANCED` |
115
+ | `O2G.eventSummary` | Missed calls, voicemail counters | `TELEPHONY_ADVANCED` |
116
+ | `O2G.users` | User profile and preferences | — |
117
+ | `O2G.callCenterAgent` | CCD agent state and skills | `CONTACTCENTER_AGENT` |
118
+ | `O2G.callCenterPilot` | CCD pilot monitoring | `CONTACTCENTER_SVCS` |
119
+ | `O2G.callCenterRealtime` | Real-time ACD statistics | `CONTACTCENTER_SVCS` |
120
+ | `O2G.callCenterStatistics` | Historical ACD statistics | `CONTACTCENTER_SVCS` |
121
+ | `O2G.callCenterManagement` | CCD pilot and calendar management | `CONTACTCENTER_SRV` |
122
+ | `O2G.maintenance` | System status and PBX health | — |
123
+ | `O2G.pbxManagement` | PBX object model management | `MANAGEMENT` |
124
+ | `O2G.phoneSetProgramming` | Phone device keys and settings | — |
125
+ | `O2G.usersManagement` | Administrator user management | — |
126
+ | `O2G.analytics` | Charging and incident data | — |
127
+
128
+ ## Examples
129
+
130
+ ### Forward calls to voicemail when busy
131
+
132
+ ```typescript
133
+ import { O2G, ForwardCondition } from 'o2g-node-sdk';
134
+
135
+ await O2G.routing.forwardOnVoiceMail(ForwardCondition.BUSY);
136
+ ```
137
+
138
+ ### Transfer a call
139
+
140
+ ```typescript
141
+ // Supervised transfer
142
+ await O2G.telephony.transfer(activeCallRef, heldCallRef);
143
+
144
+ // Blind transfer
145
+ await O2G.telephony.blindTransfer(callRef, "5678");
146
+ ```
147
+
148
+ ### Monitor a CCD pilot
149
+
150
+ ```typescript
151
+ import { O2G, CallCenterPilot, Subscription } from 'o2g-node-sdk';
152
+
153
+ const subscription = Subscription.Builder
154
+ .addCallCenterPilotEvents(["60141"])
155
+ .build();
156
+
157
+ await O2G.subscribe(subscription);
158
+
159
+ O2G.callCenterPilot.on(CallCenterPilot.ON_PILOT_CALL_CREATED, (event) => {
160
+ console.log("Call on pilot:", event.pilotNumber);
161
+ });
162
+
163
+ await O2G.callCenterPilot.monitorStart("60141");
164
+ ```
165
+
166
+ ### Search the directory
167
+
168
+ ```typescript
169
+ import { O2G, Criteria, SearchResult } from 'o2g-node-sdk';
170
+
171
+ const criteria = new Criteria({ lastName: "Smith" });
172
+ await O2G.directory.search(criteria, 10);
173
+
174
+ let finished = false;
175
+ while (!finished) {
176
+ const result = await O2G.directory.getResults();
177
+ if (result?.resultCode === SearchResult.ResultCode.OK) {
178
+ result.items.forEach(item => console.log(item.firstName, item.lastName));
179
+ } else if (result?.resultCode === SearchResult.ResultCode.FINISH) {
180
+ finished = true;
181
+ } else {
182
+ await new Promise(resolve => setTimeout(resolve, 500));
183
+ }
184
+ }
185
+ ```
186
+
187
+ ### Query communication log records
188
+
189
+ ```typescript
190
+ import { O2G, QueryFilter, FilterOption } from 'o2g-node-sdk';
191
+
192
+ const filter = new QueryFilter({
193
+ after: new Date('2026-01-01'),
194
+ before: new Date('2026-01-31'),
195
+ options: [FilterOption.UNANSWERED]
196
+ });
197
+
198
+ const result = await O2G.comlog.getComRecords(filter);
199
+ console.log(`Total records: ${result?.totalCount}`);
200
+ ```
201
+
202
+ ### Log on a CCD agent
203
+
204
+ ```typescript
205
+ import { O2G, CallCenterAgent, Subscription } from 'o2g-node-sdk';
206
+
207
+ const subscription = Subscription.Builder
208
+ .addCallCenterAgentEvents([])
209
+ .build();
210
+
211
+ await O2G.subscribe(subscription);
212
+
213
+ O2G.callCenterAgent.on(CallCenterAgent.ON_AGENT_STATE_CHANGED, (event) => {
214
+ console.log("Agent state changed:", event);
215
+ });
216
+
217
+ await O2G.callCenterAgent.logon("1243", "pg001");
218
+ await O2G.callCenterAgent.setReady();
219
+ ```
220
+
221
+ ## Versioning
222
+
223
+ This SDK follows the O2G API version it targets:
224
+
225
+ - **Major**: O2G API major version (currently 2)
226
+ - **Minor**: O2G API patch version (currently 7.4 → 4)
227
+ - **Patch**: SDK release number
228
+
229
+ For example, `2.4.0` targets O2G API version 2.7.4.
230
+
231
+ ## License
232
+
233
+ Copyright 2026 ALE International
234
+
235
+ This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.