You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vapi.ts
+61-9Lines changed: 61 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,10 @@ import {
28
28
safeSetInputDevicesAsync,
29
29
}from'./daily-guards';
30
30
31
+
exportinterfaceEndCallMessage{
32
+
type: 'end-call';
33
+
}
34
+
31
35
exportinterfaceAddMessageMessage{
32
36
type: 'add-message';
33
37
message: ChatCompletionMessageParam;
@@ -51,7 +55,8 @@ export interface SayMessage {
51
55
typeVapiClientToServerMessage=
52
56
|AddMessageMessage
53
57
|ControlMessages
54
-
|SayMessage;
58
+
|SayMessage
59
+
|EndCallMessage;
55
60
56
61
typeVapiEventNames=
57
62
|'call-end'
@@ -123,6 +128,31 @@ type StartCallOptions = {
123
128
roomDeleteOnUserLeaveEnabled?: boolean;
124
129
}
125
130
131
+
typeWebCall={
132
+
/**
133
+
* The Vapi WebCall URL. This is the URL that the call will be joined on.
134
+
*
135
+
* call.webCallUrl or call.transport.callUrl
136
+
*/
137
+
webCallUrl: string;
138
+
/**
139
+
* The Vapi WebCall ID. This is the ID of the call.
140
+
*
141
+
* call.id
142
+
*/
143
+
id?: string;
144
+
/**
145
+
* The Vapi WebCall artifact plan. This is the artifact plan of the call.
146
+
*/
147
+
artifactPlan?: {videoRecordingEnabled?: boolean};
148
+
/**
149
+
* The Vapi WebCall assistant. This is the assistant of the call.
150
+
*
151
+
* call.assistant
152
+
*/
153
+
assistant?: {voice?: {provider?: string}};
154
+
}
155
+
126
156
asyncfunctionstartAudioPlayer(
127
157
player: HTMLAudioElement,
128
158
track: MediaStreamTrack,
@@ -816,6 +846,12 @@ export default class Vapi extends VapiEventEmitter {
816
846
},1000);
817
847
}
818
848
849
+
/**
850
+
* Stops the call by destroying the Daily call object.
851
+
*
852
+
* If `roomDeleteOnUserLeaveEnabled` is set to `false`, the Vapi call will be kept alive, allowing reconnections to the same call using the `reconnect` method.
853
+
* If `roomDeleteOnUserLeaveEnabled` is set to `true`, the Vapi call will also be destroyed, preventing any reconnections.
854
+
*/
819
855
asyncstop(): Promise<void>{
820
856
this.started=false;
821
857
if(this.call){
@@ -825,6 +861,11 @@ export default class Vapi extends VapiEventEmitter {
825
861
this.speakingTimeout=null;
826
862
}
827
863
864
+
/**
865
+
* Sends a Live Call Control message to the Vapi server.
0 commit comments