@signalwire/js
Advanced tools
Comparing version 1.3.0-alpha.4 to 1.3.0-alpha.5
@@ -54,4 +54,5 @@ import BaseSession from './BaseSession'; | ||
vertoUnsubscribe({ nodeId, channels }: SubscribeParams): any; | ||
_jsApi(params?: {}): any; | ||
_wrapInExecute(message: BaseMessage): BaseMessage; | ||
execute(message: BaseMessage): any; | ||
} |
@@ -29,3 +29,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { Execute } from './messages/Blade'; | ||
import { Unsubscribe, Subscribe, Broadcast } from './messages/Verto'; | ||
import { Unsubscribe, Subscribe, Broadcast, JSApi } from './messages/Verto'; | ||
import { localStorage } from './util/storage/'; | ||
@@ -224,2 +224,6 @@ import { stopStream } from './util/webrtc'; | ||
} | ||
_jsApi(params = {}) { | ||
const msg = new JSApi(Object.assign(Object.assign({}, params), { sessid: this.sessionid })); | ||
return this.execute(msg); | ||
} | ||
_wrapInExecute(message) { | ||
@@ -226,0 +230,0 @@ const params = { |
@@ -32,2 +32,5 @@ import BaseRequest from './verto/BaseRequest'; | ||
} | ||
export { Login, Invite, Answer, Attach, Bye, Modify, Info, Broadcast, Subscribe, Unsubscribe, Result }; | ||
declare class JSApi extends BaseRequest { | ||
toString(): string; | ||
} | ||
export { Login, Invite, Answer, Attach, Bye, Modify, Info, Broadcast, Subscribe, Unsubscribe, Result, JSApi, }; |
@@ -50,2 +50,7 @@ import BaseRequest from './verto/BaseRequest'; | ||
} | ||
export { Login, Invite, Answer, Attach, Bye, Modify, Info, Broadcast, Subscribe, Unsubscribe, Result }; | ||
class JSApi extends BaseRequest { | ||
toString() { | ||
return 'jsapi'; | ||
} | ||
} | ||
export { Login, Invite, Answer, Attach, Bye, Modify, Info, Broadcast, Subscribe, Unsubscribe, Result, JSApi, }; |
@@ -5,7 +5,10 @@ export declare const deepCopy: (obj: Object) => any; | ||
export declare const mutateLiveArrayData: (data: any) => { | ||
participantId: number; | ||
audio?: any; | ||
video?: any; | ||
connectionState?: any; | ||
variables?: any; | ||
participantId: any; | ||
participantNumber: any; | ||
participantName: any; | ||
codec: any; | ||
media: {}; | ||
participantData: any; | ||
@@ -12,0 +15,0 @@ }; |
@@ -10,3 +10,3 @@ import logger from './logger'; | ||
try { | ||
media = JSON.parse(mediaJson.replace(/ID"/g, 'Id"')); | ||
media = JSON.parse(mediaJson); | ||
} | ||
@@ -16,3 +16,3 @@ catch (error) { | ||
} | ||
return { participantId: Number(participantId), participantNumber, participantName, codec, media, participantData }; | ||
return Object.assign({ participantId, participantNumber, participantName, codec, participantData }, media); | ||
}; | ||
@@ -19,0 +19,0 @@ export const safeParseJson = (value) => { |
@@ -77,3 +77,5 @@ interface IMessageBase { | ||
password?: string; | ||
userVariables?: Object; | ||
userVariables?: { | ||
[key: string]: any; | ||
}; | ||
} | ||
@@ -80,0 +82,0 @@ export interface SubscribeParams { |
@@ -70,3 +70,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (streamIsValid(stream)) { | ||
stream.getTracks().forEach(t => t.stop()); | ||
stream.getTracks().forEach(t => { | ||
if (t.readyState === 'live') { | ||
t.stop(); | ||
t.dispatchEvent(new Event('ended')); | ||
} | ||
}); | ||
} | ||
@@ -73,0 +78,0 @@ stream = null; |
@@ -7,4 +7,6 @@ import WebRTCCall from './WebRTCCall'; | ||
stopScreenShare(): void; | ||
addSecondSource(opts?: CallOptions): Promise<WebRTCCall>; | ||
removeSecondSource(): void; | ||
protected _finalize(): void; | ||
private _stats; | ||
} |
@@ -20,3 +20,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const displayStream = yield getDisplayMedia({ video: true }); | ||
const video = opts ? (opts.video || true) : true; | ||
const displayStream = yield getDisplayMedia({ video }); | ||
displayStream.getTracks().forEach(t => { | ||
@@ -30,3 +31,3 @@ t.addEventListener('ended', () => { | ||
const { remoteCallerName, remoteCallerNumber, callerName, callerNumber } = this.options; | ||
const options = Object.assign({ screenShare: true, localStream: displayStream, destinationNumber: `${this.extension}-screen`, remoteCallerName, remoteCallerNumber: `${remoteCallerNumber}-screen`, callerName: `${callerName} (Screen)`, callerNumber: `${callerNumber} (Screen)` }, opts); | ||
const options = Object.assign({ screenShare: true, localStream: displayStream, destinationNumber: `${this.extension};screen`, remoteCallerName, remoteCallerNumber: `${remoteCallerNumber};screen`, callerName: `${callerName} (Screen)`, callerNumber: `${callerNumber} (Screen)` }, opts); | ||
this.screenShare = new Call(this.session, options); | ||
@@ -42,2 +43,16 @@ this.screenShare.invite(); | ||
} | ||
addSecondSource(opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { remoteCallerName, remoteCallerNumber, callerName, callerNumber } = this.options; | ||
const options = Object.assign({ secondSource: true, recoverCall: false, destinationNumber: `${this.extension};second-source`, remoteCallerName, remoteCallerNumber: `${remoteCallerNumber};second-source`, callerName: `${callerName} (Second Source)`, callerNumber: `${callerNumber} (Second Source)`, localStream: null }, opts); | ||
this.secondSource = new Call(this.session, options); | ||
this.secondSource.invite(); | ||
return this.secondSource; | ||
}); | ||
} | ||
removeSecondSource() { | ||
if (this.secondSource instanceof Call) { | ||
this.secondSource.hangup(); | ||
} | ||
} | ||
_finalize() { | ||
@@ -44,0 +59,0 @@ this._stats(false); |
@@ -46,2 +46,9 @@ import BrowserSession from '../BrowserSession'; | ||
transfer(destination: string, participantId?: string): void; | ||
toggleNoiseBlocker(participantId: string, value: string): void; | ||
toggleLowBitrateMode(participantId: string, value: string): void; | ||
addToCall(value: string): void; | ||
toggleHandRaised(participantId: string, value?: string): void; | ||
confQuality(value: string): void; | ||
confFullscreen(participantId: string, value?: string): void; | ||
modCommand(command: string, participantId?: string, value?: string): void; | ||
laChannelHandler({ data: packet }: any): void; | ||
@@ -48,0 +55,0 @@ infoChannelHandler(params: any): void; |
@@ -10,2 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import logger from '../util/logger'; | ||
@@ -66,6 +77,8 @@ import { register, deRegisterAll } from '../services/Handler'; | ||
join(pvtData) { | ||
this.pvtData = pvtData; | ||
this.session.calls[this.callId].extension = this.pvtData.laName; | ||
this._dispatchConferenceUpdate({ action: ConferenceAction.Join, conferenceName: this.pvtData.laName, participantId: this.participantId, role: this.participantRole }); | ||
return this._subscribe(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.pvtData = pvtData; | ||
this.session.calls[this.callId].extension = this.pvtData.laName; | ||
yield this._subscribe(); | ||
this._dispatchConferenceUpdate({ action: ConferenceAction.Join, conferenceName: this.pvtData.laName, participantId: this.participantId, role: this.participantRole }); | ||
}); | ||
} | ||
@@ -156,2 +169,23 @@ part(pvtData) { | ||
} | ||
toggleNoiseBlocker(participantId, value) { | ||
this._moderatorCommand({ command: 'denoise', id: participantId, value }); | ||
} | ||
toggleLowBitrateMode(participantId, value) { | ||
this._moderatorCommand({ command: 'lowbr', id: participantId, value }); | ||
} | ||
addToCall(value) { | ||
this._moderatorCommand({ command: 'xdial', value }); | ||
} | ||
toggleHandRaised(participantId, value = null) { | ||
this._moderatorCommand({ command: 'handraise', id: participantId, value }); | ||
} | ||
confQuality(value) { | ||
this._moderatorCommand({ command: 'quality.lua', value }); | ||
} | ||
confFullscreen(participantId, value = null) { | ||
this._moderatorCommand({ command: 'full-screen', id: participantId, value }); | ||
} | ||
modCommand(command, participantId = null, value = null) { | ||
this._moderatorCommand({ command, id: participantId, value }); | ||
} | ||
laChannelHandler({ data: packet }) { | ||
@@ -174,4 +208,16 @@ if (!this._checkSerno(packet.wireSerno)) { | ||
return this._dispatchConferenceUpdate(Object.assign({ action: ConferenceAction.Add, callId }, mutateLiveArrayData(data))); | ||
case 'modify': | ||
return this._dispatchConferenceUpdate(Object.assign({ action: ConferenceAction.Modify, callId }, mutateLiveArrayData(data))); | ||
case 'modify': { | ||
const notification = Object.assign({ action: ConferenceAction.Modify, callId }, mutateLiveArrayData(data)); | ||
if (this.callId === callId) { | ||
const { audio, video } = notification; | ||
const call = this.session.calls[this.callId]; | ||
if (audio && 'muted' in audio) { | ||
Boolean(audio.muted) ? call.stopOutboundAudio() : call.restoreOutboundAudio(); | ||
} | ||
if (video && 'muted' in video) { | ||
Boolean(video.muted) ? call.stopOutboundVideo() : call.restoreOutboundVideo(); | ||
} | ||
} | ||
return this._dispatchConferenceUpdate(notification); | ||
} | ||
case 'del': | ||
@@ -190,2 +236,5 @@ return this._dispatchConferenceUpdate(Object.assign({ action: ConferenceAction.Delete, callId }, mutateLiveArrayData(data))); | ||
return this.updateLayouts(eventData); | ||
case 'conference-info': | ||
const { contentType } = eventData, rest = __rest(eventData, ["contentType"]); | ||
return this._dispatchConferenceUpdate(Object.assign({ action: ConferenceAction.ConferenceInfo }, rest)); | ||
default: | ||
@@ -213,3 +262,3 @@ logger.error('Conference info unknown contentType', params); | ||
updateLayouts(params) { | ||
const { contentType, canvasType, canvasInfo = null, currentLayerIdx = null } = params; | ||
const { contentType, callID, canvasType, canvasInfo = null, currentLayerIdx = null } = params, rest = __rest(params, ["contentType", "callID", "canvasType", "canvasInfo", "currentLayerIdx"]); | ||
this.canvasType = canvasType; | ||
@@ -222,3 +271,3 @@ if (currentLayerIdx !== null) { | ||
} | ||
this._dispatchConferenceUpdate({ action: ConferenceAction.LayoutInfo, participant: this.currentParticipant, canvasInfo: this.canvasInfo }); | ||
this._dispatchConferenceUpdate(Object.assign({ action: ConferenceAction.LayoutInfo, participant: this.currentParticipant, canvasInfo: this.canvasInfo }, rest)); | ||
} | ||
@@ -225,0 +274,0 @@ updateLogo(params) { |
@@ -24,3 +24,5 @@ import { CallOptions } from './interfaces'; | ||
ClientReady = "verto.clientReady", | ||
Modify = "verto.modify" | ||
Modify = "verto.modify", | ||
MediaParams = "verto.mediaParams", | ||
Prompt = "verto.prompt" | ||
} | ||
@@ -34,3 +36,4 @@ export declare enum Notification { | ||
UserMediaError = "userMediaError", | ||
RefreshToken = "refreshToken" | ||
RefreshToken = "refreshToken", | ||
Prompt = "prompt" | ||
} | ||
@@ -69,3 +72,4 @@ export declare const DEFAULT_CALL_OPTIONS: CallOptions; | ||
LayoutList = "layoutList", | ||
ModCmdResponse = "modCommandResponse" | ||
ModCmdResponse = "modCommandResponse", | ||
ConferenceInfo = "conferenceInfo" | ||
} | ||
@@ -72,0 +76,0 @@ export declare enum DeviceType { |
@@ -27,2 +27,4 @@ export var PeerType; | ||
VertoMethod["Modify"] = "verto.modify"; | ||
VertoMethod["MediaParams"] = "verto.mediaParams"; | ||
VertoMethod["Prompt"] = "verto.prompt"; | ||
})(VertoMethod || (VertoMethod = {})); | ||
@@ -38,2 +40,3 @@ export var Notification; | ||
Notification["RefreshToken"] = "refreshToken"; | ||
Notification["Prompt"] = "prompt"; | ||
})(Notification || (Notification = {})); | ||
@@ -47,6 +50,7 @@ export const DEFAULT_CALL_OPTIONS = { | ||
audio: true, | ||
video: false, | ||
video: true, | ||
useStereo: false, | ||
attach: false, | ||
screenShare: false, | ||
secondSource: false, | ||
userVariables: {}, | ||
@@ -89,2 +93,3 @@ }; | ||
ConferenceAction["ModCmdResponse"] = "modCommandResponse"; | ||
ConferenceAction["ConferenceInfo"] = "conferenceInfo"; | ||
})(ConferenceAction || (ConferenceAction = {})); | ||
@@ -91,0 +96,0 @@ export var DeviceType; |
@@ -5,3 +5,6 @@ import Conference from './Conference'; | ||
const methods = [ | ||
'sendChatMessage', 'listVideoLayouts', 'playMedia', 'stopMedia', 'startRecord', 'stopRecord', 'snapshot', 'setVideoLayout', 'kick', 'presenter', 'videoFloor', 'banner', 'volumeDown', 'volumeUp', 'gainDown', 'gainUp' | ||
'sendChatMessage', 'listVideoLayouts', 'playMedia', 'stopMedia', 'startRecord', 'stopRecord', | ||
'snapshot', 'setVideoLayout', 'kick', 'presenter', 'videoFloor', 'banner', | ||
'volumeDown', 'volumeUp', 'gainDown', 'gainUp', 'toggleNoiseBlocker', 'toggleLowBitrateMode', | ||
'toggleHandRaised', 'confQuality', 'confFullscreen', 'modCommand' | ||
]; | ||
@@ -8,0 +11,0 @@ methods.forEach(method => { |
@@ -23,4 +23,8 @@ export interface CallOptions { | ||
speakerId?: string; | ||
userVariables?: Object; | ||
userVariables?: { | ||
[key: string]: any; | ||
}; | ||
screenShare?: boolean; | ||
secondSource?: boolean; | ||
recoverCall?: boolean; | ||
onNotification?: Function; | ||
@@ -27,0 +31,0 @@ googleMaxBitrate?: number; |
@@ -14,2 +14,5 @@ import { PeerType } from './constants'; | ||
get config(): RTCConfiguration; | ||
stopTrackSender(kind: string): void; | ||
restoreTrackSender(kind: string): Promise<void>; | ||
applyMediaConstraints(kind: string, constraints: MediaTrackConstraints): Promise<void>; | ||
startNegotiation(): Promise<void>; | ||
@@ -16,0 +19,0 @@ onRemoteSdp(sdp: string): Promise<void>; |
@@ -39,2 +39,57 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
stopTrackSender(kind) { | ||
try { | ||
const sender = this.instance.getSenders().find(({ track }) => track.kind === kind); | ||
if (!sender) { | ||
return logger.info(`These is not a '${kind}' sender to stop.`); | ||
} | ||
if (sender.track) { | ||
sender.track.stop(); | ||
this.options.localStream.removeTrack(sender.track); | ||
} | ||
} | ||
catch (error) { | ||
logger.error('RTCPeer stopTrackSender error', kind, error); | ||
} | ||
} | ||
restoreTrackSender(kind) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const sender = this.instance.getSenders().find(({ track }) => track.kind === kind); | ||
if (!sender) { | ||
return logger.info(`These is not a '${kind}' sender to restore.`); | ||
} | ||
if (sender.track && sender.track.readyState !== 'ended') { | ||
return logger.info(`There is already an active ${kind} track.`); | ||
} | ||
const constraints = yield getMediaConstraints(this.options); | ||
const stream = yield getUserMedia({ [kind]: constraints[kind] }); | ||
if (streamIsValid(stream)) { | ||
const newTrack = stream.getTracks().find(t => t.kind === kind); | ||
sender.replaceTrack(newTrack); | ||
this.options.localStream.addTrack(newTrack); | ||
} | ||
} | ||
catch (error) { | ||
logger.error('RTCPeer restoreTrackSender error', kind, error); | ||
} | ||
}); | ||
} | ||
applyMediaConstraints(kind, constraints) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const sender = this.instance.getSenders().find(({ track }) => track.kind === kind); | ||
if (!sender || !sender.track) { | ||
return logger.info('No sender to apply constraints', kind, constraints); | ||
} | ||
if (sender.track.readyState === 'live') { | ||
logger.info(`Apply ${kind} constraints`, this.options.id, constraints); | ||
yield sender.track.applyConstraints(constraints); | ||
} | ||
} | ||
catch (error) { | ||
logger.error('Error applying constraints', kind, constraints); | ||
} | ||
}); | ||
} | ||
startNegotiation() { | ||
@@ -45,3 +100,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
logger.info('Trying to generate offer'); | ||
const offer = yield this.instance.createOffer(); | ||
const offer = yield this.instance.createOffer({ voiceActivityDetection: false }); | ||
yield this._setLocalDescription(offer); | ||
@@ -53,3 +108,3 @@ return; | ||
yield this._setRemoteDescription({ sdp: this.options.remoteSdp, type: PeerType.Offer }); | ||
const answer = yield this.instance.createAnswer(); | ||
const answer = yield this.instance.createAnswer({ voiceActivityDetection: false }); | ||
yield this._setLocalDescription(answer); | ||
@@ -56,0 +111,0 @@ return; |
@@ -67,3 +67,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
callerNumber: params.callee_id_number, | ||
attach | ||
attach, | ||
secondSource: /;second-source$/.test(params.callee_id_number), | ||
screenShare: /;screen$/.test(params.callee_id_number), | ||
}); | ||
@@ -70,0 +72,0 @@ call.nodeId = nodeId; |
@@ -20,2 +20,3 @@ import BrowserSession from '../BrowserSession'; | ||
screenShare?: WebRTCCall; | ||
secondSource?: WebRTCCall; | ||
doReinvite: boolean; | ||
@@ -26,2 +27,4 @@ private _state; | ||
stopScreenShare?(): void; | ||
addSecondSource?(opts?: CallOptions): Promise<WebRTCCall>; | ||
removeSecondSource?(): void; | ||
switchCamera?(): void; | ||
@@ -45,2 +48,9 @@ setSpeakerPhone?(flag: boolean): void; | ||
kick?(participantId?: string): void; | ||
toggleNoiseBlocker?(participantId: string, value: string): void; | ||
toggleLowBitrateMode?(participantId: string, value: string): void; | ||
addToCall?(value: string): void; | ||
toggleHandRaised?(participantId: string, value?: string): void; | ||
confQuality?(value: string): void; | ||
confFullscreen?(participantId: string, value?: string): void; | ||
modCommand?(command: string, participantId?: string, value?: string): void; | ||
constructor(session: BrowserSession, opts?: CallOptions); | ||
@@ -58,5 +68,6 @@ get state(): string; | ||
get role(): string; | ||
get isMainCall(): boolean; | ||
invite(): void; | ||
answer(): void; | ||
hangup(params?: IHangupParams): any; | ||
hangup(params?: IHangupParams): Promise<void>; | ||
dtmf(dtmf: string): void; | ||
@@ -77,2 +88,6 @@ transfer(destination: string, id?: string): void; | ||
toggleDeaf(participantId?: string): void; | ||
stopOutboundAudio(): void; | ||
restoreOutboundAudio(): void; | ||
stopOutboundVideo(): void; | ||
restoreOutboundVideo(): void; | ||
upgrade(): Promise<void>; | ||
@@ -87,4 +102,6 @@ setState(state: State): void; | ||
private _onVertoMedia; | ||
private _onVertoMediaParams; | ||
private _onVertoPrompt; | ||
_dispatchNotification(notification: any): void; | ||
_execute(msg: BaseMessage): any; | ||
_execute(msg: BaseMessage): Promise<any>; | ||
private _onVertoAttach; | ||
@@ -91,0 +108,0 @@ private _init; |
@@ -73,2 +73,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
} | ||
get isMainCall() { | ||
const { screenShare, secondSource } = this.options; | ||
return !screenShare && !secondSource; | ||
} | ||
invite() { | ||
@@ -136,2 +140,22 @@ this.direction = Direction.Outbound; | ||
} | ||
stopOutboundAudio() { | ||
if (this.peer) { | ||
this.peer.stopTrackSender('audio'); | ||
} | ||
} | ||
restoreOutboundAudio() { | ||
if (this.peer) { | ||
this.peer.restoreTrackSender('audio'); | ||
} | ||
} | ||
stopOutboundVideo() { | ||
if (this.peer) { | ||
this.peer.stopTrackSender('video'); | ||
} | ||
} | ||
restoreOutboundVideo() { | ||
if (this.peer) { | ||
this.peer.restoreTrackSender('video'); | ||
} | ||
} | ||
upgrade() { | ||
@@ -170,2 +194,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
if (this.secondSource instanceof WebRTCCall_1) { | ||
this.secondSource.hangup(); | ||
} | ||
this.setState(State.Destroy); | ||
@@ -216,9 +243,11 @@ break; | ||
_onVertoAnswer(params) { | ||
if (this._state >= State.Active) { | ||
return; | ||
} | ||
if (!this.gotEarly) { | ||
this.peer.onRemoteSdp(params.sdp); | ||
} | ||
this.setState(State.Active); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this._state >= State.Active) { | ||
return; | ||
} | ||
if (!this.gotEarly) { | ||
yield this.peer.onRemoteSdp(params.sdp); | ||
} | ||
this.setState(State.Active); | ||
}); | ||
} | ||
@@ -233,4 +262,16 @@ _onVertoMedia(params) { | ||
} | ||
_onVertoMediaParams(params) { | ||
const { mediaParams } = params; | ||
if (this.peer && mediaParams) { | ||
Object.keys(mediaParams).forEach(kind => { | ||
this.peer.applyMediaConstraints(kind, mediaParams[kind]); | ||
}); | ||
} | ||
} | ||
_onVertoPrompt(params) { | ||
const notification = Object.assign(Object.assign({}, params), { promptType: params.type, type: Notification.Prompt, call: this }); | ||
this._dispatchNotification(notification); | ||
} | ||
_dispatchNotification(notification) { | ||
if (this.options.screenShare === true) { | ||
if (this.isMainCall === false) { | ||
return; | ||
@@ -247,3 +288,6 @@ } | ||
} | ||
return this.session.execute(msg); | ||
return Promise.race([ | ||
new Promise((_resolve, reject) => setTimeout(reject, 3000, 'timeout')), | ||
this.session.execute(msg), | ||
]); | ||
} | ||
@@ -278,5 +322,9 @@ _onVertoAttach(params) { | ||
this.id = this.options.id; | ||
if (!this.isMainCall) { | ||
this.options.recoverCall = false; | ||
} | ||
if (!userVariables || objEmpty(userVariables)) { | ||
this.options.userVariables = this.session.options.userVariables || {}; | ||
} | ||
this.options.userVariables.hostname = window.location.hostname; | ||
if (!remoteCallerNumber) { | ||
@@ -292,2 +340,4 @@ this.options.remoteCallerNumber = this.options.destinationNumber; | ||
register(this.id, this._onVertoMedia, VertoMethod.Media); | ||
register(this.id, this._onVertoMediaParams, VertoMethod.MediaParams); | ||
register(this.id, this._onVertoPrompt, VertoMethod.Prompt); | ||
register(this.id, this._hangup, VertoMethod.Bye); | ||
@@ -310,3 +360,3 @@ register(this.id, this._onParticipantData, VertoMethod.Display); | ||
stopStream(localStream); | ||
if (this.options.screenShare !== true) { | ||
if (this.isMainCall) { | ||
detachMediaStream(remoteElement); | ||
@@ -313,0 +363,0 @@ detachMediaStream(localElement); |
import Relay from './src/SignalWire'; | ||
import Verto from './src/Verto'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export declare const VERSION = "1.3.0-alpha.4"; | ||
export declare const VERSION = "1.3.0-alpha.5"; | ||
export { Relay, Verto, CantinaAuth }; | ||
export * from '../common/src/util/interfaces'; | ||
export * from '../common/src/webrtc/interfaces'; |
@@ -5,4 +5,4 @@ import Relay from './src/SignalWire'; | ||
import CantinaAuth from '../common/src/webrtc/CantinaAuth'; | ||
export const VERSION = '1.3.0-alpha.4'; | ||
export const VERSION = '1.3.0-alpha.5'; | ||
setAgentName(`JavaScript SDK/${VERSION}`); | ||
export { Relay, Verto, CantinaAuth }; |
@@ -53,6 +53,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const { login, password, passwd, userVariables } = this.options; | ||
if (this.sessionid) { | ||
const sessidLogin = new Login(undefined, undefined, this.sessionid, undefined); | ||
yield this.execute(sessidLogin).catch(console.error); | ||
} | ||
const msg = new Login(login, (password || passwd), this.sessionid, userVariables); | ||
@@ -59,0 +55,0 @@ const response = yield this.execute(msg).catch(this._handleLoginError); |
{ | ||
"name": "@signalwire/js", | ||
"version": "1.3.0-alpha.4", | ||
"version": "1.3.0-alpha.5", | ||
"description": "Relay SDK for JavaScript to connect to SignalWire.", | ||
@@ -43,21 +43,21 @@ "author": "SignalWire Team <open.source@signalwire.com>", | ||
"dependencies": { | ||
"loglevel": "^1.6.7", | ||
"uuid": "^7.0.2" | ||
"loglevel": "^1.6.8", | ||
"uuid": "^7.0.3" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^25.1.4", | ||
"@types/uuid": "^7.0.0", | ||
"@babel/plugin-transform-runtime": "^7.9.0", | ||
"@types/jest": "^25.2.1", | ||
"@types/uuid": "^7.0.2", | ||
"babel-core": "^6.26.3", | ||
"babel-loader": "^7.1.5", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-loader": "^8.1.0", | ||
"babel-preset-env": "^1.7.0", | ||
"jest": "^25.1.0", | ||
"ts-jest": "^25.2.1", | ||
"ts-loader": "^6.2.1", | ||
"tslint": "^6.1.0", | ||
"jest": "^25.3.0", | ||
"ts-jest": "^25.3.1", | ||
"ts-loader": "^6.2.2", | ||
"tslint": "^6.1.1", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.10", | ||
"webpack-dev-server": "^3.9.0" | ||
"webpack": "^4.42.1", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.10.3" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
4256
299037
Updatedloglevel@^1.6.8
Updateduuid@^7.0.3