diff --git a/lib/call-session.js b/lib/call-session.js index b7532fa..a4173bc 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -85,10 +85,6 @@ class CallSession extends Emitter { return this.req.has('X-Five9-StreamingPairId'); } - get isPossibleWebRtcClient() { - return this.req.locals.isPossibleWebRtcClient; - } - subscribeForDTMF(dlg) { if (!this._subscribedForDTMF) { this._subscribedForDTMF = true; @@ -312,7 +308,7 @@ class CallSession extends Emitter { _setDlgHandlers(dlg) { const {callId} = dlg.sip; this.activeCallIds.set(callId, this); - if (this.isPossibleWebRtcClient) this.subscribeForDTMF(dlg); + this.subscribeForDTMF(this.uac); dlg.on('destroy', () => { debug('call ended with normal termination'); this.logger.info('call ended with normal termination'); @@ -335,11 +331,11 @@ class CallSession extends Emitter { _setHandlers({uas, uac}) { this.emit('connected'); const callStart = Date.now(); + const call_sid = uac.res?.get('X-Call-Sid'); + const application_sid = this.application_sid || uac.res?.get('X-Application-Sid'); const tags = ['accepted:yes', 'sipStatus:200', `originator:${this.req.locals.originator}`]; this.stats.increment('sbc.terminations', tags); this.activeCallIds.set(this.req.get('Call-ID'), this); - const call_sid = uac.res?.get('X-Call-Sid'); - const application_sid = this.application_sid || uac.res?.get('X-Application-Sid'); if (this.req.locals.cdr) { this.req.locals.cdr = { ...this.req.locals.cdr, @@ -417,7 +413,7 @@ class CallSession extends Emitter { }); }); - if (this.isPossibleWebRtcClient) this.subscribeForDTMF(uac); + this.subscribeForDTMF(uac); uas.on('modify', this._onReinvite.bind(this, uas)); uac.on('modify', this._onReinvite.bind(this, uac));