UNPKG

sinch-rtc

Version:

RTC JavaScript/Web SDK

47 lines 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CallDestination = void 0; const api_1 = require("../../ocra/api"); const OutboundCall_1 = require("../OutboundCall"); class CallDestination { constructor(call, localUserId) { this.call = call; this.localUserId = localUserId; this.destinationDomain = this.call instanceof OutboundCall_1.OutboundCall ? this.call.remoteDomain : api_1.Domain.Mxp; this.destinationUser = this.call instanceof OutboundCall_1.OutboundCall ? this.call.remoteUserId : this.localUserId; this.destinationType = CallDestination.getDestinationTypeByDomain(this.destinationDomain); } static getDestinationTypeByDomain(domain) { switch (domain) { case api_1.Domain.Mxp: return api_1.DestinationTypeEnum.UserId; case api_1.Domain.Conference: return api_1.DestinationTypeEnum.Conference; case api_1.Domain.Pstn: return api_1.DestinationTypeEnum.Phonenumber; case api_1.Domain.Sip: return api_1.DestinationTypeEnum.Sip; default: console.error("Received a domain with no matching domain type", { domain, }); return undefined; } } getDestination() { if (!this.destinationType || !this.destinationUser) { return undefined; } return { domain: this.destinationDomain, type: this.destinationType, identity: this.destinationUser, }; } } exports.CallDestination = CallDestination; //# sourceMappingURL=CallDestination.js.map