sinch-rtc
Version:
RTC JavaScript/Web SDK
52 lines • 2.68 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InboundCall = void 0;
const SessionState_1 = require("../session/SessionState");
const DefaultCall_1 = require("./DefaultCall");
const ClientEvent_1 = require("./reporting/ClientEvent");
class InboundCall extends DefaultCall_1.DefaultCall {
constructor(video, origin, session, mxpChannel, media, useRelayIceCandidatesOnly, clientEventsCollector, callQualityCollector, warningControllerFactory, onAcceptedWithoutTracks) {
super(video, session, mxpChannel, media, useRelayIceCandidatesOnly, clientEventsCollector, callQualityCollector, warningControllerFactory);
this.origin = origin;
this.onAcceptedWithoutTracks = onAcceptedWithoutTracks;
}
get remoteUserId() {
return this.origin.identity;
}
get remoteDomain() {
return this.origin.domain;
}
answer() {
return __awaiter(this, void 0, void 0, function* () {
if (this.mediaController.hasAnyTracks === false) {
yield this.onAcceptedWithoutTracks(this);
}
this.withSession((s) => {
const sessionState = s.state;
if (sessionState === SessionState_1.SessionState.Progress) {
this.clientEventsCollector.addEvent(ClientEvent_1.ClientEvent.createClientEventType(ClientEvent_1.ClientEventName.SDK_API_ANSWER));
s.accept();
}
else if (sessionState === SessionState_1.SessionState.Created ||
sessionState === SessionState_1.SessionState.Initiating) {
s.onStateChanged = (evt) => {
if (evt.state == SessionState_1.SessionState.Progress)
this.answer();
};
}
});
this.callEventFanout.setCallAccepted();
});
}
}
exports.InboundCall = InboundCall;
//# sourceMappingURL=InboundCall.js.map