From 8c5b7614c33a0e731abd12bf9ddb938708f456da Mon Sep 17 00:00:00 2001 From: Jeff Gauthier Date: Wed, 6 Mar 2024 13:55:24 -0500 Subject: [PATCH] Truncate session call id on early media dispatch --- src/domain/Phone/WebRTCPhone.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/domain/Phone/WebRTCPhone.ts b/src/domain/Phone/WebRTCPhone.ts index 972e06be..6fb94bde 100644 --- a/src/domain/Phone/WebRTCPhone.ts +++ b/src/domain/Phone/WebRTCPhone.ts @@ -1577,17 +1577,26 @@ export default class WebRTCPhone extends Emitter implements Phone { this.client.on(this.client.ON_PROGRESS, session => { logger.info('WebRTC progess (180)'); - this.eventEmitter.emit(ON_PROGRESS, this._createCallSession(session, null, { + const callSession = this._createCallSession(session, null, { incoming: false, ringing: true, - }), this.audioOutputDeviceId, this.audioOutputVolume); + }); + + callSession.callId = this.getSipSessionId(session); + + this.eventEmitter.emit(ON_PROGRESS, callSession, this.audioOutputDeviceId, this.audioOutputVolume); }); this.client.on(this.client.ON_EARLY_MEDIA, session => { logger.info('WebRTC early media'); - const callSession = this._createCallSession(session); + const callSession = this._createCallSession(session, null, { + incoming: false, + ringing: true, + }); + + callSession.callId = this.getSipSessionId(session); - this.eventEmitter.emit(ON_EARLY_MEDIA, callSession); + this.eventEmitter.emit(ON_EARLY_MEDIA, callSession, this.audioOutputDeviceId, this.audioOutputVolume); }); this.client.on(this.client.REGISTERED, () => { logger.info('WebRTC registered', {