@vogent/vogent-web-client 0.0.10 → 0.1.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.
- package/dist/VogentCall.js +8 -1
- package/dist/__generated__/gql.d.ts +2 -9
- package/dist/__generated__/gql.js +1 -2
- package/dist/__generated__/graphql.d.ts +589 -36
- package/dist/__generated__/graphql.js +70 -7
- package/dist/devices/LivekitDevice.d.ts +27 -0
- package/dist/devices/LivekitDevice.js +81 -0
- package/dist/queries.js +2 -0
- package/package.json +3 -2
|
@@ -1,13 +1,35 @@
|
|
|
1
|
+
export var AiEvalRecordType;
|
|
2
|
+
(function (AiEvalRecordType) {
|
|
3
|
+
AiEvalRecordType["Dial"] = "DIAL";
|
|
4
|
+
})(AiEvalRecordType || (AiEvalRecordType = {}));
|
|
5
|
+
export var AiEvalRunStatus;
|
|
6
|
+
(function (AiEvalRunStatus) {
|
|
7
|
+
AiEvalRunStatus["Failed"] = "FAILED";
|
|
8
|
+
AiEvalRunStatus["Pending"] = "PENDING";
|
|
9
|
+
AiEvalRunStatus["Running"] = "RUNNING";
|
|
10
|
+
AiEvalRunStatus["Success"] = "SUCCESS";
|
|
11
|
+
})(AiEvalRunStatus || (AiEvalRunStatus = {}));
|
|
12
|
+
export var AiModelOptionValueType;
|
|
13
|
+
(function (AiModelOptionValueType) {
|
|
14
|
+
AiModelOptionValueType["Float"] = "FLOAT";
|
|
15
|
+
AiModelOptionValueType["Int"] = "INT";
|
|
16
|
+
AiModelOptionValueType["String"] = "STRING";
|
|
17
|
+
})(AiModelOptionValueType || (AiModelOptionValueType = {}));
|
|
18
|
+
export var AccessType;
|
|
19
|
+
(function (AccessType) {
|
|
20
|
+
AccessType["Deny"] = "DENY";
|
|
21
|
+
AccessType["Grant"] = "GRANT";
|
|
22
|
+
})(AccessType || (AccessType = {}));
|
|
1
23
|
export var AgentType;
|
|
2
24
|
(function (AgentType) {
|
|
3
25
|
AgentType["CustomFlow"] = "CUSTOM_FLOW";
|
|
4
26
|
AgentType["Standard"] = "STANDARD";
|
|
5
27
|
})(AgentType || (AgentType = {}));
|
|
6
|
-
export var
|
|
7
|
-
(function (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(
|
|
28
|
+
export var AllowedAgentType;
|
|
29
|
+
(function (AllowedAgentType) {
|
|
30
|
+
AllowedAgentType["FlowOnly"] = "FLOW_ONLY";
|
|
31
|
+
AllowedAgentType["StandardOnly"] = "STANDARD_ONLY";
|
|
32
|
+
})(AllowedAgentType || (AllowedAgentType = {}));
|
|
11
33
|
export var AnswerType;
|
|
12
34
|
(function (AnswerType) {
|
|
13
35
|
AnswerType["Human"] = "HUMAN";
|
|
@@ -15,6 +37,11 @@ export var AnswerType;
|
|
|
15
37
|
AnswerType["Other"] = "OTHER";
|
|
16
38
|
AnswerType["Unknown"] = "UNKNOWN";
|
|
17
39
|
})(AnswerType || (AnswerType = {}));
|
|
40
|
+
export var ArrayConditionType;
|
|
41
|
+
(function (ArrayConditionType) {
|
|
42
|
+
ArrayConditionType["All"] = "all";
|
|
43
|
+
ArrayConditionType["Any"] = "any";
|
|
44
|
+
})(ArrayConditionType || (ArrayConditionType = {}));
|
|
18
45
|
export var BrowserDialTokenType;
|
|
19
46
|
(function (BrowserDialTokenType) {
|
|
20
47
|
BrowserDialTokenType["DialSession"] = "DIAL_SESSION";
|
|
@@ -76,6 +103,12 @@ export var DialSessionUpdateReason;
|
|
|
76
103
|
DialSessionUpdateReason["Manual"] = "MANUAL";
|
|
77
104
|
DialSessionUpdateReason["PassComplete"] = "PASS_COMPLETE";
|
|
78
105
|
})(DialSessionUpdateReason || (DialSessionUpdateReason = {}));
|
|
106
|
+
export var DialTaskStatus;
|
|
107
|
+
(function (DialTaskStatus) {
|
|
108
|
+
DialTaskStatus["Completed"] = "COMPLETED";
|
|
109
|
+
DialTaskStatus["Pending"] = "PENDING";
|
|
110
|
+
DialTaskStatus["Running"] = "RUNNING";
|
|
111
|
+
})(DialTaskStatus || (DialTaskStatus = {}));
|
|
79
112
|
export var DialTreeStrategy;
|
|
80
113
|
(function (DialTreeStrategy) {
|
|
81
114
|
DialTreeStrategy["Connect"] = "CONNECT";
|
|
@@ -95,6 +128,11 @@ export var FeedbackType;
|
|
|
95
128
|
FeedbackType["FalsePositive"] = "FALSE_POSITIVE";
|
|
96
129
|
FeedbackType["PickupDelay"] = "PICKUP_DELAY";
|
|
97
130
|
})(FeedbackType || (FeedbackType = {}));
|
|
131
|
+
export var FieldType;
|
|
132
|
+
(function (FieldType) {
|
|
133
|
+
FieldType["Input"] = "INPUT";
|
|
134
|
+
FieldType["Textarea"] = "TEXTAREA";
|
|
135
|
+
})(FieldType || (FieldType = {}));
|
|
98
136
|
export var FlowConditionType;
|
|
99
137
|
(function (FlowConditionType) {
|
|
100
138
|
FlowConditionType["Always"] = "always";
|
|
@@ -107,6 +145,7 @@ export var FlowConditionType;
|
|
|
107
145
|
export var FunctionType;
|
|
108
146
|
(function (FunctionType) {
|
|
109
147
|
FunctionType["Api"] = "API";
|
|
148
|
+
FunctionType["CallTransfer"] = "CALL_TRANSFER";
|
|
110
149
|
FunctionType["Custom"] = "CUSTOM";
|
|
111
150
|
FunctionType["KnowledgeBase"] = "KNOWLEDGE_BASE";
|
|
112
151
|
})(FunctionType || (FunctionType = {}));
|
|
@@ -115,6 +154,15 @@ export var IvrDetectionType;
|
|
|
115
154
|
IvrDetectionType["None"] = "NONE";
|
|
116
155
|
IvrDetectionType["Standard"] = "STANDARD";
|
|
117
156
|
})(IvrDetectionType || (IvrDetectionType = {}));
|
|
157
|
+
export var InferenceEventType;
|
|
158
|
+
(function (InferenceEventType) {
|
|
159
|
+
InferenceEventType["AudioInferenceFirstAudio"] = "AUDIO_INFERENCE_FIRST_AUDIO";
|
|
160
|
+
InferenceEventType["LlmInferenceEnded"] = "LLM_INFERENCE_ENDED";
|
|
161
|
+
InferenceEventType["LlmInferenceFirstToken"] = "LLM_INFERENCE_FIRST_TOKEN";
|
|
162
|
+
InferenceEventType["LlmInferenceStarted"] = "LLM_INFERENCE_STARTED";
|
|
163
|
+
InferenceEventType["StartSpeaking"] = "START_SPEAKING";
|
|
164
|
+
InferenceEventType["TranscriptReceived"] = "TRANSCRIPT_RECEIVED";
|
|
165
|
+
})(InferenceEventType || (InferenceEventType = {}));
|
|
118
166
|
export var KnowledgeBaseFileStatus;
|
|
119
167
|
(function (KnowledgeBaseFileStatus) {
|
|
120
168
|
KnowledgeBaseFileStatus["Active"] = "ACTIVE";
|
|
@@ -124,6 +172,7 @@ export var OpeningLineType;
|
|
|
124
172
|
(function (OpeningLineType) {
|
|
125
173
|
OpeningLineType["InboundOnly"] = "INBOUND_ONLY";
|
|
126
174
|
OpeningLineType["InboundOutbound"] = "INBOUND_OUTBOUND";
|
|
175
|
+
OpeningLineType["None"] = "NONE";
|
|
127
176
|
})(OpeningLineType || (OpeningLineType = {}));
|
|
128
177
|
export var RecordingSettingType;
|
|
129
178
|
(function (RecordingSettingType) {
|
|
@@ -202,15 +251,29 @@ export var VoiceGender;
|
|
|
202
251
|
VoiceGender["Male"] = "MALE";
|
|
203
252
|
VoiceGender["Neutral"] = "NEUTRAL";
|
|
204
253
|
})(VoiceGender || (VoiceGender = {}));
|
|
254
|
+
export var VoiceModel;
|
|
255
|
+
(function (VoiceModel) {
|
|
256
|
+
VoiceModel["Default"] = "DEFAULT";
|
|
257
|
+
VoiceModel["Sesame"] = "SESAME";
|
|
258
|
+
})(VoiceModel || (VoiceModel = {}));
|
|
259
|
+
export var VoiceTier;
|
|
260
|
+
(function (VoiceTier) {
|
|
261
|
+
VoiceTier["Premium"] = "PREMIUM";
|
|
262
|
+
VoiceTier["Standard"] = "STANDARD";
|
|
263
|
+
})(VoiceTier || (VoiceTier = {}));
|
|
264
|
+
export var WebcallType;
|
|
265
|
+
(function (WebcallType) {
|
|
266
|
+
WebcallType["Legacy"] = "legacy";
|
|
267
|
+
WebcallType["Standard"] = "standard";
|
|
268
|
+
})(WebcallType || (WebcallType = {}));
|
|
205
269
|
export var WorkspaceDialEventType;
|
|
206
270
|
(function (WorkspaceDialEventType) {
|
|
207
271
|
WorkspaceDialEventType["DialCreate"] = "DIAL_CREATE";
|
|
208
272
|
WorkspaceDialEventType["StatusChange"] = "STATUS_CHANGE";
|
|
209
273
|
})(WorkspaceDialEventType || (WorkspaceDialEventType = {}));
|
|
210
|
-
export const CreateAdHocDialSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateAdHocDialSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "CreateAdHocDialSessionInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "createAdHocDialSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "telephonyProvider" } }] } }] } }] };
|
|
211
274
|
export const StartDialSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "StartDialSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "startDialSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "dialSessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }] }] } }] };
|
|
212
275
|
export const HangupCallDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "HangupCall" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "dialId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "dropVoicemail" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "transferNumber" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "hangupCall" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "dialId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "dialId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "dropVoicemail" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "dropVoicemail" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "transferNumber" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "transferNumber" } } }] }] } }] };
|
|
213
276
|
export const SetPausedDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "SetPaused" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "dialId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "pauseStatus" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "pauseAI" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "dialId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "dialId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "pauseStatus" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "pauseStatus" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
|
|
214
277
|
export const RefreshTranscriptDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "RefreshTranscript" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "dialId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "watchTranscript" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "dialId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "dialId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "speaker" } }, { "kind": "Field", "name": { "kind": "Name", "value": "text" } }, { "kind": "Field", "name": { "kind": "Name", "value": "detailType" } }] } }] } }] };
|
|
215
|
-
export const BrowserDialTokenDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "BrowserDialToken" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BrowserDialTokenInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "browserDialToken" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "token" } }, { "kind": "Field", "name": { "kind": "Name", "value": "iceConfig" } }] } }] } }] };
|
|
278
|
+
export const BrowserDialTokenDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "BrowserDialToken" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BrowserDialTokenInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "browserDialToken" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "token" } }, { "kind": "Field", "name": { "kind": "Name", "value": "iceConfig" } }, { "kind": "Field", "name": { "kind": "Name", "value": "telephonyProvider" } }, { "kind": "Field", "name": { "kind": "Name", "value": "url" } }] } }] } }] };
|
|
216
279
|
export const ConnectSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "ConnectSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "connectSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "sessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "messageType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "content" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "__typename" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "DialsUpdatedMessage" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "contactId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "dials" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "answerType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "phoneField" } }, { "kind": "Field", "name": { "kind": "Name", "value": "callDispositionId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "systemResultType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "toNumber" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "contactComplete" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "DialConnectMessage" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "dialId" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "SessionUpdatedMessage" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "dialSession" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "reason" } }] } }] } }] } }] } }] };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RemoteParticipant, RemoteTrack, RemoteTrackPublication, Room } from 'livekit-client';
|
|
2
|
+
import { VogentAudioConn } from './VogentDevice';
|
|
3
|
+
export declare class LivekitCall {
|
|
4
|
+
_room: Room;
|
|
5
|
+
_params: any;
|
|
6
|
+
_handlers: {
|
|
7
|
+
ev: 'mute' | 'disconnect';
|
|
8
|
+
fn: (...args: any[]) => void;
|
|
9
|
+
}[];
|
|
10
|
+
constructor(room: Room);
|
|
11
|
+
mute(status: boolean): void;
|
|
12
|
+
sendDigits(k: string): void;
|
|
13
|
+
disconnect(): void;
|
|
14
|
+
sendEvent(evName: string, ...args: any[]): void;
|
|
15
|
+
on(ev: 'mute' | 'disconnect', fn: (...args: any[]) => void): void;
|
|
16
|
+
}
|
|
17
|
+
export declare class LivekitDevice {
|
|
18
|
+
_room: Room;
|
|
19
|
+
_token: string;
|
|
20
|
+
_url: string;
|
|
21
|
+
private constructor();
|
|
22
|
+
static getDevice(sessionToken: string, url: string): Promise<LivekitDevice>;
|
|
23
|
+
disconnect(): void;
|
|
24
|
+
handleTrackSubscribed(track: RemoteTrack, _publication: RemoteTrackPublication, _participant: RemoteParticipant): void;
|
|
25
|
+
handleTrackUnsubscribed(track: RemoteTrack, _publication: RemoteTrackPublication, _participant: RemoteParticipant): void;
|
|
26
|
+
connect(_p: any): Promise<VogentAudioConn>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Room, RoomEvent, } from 'livekit-client';
|
|
2
|
+
export class LivekitCall {
|
|
3
|
+
constructor(room) {
|
|
4
|
+
this._room = room;
|
|
5
|
+
this._params = {};
|
|
6
|
+
this._handlers = [];
|
|
7
|
+
}
|
|
8
|
+
mute(status) {
|
|
9
|
+
if (status) {
|
|
10
|
+
this._room.localParticipant.setMicrophoneEnabled(false).then(() => {
|
|
11
|
+
this.sendEvent('mute', true);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this._room.localParticipant.setMicrophoneEnabled(true).then(() => {
|
|
16
|
+
this.sendEvent('mute', false);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
sendDigits(k) {
|
|
21
|
+
if (k.length != 1) {
|
|
22
|
+
throw new Error('Invalid DTMF digit');
|
|
23
|
+
}
|
|
24
|
+
const code = k === '*' ? 10 : k === '#' ? 11 : parseInt(k);
|
|
25
|
+
this._room.localParticipant.publishDtmf(code, k);
|
|
26
|
+
}
|
|
27
|
+
disconnect() {
|
|
28
|
+
this._room.disconnect();
|
|
29
|
+
}
|
|
30
|
+
sendEvent(evName, ...args) {
|
|
31
|
+
for (const { ev, fn } of this._handlers) {
|
|
32
|
+
if (ev === evName) {
|
|
33
|
+
fn(...args);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
on(ev, fn) {
|
|
38
|
+
this._handlers.push({
|
|
39
|
+
ev,
|
|
40
|
+
fn,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class LivekitDevice {
|
|
45
|
+
constructor(room, token, url) {
|
|
46
|
+
this._room = room;
|
|
47
|
+
this._token = token;
|
|
48
|
+
this._url = url;
|
|
49
|
+
// speeds up connection attempt
|
|
50
|
+
this._room.prepareConnection(this._url, this._token);
|
|
51
|
+
this._room
|
|
52
|
+
.on(RoomEvent.TrackSubscribed, this.handleTrackSubscribed)
|
|
53
|
+
.on(RoomEvent.TrackUnsubscribed, this.handleTrackUnsubscribed)
|
|
54
|
+
.on(RoomEvent.Disconnected, this.disconnect);
|
|
55
|
+
}
|
|
56
|
+
static async getDevice(sessionToken, url) {
|
|
57
|
+
const room = new Room();
|
|
58
|
+
return new LivekitDevice(room, sessionToken, url);
|
|
59
|
+
}
|
|
60
|
+
disconnect() {
|
|
61
|
+
this._room.disconnect();
|
|
62
|
+
}
|
|
63
|
+
handleTrackSubscribed(track, _publication, _participant) {
|
|
64
|
+
if (track.kind === 'audio') {
|
|
65
|
+
const audioElement = track.attach();
|
|
66
|
+
document.body.appendChild(audioElement);
|
|
67
|
+
audioElement.style.display = 'none';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
handleTrackUnsubscribed(track, _publication, _participant) {
|
|
71
|
+
if (track.kind === 'audio') {
|
|
72
|
+
console.log('Track unsubscribed', track);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async connect(_p) {
|
|
76
|
+
await this._room.connect(this._url, this._token, {});
|
|
77
|
+
const lkcall = new LivekitCall(this._room);
|
|
78
|
+
await this._room.localParticipant.setMicrophoneEnabled(true);
|
|
79
|
+
return lkcall;
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/queries.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vogent/vogent-web-client",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@apollo/client": "^3.12.4",
|
|
7
7
|
"@vonage/client-sdk": "^1.7.2",
|
|
8
8
|
"graphql": "^16.10.0",
|
|
9
|
-
"graphql-ws": "^5.16.0"
|
|
9
|
+
"graphql-ws": "^5.16.0",
|
|
10
|
+
"livekit-client": "^2.13.3"
|
|
10
11
|
},
|
|
11
12
|
"main": "dist/index.js",
|
|
12
13
|
"types": "dist/index.d.ts",
|