@@ -98,7 +98,7 @@ export class TwilioRealtimeTransportLayer extends OpenAIRealtimeWebSocket {
98
98
} else {
99
99
this . #logger. debug ( 'Twilio message:' , data ) ;
100
100
}
101
- this . emit ( '*' , {
101
+ ( this as any ) . emit ?. ( '*' , {
102
102
type : 'twilio_message' ,
103
103
message : data ,
104
104
} ) ;
@@ -140,7 +140,7 @@ export class TwilioRealtimeTransportLayer extends OpenAIRealtimeWebSocket {
140
140
'Message:' ,
141
141
message ,
142
142
) ;
143
- this . emit ( 'error' , {
143
+ ( this as any ) . emit ?. ( 'error' , {
144
144
type : 'error' ,
145
145
error,
146
146
} ) ;
@@ -155,14 +155,14 @@ export class TwilioRealtimeTransportLayer extends OpenAIRealtimeWebSocket {
155
155
this . #twilioWebSocket. addEventListener (
156
156
'error' ,
157
157
( error : ErrorEvent | NodeErrorEvent ) => {
158
- this . emit ( 'error' , {
158
+ ( this as any ) . emit ?. ( 'error' , {
159
159
type : 'error' ,
160
160
error,
161
161
} ) ;
162
162
this . close ( ) ;
163
163
} ,
164
164
) ;
165
- this . on ( 'audio_done' , ( ) => {
165
+ ( this as any ) . on ?. ( 'audio_done' , ( ) => {
166
166
this . #twilioWebSocket. send (
167
167
JSON . stringify ( {
168
168
event : 'mark' ,
@@ -178,7 +178,7 @@ export class TwilioRealtimeTransportLayer extends OpenAIRealtimeWebSocket {
178
178
179
179
updateSessionConfig ( config : Partial < RealtimeSessionConfig > ) : void {
180
180
const newConfig = this . _setInputAndOutputAudioFormat ( config ) ;
181
- super . updateSessionConfig ( newConfig ) ;
181
+ ( this as any ) . updateSessionConfig ?. ( newConfig ) ;
182
182
}
183
183
184
184
_interrupt ( _elapsedTime : number , cancelOngoingResponse : boolean = true ) {
@@ -221,6 +221,6 @@ export class TwilioRealtimeTransportLayer extends OpenAIRealtimeWebSocket {
221
221
} ,
222
222
} ) ,
223
223
) ;
224
- this . emit ( 'audio' , audioEvent ) ;
224
+ ( this as any ) . emit ?. ( 'audio' , audioEvent ) ;
225
225
}
226
226
}
0 commit comments