@aculab-com/aculab-webrtc
Advanced tools
Comparing version 4.0.6 to 4.0.7
@@ -0,0 +0,0 @@ _aculab-webrtc javascript interface_ |
type Report = { | ||
[key: string]: unknown; | ||
}; | ||
type RTCStatsReport = ReadonlyMap<string, Report>; | ||
type RTCReportKind = 'audio' | 'video'; | ||
@@ -49,2 +48,1 @@ export declare class AculabCloudCallStatistics { | ||
export {}; | ||
//# sourceMappingURL=aculab-cloud-call-statistics.d.ts.map |
@@ -1,2 +0,5 @@ | ||
export class AculabCloudCallStatistics { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudCallStatistics = void 0; | ||
class AculabCloudCallStatistics { | ||
_reports; | ||
@@ -128,1 +131,2 @@ _reportsById; | ||
} | ||
exports.AculabCloudCallStatistics = AculabCloudCallStatistics; |
@@ -175,2 +175,1 @@ import { MediaEventSessionDescriptionHandler } from './media-event-session-description-handler'; | ||
} | ||
//# sourceMappingURL=aculab-cloud-call.d.ts.map |
@@ -0,6 +1,9 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudCall = void 0; | ||
/* eslint-disable @typescript-eslint/restrict-plus-operands */ | ||
import { SessionState } from 'sip.js'; | ||
import { MediaEventSessionDescriptionHandler } from './media-event-session-description-handler'; | ||
import { v4 as uuidV4 } from 'uuid'; | ||
import { AculabCloudCallStatistics } from './aculab-cloud-call-statistics'; | ||
const sip_js_1 = require("sip.js"); | ||
const media_event_session_description_handler_1 = require("./media-event-session-description-handler"); | ||
const uuid_1 = require("uuid"); | ||
const aculab_cloud_call_statistics_1 = require("./aculab-cloud-call-statistics"); | ||
/** | ||
@@ -28,3 +31,3 @@ * make address:port string from cand object | ||
} | ||
export class AculabCloudCall { | ||
class AculabCloudCall { | ||
client; | ||
@@ -70,3 +73,3 @@ _connected; | ||
this._sdh_options = undefined; | ||
this._callUuid = uuidV4(); | ||
this._callUuid = (0, uuid_1.v4)(); | ||
this._allowed_reinvite = reinvite_possible; | ||
@@ -227,6 +230,6 @@ this._legacy_interface = legacy_interface; | ||
this._session.stateChange.addListener(state => { | ||
if (state === SessionState.Established) { | ||
if (state === sip_js_1.SessionState.Established) { | ||
this._onaccepted(); | ||
} | ||
if (state === SessionState.Terminated) { | ||
if (state === sip_js_1.SessionState.Terminated) { | ||
this._onterminated(); | ||
@@ -709,2 +712,4 @@ } | ||
let remoteType = '?'; | ||
let remoteCandidateId = ''; | ||
let localCandidateId = ''; | ||
if (stats) { | ||
@@ -717,30 +722,36 @@ let selectedPairId = ''; | ||
}); | ||
let candidatePair = stats.get(selectedPairId); | ||
if (!candidatePair) { | ||
stats.forEach(stat => { | ||
if (stat.id == selectedPairId) { | ||
remoteCandidateId = stat.remoteCandidateId; | ||
localCandidateId = stat.localCandidateId; | ||
} | ||
}); | ||
if (remoteCandidateId === '') { | ||
stats.forEach(stat => { | ||
if (stat.type == 'candidate-pair' && stat.selected) { | ||
candidatePair = stat; | ||
remoteCandidateId = stat.remoteCandidateId; | ||
localCandidateId = stat.localCandidateId; | ||
} | ||
}); | ||
} | ||
if (candidatePair) { | ||
const remote = stats.get(candidatePair.remoteCandidateId); | ||
if (typeof remote?.candidateType === 'string') { | ||
remoteType = remote.candidateType; | ||
} | ||
if (remote) { | ||
remoteAddr = _extractAddrPort(remote); | ||
} | ||
const local = stats.get(candidatePair.localCandidateId); | ||
if (local?.relayProtocol && | ||
typeof local.relayProtocol === 'string') { | ||
localType = local.relayProtocol; | ||
} | ||
else if (local?.protocol && | ||
typeof local.protocol === 'string') { | ||
localType = local.protocol; | ||
} | ||
if (local) { | ||
localAddr = _extractAddrPort(local); | ||
} | ||
if (remoteCandidateId) { | ||
stats.forEach(stat => { | ||
if (stat.type == 'remote-candidate' && stat.id == remoteCandidateId) { | ||
if (typeof stat?.candidateType === 'string') { | ||
remoteType = stat.candidateType; | ||
} | ||
remoteAddr = _extractAddrPort(stat); | ||
} | ||
else if (stat.type == 'local-candidate' && stat.id == localCandidateId) { | ||
if (stat?.relayProtocol && | ||
typeof stat.relayProtocol === 'string') { | ||
localType = stat.relayProtocol; | ||
} | ||
else if (stat?.protocol && | ||
typeof stat.protocol === 'string') { | ||
localType = stat.protocol; | ||
} | ||
localAddr = _extractAddrPort(stat); | ||
} | ||
}); | ||
} | ||
@@ -869,3 +880,3 @@ } | ||
this._sdh_options = | ||
MediaEventSessionDescriptionHandler.fixup_options(options); | ||
media_event_session_description_handler_1.MediaEventSessionDescriptionHandler.fixup_options(options); | ||
const opts = { | ||
@@ -906,3 +917,3 @@ sessionDescriptionHandlerOptions: this._sdh_options, | ||
} | ||
return new AculabCloudCallStatistics({ | ||
return new aculab_cloud_call_statistics_1.AculabCloudCallStatistics({ | ||
reports: await pc.getStats(), | ||
@@ -913,1 +924,2 @@ reportsToCollect: reportsToCollect, | ||
} | ||
exports.AculabCloudCall = AculabCloudCall; |
@@ -27,2 +27,1 @@ import { AculabCloudClient } from './aculab-cloud-client'; | ||
} | ||
//# sourceMappingURL=aculab-cloud-caller.d.ts.map |
'use strict'; | ||
import { AculabCloudClient } from './aculab-cloud-client'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudCaller = void 0; | ||
const aculab_cloud_client_1 = require("./aculab-cloud-client"); | ||
// NB this is the old v1 api, implemented using the new api | ||
export class AculabCloudCaller { | ||
class AculabCloudCaller { | ||
acc; | ||
@@ -30,3 +32,3 @@ oc; | ||
this.makeCall = function (a_targetcloudid, a_targetservice, a_callerid) { | ||
this.acc = new AculabCloudClient(a_targetcloudid, 'acc2', a_callerid, this.logLevel, true); | ||
this.acc = new aculab_cloud_client_1.AculabCloudClient(a_targetcloudid, 'acc2', a_callerid, this.logLevel, true); | ||
this.oc = this.acc.makeOutgoing(a_targetservice); | ||
@@ -63,3 +65,3 @@ // plumb up callbacks | ||
this.isSupported = function () { | ||
return AculabCloudClient.isSupported(); | ||
return aculab_cloud_client_1.AculabCloudClient.isSupported(); | ||
}; | ||
@@ -97,1 +99,2 @@ this.sendDtmf = function (dtmf) { | ||
} | ||
exports.AculabCloudCaller = AculabCloudCaller; |
@@ -83,3 +83,3 @@ import { UserAgent, Web, Session, Core as sipCore } from 'sip.js'; | ||
*/ | ||
callService(serviceName: string): AculabCloudOutgoingServiceCall; | ||
callService(serviceName: string, options?: CallOptions | undefined): AculabCloudOutgoingServiceCall; | ||
/** | ||
@@ -123,2 +123,1 @@ * Create a client call | ||
} | ||
//# sourceMappingURL=aculab-cloud-client.d.ts.map |
'use strict'; | ||
import { RegistererState, UserAgent, URI, Web, } from 'sip.js'; | ||
import { AculabCloudIncomingCall } from './aculab-cloud-incoming-call'; | ||
import { AculabCloudOutgoingClientCall } from './aculab-cloud-outgoing-client-call'; | ||
import { MediaEventSessionDescriptionHandler } from './media-event-session-description-handler'; | ||
import { TokenRegisterer } from './token-registerer'; | ||
import { AculabCloudOutgoingServiceCall } from './aculab-cloud-outgoing-service-call'; | ||
export class AculabCloudClient { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudClient = void 0; | ||
const sip_js_1 = require("sip.js"); | ||
const aculab_cloud_incoming_call_1 = require("./aculab-cloud-incoming-call"); | ||
const aculab_cloud_outgoing_client_call_1 = require("./aculab-cloud-outgoing-client-call"); | ||
const media_event_session_description_handler_1 = require("./media-event-session-description-handler"); | ||
const token_registerer_1 = require("./token-registerer"); | ||
const aculab_cloud_outgoing_service_call_1 = require("./aculab-cloud-outgoing-service-call"); | ||
class AculabCloudClient { | ||
loglevel; | ||
@@ -84,4 +86,4 @@ _cloud; | ||
} | ||
this._ua = new UserAgent({ | ||
uri: new URI('sip', clientId, webRtcAccessKey + '.webrtc-' + cloudId + '.aculabcloud.net'), | ||
this._ua = new sip_js_1.UserAgent({ | ||
uri: new sip_js_1.URI('sip', clientId, webRtcAccessKey + '.webrtc-' + cloudId + '.aculabcloud.net'), | ||
transportOptions: { | ||
@@ -114,6 +116,2 @@ server: 'wss://webrtc-' + cloudId + '.aculabcloud.net/sipproxy', | ||
this._transport_connected = false; | ||
// clear registration | ||
if (this._registerer) { | ||
this._registerer.setToken(''); | ||
} | ||
// disconnect all calls | ||
@@ -132,3 +130,10 @@ this._calls.forEach(call => { | ||
// queue reconnect attempt | ||
this.reconnect(); // TODO: should this only be "if (err)" | ||
if (err) { | ||
this.reconnect(); | ||
} | ||
else if (this._registerer) { | ||
// clear registration | ||
this._registerer.setToken(''); | ||
} | ||
; | ||
}, | ||
@@ -143,4 +148,4 @@ onInvite: invitation => { | ||
if (this.onIncoming) { | ||
const ic = new AculabCloudIncomingCall(this, invitation); | ||
const media_dirs = MediaEventSessionDescriptionHandler.get_audio_video_directions(invitation.body); | ||
const ic = new aculab_cloud_incoming_call_1.AculabCloudIncomingCall(this, invitation); | ||
const media_dirs = media_event_session_description_handler_1.MediaEventSessionDescriptionHandler.get_audio_video_directions(invitation.body); | ||
this._calls.add(ic); | ||
@@ -250,5 +255,4 @@ let caller_type = 'other'; | ||
sessionDescriptionHandlerFactory(session, options) { | ||
console.log("mjw... sessionDescriptionHandlerFactory", options); | ||
// provide a media stream factory | ||
const mediaStreamFactory = Web.defaultMediaStreamFactory(); | ||
const mediaStreamFactory = sip_js_1.Web.defaultMediaStreamFactory(); | ||
// make sure we allow `0` to be passed in so timeout can be disabled | ||
@@ -265,3 +269,3 @@ const iceGatheringTimeout = (options === null || options === void 0 | ||
iceGatheringTimeout, | ||
peerConnectionConfiguration: Object.assign(Object.assign(Object.assign({}, Web.defaultPeerConnectionConfiguration()), options === null || options === void 0 | ||
peerConnectionConfiguration: Object.assign(Object.assign(Object.assign({}, sip_js_1.Web.defaultPeerConnectionConfiguration()), options === null || options === void 0 | ||
? void 0 | ||
@@ -275,2 +279,4 @@ : options.peerConnectionConfiguration), this._peerConnectionConfiguration === null || this._peerConnectionConfiguration === void 0 | ||
if (this.iceServers != null) { | ||
// This is deprecated functionality. iceServers should be passed into | ||
// setPeerConnectionConfiguration | ||
sessionDescriptionHandlerConfiguration.peerConnectionConfiguration.iceServers = | ||
@@ -284,5 +290,4 @@ this.iceServers; | ||
} | ||
console.log("mjw... config", sessionDescriptionHandlerConfiguration.peerConnectionConfiguration); | ||
const logger = session.userAgent.getLogger('sip.SessionDescriptionHandler'); | ||
return new MediaEventSessionDescriptionHandler(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration); | ||
return new media_event_session_description_handler_1.MediaEventSessionDescriptionHandler(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration); | ||
} | ||
@@ -311,3 +316,3 @@ /** | ||
} | ||
const request_uri = new URI('sip', '', `webrtc-${this._cloud}.aculabcloud.net`); | ||
const request_uri = new sip_js_1.URI('sip', '', `webrtc-${this._cloud}.aculabcloud.net`); | ||
const to_uri = request_uri; | ||
@@ -377,4 +382,4 @@ const from_uri = this._ua.configuration.uri; | ||
if (this._calls.size === 0 && | ||
this._token === null && | ||
this._registered_token === null) { | ||
this._token === '' && | ||
this._registered_token === '') { | ||
// no longer need websocket connection | ||
@@ -406,3 +411,3 @@ void this._ua.stop(); | ||
*/ | ||
callService(serviceName) { | ||
callService(serviceName, options = undefined) { | ||
// some users are including the sip: in the service name, strip it | ||
@@ -426,3 +431,3 @@ if (serviceName.startsWith('sip%3A') || serviceName.startsWith('sip%3a')) { | ||
} | ||
const outcall = new AculabCloudOutgoingServiceCall(this, serviceName, this._legacy_interface); | ||
const outcall = new aculab_cloud_outgoing_service_call_1.AculabCloudOutgoingServiceCall(this, serviceName, options, this._legacy_interface); | ||
this._calls.add(outcall); | ||
@@ -473,3 +478,3 @@ return outcall; | ||
}); | ||
const outcall = new AculabCloudOutgoingClientCall(this, clientId, token, options); | ||
const outcall = new aculab_cloud_outgoing_client_call_1.AculabCloudOutgoingClientCall(this, clientId, token, options); | ||
this._calls.add(outcall); | ||
@@ -502,8 +507,8 @@ return outcall; | ||
if (!this._registerer) { | ||
this._registerer = new TokenRegisterer(this._ua); | ||
this._registerer = new token_registerer_1.TokenRegisterer(this._ua); | ||
this._registerer.stateChange.addListener(update => { | ||
if (update.state === RegistererState.Terminated) { | ||
if (update.state === sip_js_1.RegistererState.Terminated) { | ||
return; | ||
} | ||
const ready = update.state === RegistererState.Registered; | ||
const ready = update.state === sip_js_1.RegistererState.Registered; | ||
if (this.onIncomingState) { | ||
@@ -527,3 +532,4 @@ const retry = update.retry || | ||
} | ||
if (!ready && !this._token && this._registerer) { | ||
if (!ready && this._token !== '' && this._registerer) { | ||
this._token = ''; | ||
void this._registerer.dispose(); | ||
@@ -545,7 +551,6 @@ this._registerer = null; | ||
if (this._registerer) { | ||
this._registerer.setToken(''); | ||
void this._registerer.dispose(); | ||
this._registerer = null; | ||
} | ||
else { | ||
this._checkStop(); | ||
} | ||
this._checkStop(); | ||
} | ||
@@ -556,3 +561,4 @@ /** | ||
closeConnection() { | ||
void this._ua.transport.disconnect(); | ||
this.disableIncoming(); | ||
this._ua.transport.disconnect(); | ||
} | ||
@@ -599,1 +605,2 @@ /** | ||
} | ||
exports.AculabCloudClient = AculabCloudClient; |
@@ -7,2 +7,3 @@ import { AculabCloudCall } from './aculab-cloud-call'; | ||
answer_pending: boolean; | ||
_extra_headers: string[] | undefined; | ||
_session: CallInvitation; | ||
@@ -36,3 +37,3 @@ constructor(client: AculabCloudClient, session: CallInvitation); | ||
disconnect(): void; | ||
getSipHeaders(name: string): string[]; | ||
} | ||
//# sourceMappingURL=aculab-cloud-incoming-call.d.ts.map |
@@ -1,6 +0,10 @@ | ||
import { AculabCloudCall } from './aculab-cloud-call'; | ||
import { MediaEventSessionDescriptionHandler } from './media-event-session-description-handler'; | ||
import { SessionState } from 'sip.js'; | ||
export class AculabCloudIncomingCall extends AculabCloudCall { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudIncomingCall = void 0; | ||
const aculab_cloud_call_1 = require("./aculab-cloud-call"); | ||
const media_event_session_description_handler_1 = require("./media-event-session-description-handler"); | ||
const sip_js_1 = require("sip.js"); | ||
class AculabCloudIncomingCall extends aculab_cloud_call_1.AculabCloudCall { | ||
answer_pending; | ||
_extra_headers; | ||
constructor(client, session) { | ||
@@ -10,2 +14,3 @@ super(client, true, false); | ||
this.answer_pending = false; | ||
this._extra_headers = undefined; | ||
} | ||
@@ -18,3 +23,11 @@ /** | ||
this._sdh_options = | ||
MediaEventSessionDescriptionHandler.fixup_options(options); | ||
media_event_session_description_handler_1.MediaEventSessionDescriptionHandler.fixup_options(options); | ||
this._extra_headers = options?.extraSipHeaders; | ||
if (this._extra_headers !== undefined) { | ||
this._extra_headers.forEach((s) => { | ||
if (!s.startsWith("X-")) { | ||
throw new Error("extraSipHeader must start with 'X-'"); | ||
} | ||
}); | ||
} | ||
this.client.console_log('AculabCloudIncomingCall: answer requested'); | ||
@@ -44,5 +57,10 @@ if (this.client._isReady()) { | ||
// FIXME: Allow video and audio for re invite | ||
const opts = { | ||
const sdh_opts = { | ||
sessionDescriptionHandlerOptions: this._sdh_options, | ||
}; | ||
let hdr_opts = {}; | ||
if (this._extra_headers !== undefined) { | ||
hdr_opts = { extraHeaders: this._extra_headers }; | ||
} | ||
const opts = { ...sdh_opts, ...hdr_opts }; | ||
void this._session.accept(opts); | ||
@@ -58,3 +76,7 @@ } | ||
if (this._session) { | ||
void this._session.progress(); | ||
let hdr_opts = {}; | ||
if (this._extra_headers !== undefined) { | ||
hdr_opts = { extraHeaders: this._extra_headers }; | ||
} | ||
void this._session.progress(hdr_opts); | ||
} | ||
@@ -83,4 +105,4 @@ } | ||
if (this._session) { | ||
if (this._session.state === SessionState.Initial || | ||
this._session.state === SessionState.Establishing) { | ||
if (this._session.state === sip_js_1.SessionState.Initial || | ||
this._session.state === sip_js_1.SessionState.Establishing) { | ||
void this._session.reject({ statusCode: int_cause }); | ||
@@ -105,4 +127,4 @@ } | ||
this.client.console_log(`call in state ${this._session.state}`); | ||
if (this._session.state === SessionState.Initial || | ||
this._session.state === SessionState.Establishing) { | ||
if (this._session.state === sip_js_1.SessionState.Initial || | ||
this._session.state === sip_js_1.SessionState.Establishing) { | ||
this.reject(); | ||
@@ -116,2 +138,6 @@ } | ||
} | ||
getSipHeaders(name) { | ||
return this._session.request.getHeaders(name); | ||
} | ||
} | ||
exports.AculabCloudIncomingCall = AculabCloudIncomingCall; |
@@ -10,2 +10,3 @@ import { CallInviter } from './call-inviter'; | ||
_inviter_options: object; | ||
_accept_message: sipCore.IncomingResponseMessage | undefined; | ||
_session: CallInviter; | ||
@@ -32,6 +33,11 @@ constructor(client: AculabCloudClient, uri: URI, inviter_options: object, options: CallOptions | undefined, reinvite_possible: boolean, legacy_interface?: boolean); | ||
/** | ||
* accept handler | ||
* @param response sip incoming response | ||
*/ | ||
_accept(response: sipCore.IncomingResponse): void; | ||
/** | ||
* Disconnect outbound call | ||
*/ | ||
disconnect(): void; | ||
getSipHeaders(name: string): string[] | undefined; | ||
} | ||
//# sourceMappingURL=aculab-cloud-outgoing-call.d.ts.map |
@@ -1,9 +0,13 @@ | ||
import { CallInviter } from './call-inviter'; | ||
import { AculabCloudCall } from './aculab-cloud-call'; | ||
import { MediaEventSessionDescriptionHandler } from './media-event-session-description-handler'; | ||
import { SessionState } from 'sip.js'; | ||
export class AculabCloudOutgoingCall extends AculabCloudCall { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudOutgoingCall = void 0; | ||
const call_inviter_1 = require("./call-inviter"); | ||
const aculab_cloud_call_1 = require("./aculab-cloud-call"); | ||
const media_event_session_description_handler_1 = require("./media-event-session-description-handler"); | ||
const sip_js_1 = require("sip.js"); | ||
class AculabCloudOutgoingCall extends aculab_cloud_call_1.AculabCloudCall { | ||
_uri; | ||
invite_pending; | ||
_inviter_options; | ||
_accept_message; | ||
constructor(client, uri, inviter_options, options, reinvite_possible, legacy_interface = false) { | ||
@@ -15,3 +19,4 @@ super(client, reinvite_possible, legacy_interface); | ||
this._sdh_options = | ||
MediaEventSessionDescriptionHandler.fixup_options(options); | ||
media_event_session_description_handler_1.MediaEventSessionDescriptionHandler.fixup_options(options); | ||
this._accept_message = undefined; | ||
if (this.client._isReady()) { | ||
@@ -49,3 +54,3 @@ this._doinvite(); | ||
this.client.console_log('AculabCloudOutgoingCall: invite to "' + this._uri.toString() + '"'); | ||
this.session = new CallInviter(this, this.client._ua, this._uri, this._inviter_options); | ||
this.session = new call_inviter_1.CallInviter(this, this.client._ua, this._uri, this._inviter_options); | ||
const opts = { | ||
@@ -56,2 +61,5 @@ requestDelegate: { | ||
}, | ||
onAccept: (response) => { | ||
this._accept(response); | ||
}, | ||
}, | ||
@@ -82,2 +90,11 @@ sessionDescriptionHandlerOptions: this._sdh_options, | ||
/** | ||
* accept handler | ||
* @param response sip incoming response | ||
*/ | ||
_accept(response) { | ||
if (response.message && response.message.statusCode === 200) { | ||
this._accept_message = response.message; | ||
} | ||
} | ||
/** | ||
* Disconnect outbound call | ||
@@ -95,6 +112,6 @@ */ | ||
this._disconnect_called = true; | ||
if (this._session.state === SessionState.Established) { | ||
if (this._session.state === sip_js_1.SessionState.Established) { | ||
void this._session.bye(); | ||
} | ||
else if (this._session.state === SessionState.Establishing) { | ||
else if (this._session.state === sip_js_1.SessionState.Establishing) { | ||
if (this._termination_reason === '') { | ||
@@ -115,2 +132,6 @@ this._termination_reason = 'NOANSWER'; | ||
} | ||
getSipHeaders(name) { | ||
return this._accept_message?.getHeaders(name); | ||
} | ||
} | ||
exports.AculabCloudOutgoingCall = AculabCloudOutgoingCall; |
@@ -13,2 +13,1 @@ import type { AculabCloudClient } from './aculab-cloud-client'; | ||
} | ||
//# sourceMappingURL=aculab-cloud-outgoing-client-call.d.ts.map |
@@ -1,9 +0,18 @@ | ||
import { AculabCloudOutgoingCall } from './aculab-cloud-outgoing-call'; | ||
import { URI } from 'sip.js'; | ||
export class AculabCloudOutgoingClientCall extends AculabCloudOutgoingCall { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudOutgoingClientCall = void 0; | ||
const aculab_cloud_outgoing_call_1 = require("./aculab-cloud-outgoing-call"); | ||
const sip_js_1 = require("sip.js"); | ||
class AculabCloudOutgoingClientCall extends aculab_cloud_outgoing_call_1.AculabCloudOutgoingCall { | ||
constructor(client, clientId, token, options) { | ||
// TODO: add option to allow video | ||
const uri = new URI('sip', clientId, `${client._webRtcAccessKey}.webrtc-${client._cloud}.aculabcloud.net;transport=tcp`); | ||
var hdrs = options.extraSipHeaders ?? []; | ||
hdrs.forEach((s) => { | ||
if (!s.startsWith("X-")) { | ||
throw new Error("extraSipHeader must start with 'X-'"); | ||
} | ||
}); | ||
const uri = new sip_js_1.URI('sip', clientId, `${client._webRtcAccessKey}.webrtc-${client._cloud}.aculabcloud.net;transport=tcp`); | ||
super(client, uri, { | ||
extraHeaders: ['Authorization: Bearer ' + token], | ||
extraHeaders: ['Authorization: Bearer ' + token].concat(hdrs), | ||
}, options, true, false); | ||
@@ -34,1 +43,2 @@ } | ||
} | ||
exports.AculabCloudOutgoingClientCall = AculabCloudOutgoingClientCall; |
import type { AculabCloudClient } from './aculab-cloud-client'; | ||
import { AculabCloudOutgoingCall } from './aculab-cloud-outgoing-call'; | ||
import { CallOptions } from './types'; | ||
export declare class AculabCloudOutgoingServiceCall extends AculabCloudOutgoingCall { | ||
constructor(client: AculabCloudClient, serviceName: string, legacy_interface?: boolean); | ||
constructor(client: AculabCloudClient, serviceName: string, callOptions: CallOptions | undefined, legacy_interface?: boolean); | ||
} | ||
//# sourceMappingURL=aculab-cloud-outgoing-service-call.d.ts.map |
@@ -1,10 +0,24 @@ | ||
import { AculabCloudOutgoingCall } from './aculab-cloud-outgoing-call'; | ||
import { URI } from 'sip.js'; | ||
export class AculabCloudOutgoingServiceCall extends AculabCloudOutgoingCall { | ||
constructor(client, serviceName, legacy_interface = false) { | ||
const uri = new URI('sip', serviceName, `sip-${client._cloud}.aculab.com;transport=tcp`); | ||
super(client, uri, { | ||
earlyMedia: true, | ||
}, undefined, false, legacy_interface); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudOutgoingServiceCall = void 0; | ||
const aculab_cloud_outgoing_call_1 = require("./aculab-cloud-outgoing-call"); | ||
const sip_js_1 = require("sip.js"); | ||
class AculabCloudOutgoingServiceCall extends aculab_cloud_outgoing_call_1.AculabCloudOutgoingCall { | ||
constructor(client, serviceName, callOptions, legacy_interface = false) { | ||
var hdrs = callOptions?.extraSipHeaders ?? []; | ||
hdrs.forEach((s) => { | ||
if (!s.startsWith("X-")) { | ||
throw new Error("extraSipHeader must start with 'X-'"); | ||
} | ||
}); | ||
let inv_opts = { earlyMedia: true }; | ||
let hdr_opts = {}; | ||
if (hdrs.length > 0) { | ||
hdr_opts = { extraHeaders: hdrs }; | ||
} | ||
const invite_opts = { ...inv_opts, ...hdr_opts }; | ||
const uri = new sip_js_1.URI('sip', serviceName, `sip-${client._cloud}.aculab.com;transport=tcp`); | ||
super(client, uri, invite_opts, callOptions, false, legacy_interface); | ||
} | ||
} | ||
exports.AculabCloudOutgoingServiceCall = AculabCloudOutgoingServiceCall; |
@@ -15,2 +15,1 @@ import { Invitation } from 'sip.js'; | ||
} | ||
//# sourceMappingURL=call-invitation.d.ts.map |
@@ -1,5 +0,8 @@ | ||
import { Invitation } from 'sip.js'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CallInvitation = void 0; | ||
const sip_js_1 = require("sip.js"); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore CallInvitation incorrectly extends Invitation | ||
export class CallInvitation extends Invitation { | ||
class CallInvitation extends sip_js_1.Invitation { | ||
_sessionDescriptionHandler; | ||
@@ -23,1 +26,2 @@ /** | ||
} | ||
exports.CallInvitation = CallInvitation; |
@@ -31,2 +31,1 @@ import { Inviter, URI, UserAgent, Core as sipCore } from 'sip.js'; | ||
} | ||
//# sourceMappingURL=call-inviter.d.ts.map |
@@ -1,2 +0,5 @@ | ||
import { Inviter } from 'sip.js'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CallInviter = void 0; | ||
const sip_js_1 = require("sip.js"); | ||
/** | ||
@@ -7,3 +10,3 @@ * Used only for outbound calls? | ||
// @ts-ignore CallInviter incorrectly extends Inviter | ||
export class CallInviter extends Inviter { | ||
class CallInviter extends sip_js_1.Inviter { | ||
call; | ||
@@ -50,1 +53,2 @@ _sessionDescriptionHandler; | ||
} | ||
exports.CallInviter = CallInviter; |
export { AculabCloudClient, AculabCloudClient as default, } from './aculab-cloud-client'; | ||
export { AculabCloudCaller } from './aculab-cloud-caller'; | ||
export type { AculabCloudCall, AculabCloudIncomingCall, AculabCloudOutgoingCall, MuteObj, CallObj, CallOptions, MediaCallObj, OnIncomingObj, DisconnectedCallObj, } from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
'use strict'; | ||
export { AculabCloudClient, AculabCloudClient as default, } from './aculab-cloud-client'; | ||
export { AculabCloudCaller } from './aculab-cloud-caller'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AculabCloudCaller = exports.default = exports.AculabCloudClient = void 0; | ||
var aculab_cloud_client_1 = require("./aculab-cloud-client"); | ||
Object.defineProperty(exports, "AculabCloudClient", { enumerable: true, get: function () { return aculab_cloud_client_1.AculabCloudClient; } }); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return aculab_cloud_client_1.AculabCloudClient; } }); | ||
var aculab_cloud_caller_1 = require("./aculab-cloud-caller"); | ||
Object.defineProperty(exports, "AculabCloudCaller", { enumerable: true, get: function () { return aculab_cloud_caller_1.AculabCloudCaller; } }); |
@@ -133,2 +133,3 @@ import { SessionDescriptionHandlerModifier, Web, Core as sipCore } from 'sip.js'; | ||
offerOptions?: RTCOfferOptions | undefined; | ||
extraSipHeaders?: string[] | undefined; | ||
answerOptions?: RTCAnswerOptions | undefined; | ||
@@ -162,2 +163,1 @@ constraints?: MediaStreamConstraints | undefined; | ||
} | ||
//# sourceMappingURL=media-event-session-description-handler.d.ts.map |
@@ -1,3 +0,6 @@ | ||
import { Web } from 'sip.js'; | ||
export class MediaEventSessionDescriptionHandler extends Web.SessionDescriptionHandler { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MediaEventSessionDescriptionHandler = void 0; | ||
const sip_js_1 = require("sip.js"); | ||
class MediaEventSessionDescriptionHandler extends sip_js_1.Web.SessionDescriptionHandler { | ||
options; | ||
@@ -119,3 +122,3 @@ usingOptionsLocalStream; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
Web.SessionDescriptionHandler['dispatchAddTrackEvent'](remoteStream, track); | ||
sip_js_1.Web.SessionDescriptionHandler['dispatchAddTrackEvent'](remoteStream, track); | ||
} | ||
@@ -126,3 +129,3 @@ else if (track.kind === 'video') { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
Web.SessionDescriptionHandler['dispatchAddTrackEvent'](remoteStream, track); | ||
sip_js_1.Web.SessionDescriptionHandler['dispatchAddTrackEvent'](remoteStream, track); | ||
} | ||
@@ -161,3 +164,3 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
Web.SessionDescriptionHandler['dispatchAddTrackEvent'](stream, track); // TODO: investigate this while testing !! | ||
sip_js_1.Web.SessionDescriptionHandler['dispatchAddTrackEvent'](stream, track); // TODO: investigate this while testing !! | ||
}); | ||
@@ -170,3 +173,3 @@ this.logger.debug('SessionDescriptionHandler.setLocalMediaStream: Adding video tracks ' + | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
Web.SessionDescriptionHandler['dispatchAddTrackEvent'](stream, track); // TODO: investigate this while testing !! | ||
sip_js_1.Web.SessionDescriptionHandler['dispatchAddTrackEvent'](stream, track); // TODO: investigate this while testing !! | ||
}); | ||
@@ -512,28 +515,30 @@ } | ||
const kind = getTransceiverKind(transceiver); | ||
if (kind === 'video') { | ||
if (options.constraints?.video && options.receiveVideo) { | ||
offerDirection = 'sendrecv'; | ||
if (transceiver.mid === null) { | ||
if (kind === 'video') { | ||
if (options.constraints?.video && options.receiveVideo) { | ||
offerDirection = 'sendrecv'; | ||
} | ||
else if (options.constraints?.video) { | ||
offerDirection = 'sendonly'; | ||
} | ||
else if (options.receiveVideo) { | ||
offerDirection = 'recvonly'; | ||
} | ||
} | ||
else if (options.constraints?.video) { | ||
offerDirection = 'sendonly'; | ||
else if (kind === 'audio') { | ||
if (options.constraints?.audio && options.receiveAudio) { | ||
offerDirection = 'sendrecv'; | ||
} | ||
else if (options.constraints?.audio) { | ||
offerDirection = 'sendonly'; | ||
} | ||
else if (options.receiveAudio) { | ||
offerDirection = 'recvonly'; | ||
} | ||
} | ||
else if (options.receiveVideo) { | ||
offerDirection = 'recvonly'; | ||
if (transceiver.direction !== offerDirection) { | ||
transceiver.direction = offerDirection; | ||
} | ||
updateTransceiverCodecsAndBitrates(transceiver, kind); | ||
} | ||
else if (kind === 'audio') { | ||
if (options.constraints?.audio && options.receiveAudio) { | ||
offerDirection = 'sendrecv'; | ||
} | ||
else if (options.constraints?.audio) { | ||
offerDirection = 'sendonly'; | ||
} | ||
else if (options.receiveAudio) { | ||
offerDirection = 'recvonly'; | ||
} | ||
} | ||
if (transceiver.direction !== offerDirection) { | ||
transceiver.direction = offerDirection; | ||
} | ||
updateTransceiverCodecsAndBitrates(transceiver, kind); | ||
} | ||
@@ -734,1 +739,2 @@ }); | ||
} | ||
exports.MediaEventSessionDescriptionHandler = MediaEventSessionDescriptionHandler; |
@@ -178,2 +178,1 @@ /// <reference types="node" /> | ||
} | ||
//# sourceMappingURL=token-registerer.d.ts.map |
@@ -0,3 +1,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TokenRegisterer = void 0; | ||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
import { Grammar, URI, equivalentURI, RequestPendingError, RegistererState, EmitterImpl, } from 'sip.js'; | ||
const sip_js_1 = require("sip.js"); | ||
const DEFAULT_EXPIRE_TIME = 600; | ||
@@ -8,3 +11,3 @@ /** | ||
*/ | ||
export class TokenRegisterer { | ||
class TokenRegisterer { | ||
change_pending; | ||
@@ -43,9 +46,9 @@ force_notify; | ||
// The registration state. | ||
this._state = RegistererState.Initial; | ||
this._state = sip_js_1.RegistererState.Initial; | ||
// True is waiting for final response to outstanding REGISTER request. | ||
this._waiting = false; | ||
// state emitter | ||
this._stateEventEmitter = new EmitterImpl(); | ||
this._stateEventEmitter = new sip_js_1.EmitterImpl(); | ||
// waiting emitter | ||
this._waitingEventEmitter = new EmitterImpl(); | ||
this._waitingEventEmitter = new sip_js_1.EmitterImpl(); | ||
// Set user agent | ||
@@ -76,3 +79,3 @@ this.userAgent = userAgent; | ||
if (this.options.instanceId && | ||
Grammar.parse(this.options.instanceId, 'uuid') === -1) { | ||
sip_js_1.Grammar.parse(this.options.instanceId, 'uuid') === -1) { | ||
throw new Error('Invalid instanceId.'); | ||
@@ -132,3 +135,3 @@ } | ||
regId: 0, | ||
registrar: new URI('sip', 'anonymous', 'anonymous.invalid'), | ||
registrar: new sip_js_1.URI('sip', 'anonymous', 'anonymous.invalid'), | ||
}; | ||
@@ -234,3 +237,3 @@ } | ||
// If we are registered, unregister and resolve after our state changes | ||
if (!this.waiting && this._state === RegistererState.Registered) { | ||
if (!this.waiting && this._state === sip_js_1.RegistererState.Registered) { | ||
this.stateChange.addListener(() => { | ||
@@ -241,2 +244,3 @@ this.terminated(); | ||
void this.unregister(); | ||
this.unregistered('DISCONNECTED'); | ||
return; | ||
@@ -246,2 +250,3 @@ } | ||
this.terminated(); | ||
this.unregistered('DISCONNECTED'); | ||
resolve(); | ||
@@ -266,6 +271,10 @@ }; | ||
setToken(token) { | ||
this.user_token = token; | ||
this.change_pending = true; | ||
if (!this.waiting) { | ||
this.processChange(); | ||
// Always re-register a token - we might have migrated to a new server. | ||
// Only deregister (token == '') once, though | ||
if (token !== this.user_token || token !== '') { | ||
this.user_token = token; | ||
this.change_pending = true; | ||
if (!this.waiting) { | ||
this.processChange(); | ||
} | ||
} | ||
@@ -280,3 +289,3 @@ } | ||
this.force_notify = true; | ||
if (this.user_token) { | ||
if (this.user_token !== '') { | ||
this.options.extraHeaders = [ | ||
@@ -300,3 +309,3 @@ 'Authorization: Bearer ' + this.user_token, | ||
register(options) { | ||
if (this.state === RegistererState.Terminated) { | ||
if (this.state === sip_js_1.RegistererState.Terminated) { | ||
this.stateError(); | ||
@@ -316,3 +325,3 @@ throw new Error('Registerer terminated. Unable to register.'); | ||
this.waitingWarning(); | ||
const error = new RequestPendingError('REGISTER request already in progress, waiting for final response'); | ||
const error = new sip_js_1.RequestPendingError('REGISTER request already in progress, waiting for final response'); | ||
return Promise.reject(error); | ||
@@ -403,3 +412,3 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access | ||
if (equivalentURI(contact.uri, this.userAgent.contact.uri)) { | ||
if ((0, sip_js_1.equivalentURI)(contact.uri, this.userAgent.contact.uri)) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access | ||
@@ -432,3 +441,3 @@ expires = Number(contact.getParam('expires')); | ||
if (gruu) { | ||
this.userAgent.contact.tempGruu = Grammar.URIParse(gruu.replace(/"/g, '')); | ||
this.userAgent.contact.tempGruu = sip_js_1.Grammar.URIParse(gruu.replace(/"/g, '')); | ||
} | ||
@@ -441,3 +450,3 @@ } | ||
if (gruu) { | ||
this.userAgent.contact.pubGruu = Grammar.URIParse(gruu.replace(/"/g, '')); | ||
this.userAgent.contact.pubGruu = sip_js_1.Grammar.URIParse(gruu.replace(/"/g, '')); | ||
} | ||
@@ -543,3 +552,3 @@ } | ||
unregister(options) { | ||
if (this.state === RegistererState.Terminated) { | ||
if (this.state === sip_js_1.RegistererState.Terminated) { | ||
this.stateError(); | ||
@@ -549,3 +558,3 @@ throw new Error('Registerer terminated. Unable to register.'); | ||
if (this.disposed) { | ||
if (this.state !== RegistererState.Registered) { | ||
if (this.state !== sip_js_1.RegistererState.Registered) { | ||
// allows unregister while disposing and registered | ||
@@ -563,6 +572,6 @@ this.stateError(); | ||
this.waitingWarning(); | ||
const error = new RequestPendingError('REGISTER request already in progress, waiting for final response'); | ||
const error = new sip_js_1.RequestPendingError('REGISTER request already in progress, waiting for final response'); | ||
return Promise.reject(error); | ||
} | ||
if (this._state !== RegistererState.Registered && !options?.all) { | ||
if (this._state !== sip_js_1.RegistererState.Registered && !options?.all) { | ||
this.logger.warn('Not currently registered, but sending an unregister anyway.'); | ||
@@ -693,3 +702,3 @@ } | ||
}, expires * 1000); | ||
this.stateTransition(RegistererState.Registered, 'NORMAL'); | ||
this.stateTransition(sip_js_1.RegistererState.Registered, 'NORMAL'); | ||
} | ||
@@ -701,3 +710,3 @@ /** | ||
this.clearTimers(); | ||
this.stateTransition(RegistererState.Unregistered, reason); | ||
this.stateTransition(sip_js_1.RegistererState.Unregistered, reason); | ||
} | ||
@@ -709,4 +718,4 @@ /** | ||
this.clearTimers(); | ||
if (this._state !== RegistererState.Terminated) { | ||
this.stateTransition(RegistererState.Terminated); | ||
if (this._state !== sip_js_1.RegistererState.Terminated) { | ||
this.stateTransition(sip_js_1.RegistererState.Terminated); | ||
} | ||
@@ -725,28 +734,28 @@ } | ||
switch (this._state) { | ||
case RegistererState.Initial: | ||
if (newState !== RegistererState.Registered && | ||
newState !== RegistererState.Unregistered && | ||
newState !== RegistererState.Terminated) { | ||
case sip_js_1.RegistererState.Initial: | ||
if (newState !== sip_js_1.RegistererState.Registered && | ||
newState !== sip_js_1.RegistererState.Unregistered && | ||
newState !== sip_js_1.RegistererState.Terminated) { | ||
invalidTransition(); | ||
} | ||
break; | ||
case RegistererState.Registered: | ||
if (newState === RegistererState.Registered) { | ||
case sip_js_1.RegistererState.Registered: | ||
if (newState === sip_js_1.RegistererState.Registered) { | ||
notify = this.force_notify; | ||
} | ||
else if (newState !== RegistererState.Unregistered && | ||
newState !== RegistererState.Terminated) { | ||
else if (newState !== sip_js_1.RegistererState.Unregistered && | ||
newState !== sip_js_1.RegistererState.Terminated) { | ||
invalidTransition(); | ||
} | ||
break; | ||
case RegistererState.Unregistered: | ||
if (newState === RegistererState.Unregistered) { | ||
case sip_js_1.RegistererState.Unregistered: | ||
if (newState === sip_js_1.RegistererState.Unregistered) { | ||
notify = this.force_notify; | ||
} | ||
else if (newState !== RegistererState.Registered && | ||
newState !== RegistererState.Terminated) { | ||
else if (newState !== sip_js_1.RegistererState.Registered && | ||
newState !== sip_js_1.RegistererState.Terminated) { | ||
invalidTransition(); | ||
} | ||
break; | ||
case RegistererState.Terminated: | ||
case sip_js_1.RegistererState.Terminated: | ||
invalidTransition(); | ||
@@ -769,3 +778,3 @@ break; | ||
// Dispose | ||
if (newState === RegistererState.Terminated) { | ||
if (newState === sip_js_1.RegistererState.Terminated) { | ||
void this.dispose(); | ||
@@ -825,3 +834,3 @@ } | ||
stateError() { | ||
const reason = this.state === RegistererState.Terminated | ||
const reason = this.state === sip_js_1.RegistererState.Terminated | ||
? "is in 'Terminated' state" | ||
@@ -837,1 +846,2 @@ : 'has been disposed'; | ||
} | ||
exports.TokenRegisterer = TokenRegisterer; |
@@ -43,2 +43,3 @@ import { RegistererState, Web } from 'sip.js'; | ||
offerOptions?: RTCOfferOptions; | ||
extraSipHeaders?: string[]; | ||
} | ||
@@ -81,2 +82,1 @@ export interface DtmfOptions { | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "@aculab-com/aculab-webrtc", | ||
"version": "4.0.6", | ||
"version": "4.0.7", | ||
"main": "lib/index.js", | ||
"module": "lib/index.mjs", | ||
"types": "lib/index.d.ts", | ||
"module": "lib/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./lib/index.d.ts", | ||
"import": "./lib/index.mjs", | ||
"require": "./lib/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"dependencies": { | ||
@@ -13,2 +21,3 @@ "sip.js": "^0.21.2", | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^12.1.1", | ||
"@types/node": "^20.6.2", | ||
@@ -23,2 +32,3 @@ "@types/uuid": "^9.0.3", | ||
"prettier": "^3.0.3", | ||
"rollup": "^4.27.3", | ||
"typescript": "^5.1.6", | ||
@@ -48,3 +58,5 @@ "webpack": "^5.70.0", | ||
"build": "npm run ts-build && npm run build-package && npm run build-bundles && npm rum copy-dist-files && npm run build-interface-html && npm run build-web-tgz", | ||
"ts-build": "tsc" | ||
"ts-build": "npm run ts-build:cjs || npm run ts-build:esm", | ||
"ts-build:esm": "rollup --config ./configs/rollup.config.js", | ||
"ts-build:cjs": "tsc -p ./configs/tsconfig.cjs.json" | ||
}, | ||
@@ -51,0 +63,0 @@ "files": [ |
type Report = {[key: string]: unknown}; | ||
type RTCStatsReport = ReadonlyMap<string, Report>; | ||
type RTCReportKind = 'audio' | 'video'; | ||
@@ -4,0 +3,0 @@ |
@@ -805,3 +805,3 @@ /* eslint-disable @typescript-eslint/restrict-plus-operands */ | ||
?.getStats() | ||
.then((stats: ReadonlyMap<string, {[key: string]: unknown}>) => { | ||
.then((stats) => { | ||
let localAddr = 'Unknown'; | ||
@@ -811,2 +811,4 @@ let remoteAddr = 'Unknown'; | ||
let remoteType = '?'; | ||
let remoteCandidateId = ''; | ||
let localCandidateId = ''; | ||
if (stats) { | ||
@@ -819,40 +821,39 @@ let selectedPairId = ''; | ||
}); | ||
let candidatePair = stats.get(selectedPairId); | ||
if (!candidatePair) { | ||
stats.forEach(stat => { | ||
if (stat.id == selectedPairId) { | ||
remoteCandidateId = stat.remoteCandidateId; | ||
localCandidateId = stat.localCandidateId; | ||
} | ||
}); | ||
if (remoteCandidateId === '') { | ||
stats.forEach(stat => { | ||
if (stat.type == 'candidate-pair' && stat.selected) { | ||
candidatePair = stat; | ||
remoteCandidateId = stat.remoteCandidateId; | ||
localCandidateId = stat.localCandidateId; | ||
} | ||
}); | ||
} | ||
if (candidatePair) { | ||
const remote = stats.get( | ||
candidatePair.remoteCandidateId as string, | ||
); | ||
if (typeof remote?.candidateType === 'string') { | ||
remoteType = remote.candidateType; | ||
} | ||
if (remoteCandidateId) { | ||
stats.forEach(stat => { | ||
if (stat.type == 'remote-candidate' && stat.id == remoteCandidateId) { | ||
if (typeof stat?.candidateType === 'string') { | ||
remoteType = stat.candidateType; | ||
} | ||
remoteAddr = _extractAddrPort(stat); | ||
} else if (stat.type == 'local-candidate' && stat.id == localCandidateId) { | ||
if ( | ||
stat?.relayProtocol && | ||
typeof stat.relayProtocol === 'string' | ||
) { | ||
localType = stat.relayProtocol; | ||
} else if ( | ||
stat?.protocol && | ||
typeof stat.protocol === 'string' | ||
) { | ||
localType = stat.protocol; | ||
} | ||
if (remote) { | ||
remoteAddr = _extractAddrPort(remote); | ||
} | ||
const local = stats.get( | ||
candidatePair.localCandidateId as string, | ||
); | ||
if ( | ||
local?.relayProtocol && | ||
typeof local.relayProtocol === 'string' | ||
) { | ||
localType = local.relayProtocol; | ||
} else if ( | ||
local?.protocol && | ||
typeof local.protocol === 'string' | ||
) { | ||
localType = local.protocol; | ||
} | ||
if (local) { | ||
localAddr = _extractAddrPort(local); | ||
} | ||
localAddr = _extractAddrPort(stat); | ||
} | ||
}); | ||
} | ||
@@ -859,0 +860,0 @@ } |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ import {AculabCloudCall} from './aculab-cloud-call'; |
@@ -0,0 +0,0 @@ import {CallInviter} from './call-inviter'; |
@@ -0,0 +0,0 @@ import type {AculabCloudClient} from './aculab-cloud-client'; |
@@ -0,0 +0,0 @@ import type {AculabCloudClient} from './aculab-cloud-client'; |
@@ -0,0 +0,0 @@ import {SessionDescriptionHandlerModifier, Web, Core as sipCore} from 'sip.js'; |
@@ -0,0 +0,0 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ |
@@ -0,0 +0,0 @@ import {RegistererState, Web} from 'sip.js'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9145
1979563
14
59