sip-connector 20.6.1 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{@SipConnector-B4noAdXF.js → @SipConnector-OAqRbRF0.js} +599 -553
- package/dist/@SipConnector-mL9nMhkX.cjs +1 -0
- package/dist/ApiManager/events.d.ts +37 -39
- package/dist/CallManager/@CallManager.d.ts +10 -5
- package/dist/CallManager/RemoteStreamsManager.d.ts +10 -4
- package/dist/CallManager/RoleManager.d.ts +1 -8
- package/dist/CallManager/StreamsManagerProvider.d.ts +10 -0
- package/dist/CallManager/events.d.ts +9 -4
- package/dist/CallManager/index.d.ts +1 -1
- package/dist/CallManager/types.d.ts +11 -0
- package/dist/SipConnector/events.d.ts +2 -2
- package/dist/SipConnectorFacade/@SipConnectorFacade.d.ts +3 -3
- package/dist/__fixtures__/constants.d.ts +5 -6
- package/dist/__fixtures__/eventNames.d.ts +3 -3
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +70 -71
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -23
- package/package.json +4 -4
- package/dist/@SipConnector-C09GtMW6.cjs +0 -1
|
@@ -10,7 +10,7 @@ import { TPresentationManagerEventMap } from '../PresentationManager';
|
|
|
10
10
|
import { TSessionManagerEventMap } from '../SessionManager';
|
|
11
11
|
import { TStatsManagerEventMap } from '../StatsManager';
|
|
12
12
|
import { TVideoSendingBalancerManagerEventMap } from '../VideoSendingBalancerManager';
|
|
13
|
-
export declare const EVENT_NAMES: readonly [...("call:connecting" | "call:accepted" | "call:ended" | "call:failed" | "connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:sending" | "call:progress" | "call:confirmed" | "call:newDTMF" | "call:newInfo" | "call:hold" | "call:unhold" | "call:muted" | "call:unmuted" | "call:reinvite" | "call:update" | "call:refer" | "call:replaces" | "call:sdp" | "call:icecandidate" | "call:getusermediafailed" | "call:peerconnection:createofferfailed" | "call:peerconnection:createanswerfailed" | "call:peerconnection:setlocaldescriptionfailed" | "call:peerconnection:setremotedescriptionfailed" | "call:presentation:start" | "call:presentation:started" | "call:presentation:end" | "call:presentation:ended" | "call:presentation:failed" | "call:peerconnection:confirmed" | "call:peerconnection:ontrack" | "call:ended:fromserver" | "call:call-status-changed" | "call:remote-streams-changed" | "conference-state:state-changed" | "conference-state:state-reset" | "api:channels:notify" | "api:participant:added-to-list-moderators" | "api:participant:removed-from-list-moderators" | "api:participant:move-request-to-stream" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators" | "api:participant:move-request-to-spectators-synthetic" | "api:participant:move-request-to-spectators-with-audio-id" | "api:participation:accepting-word-request" | "api:participation:cancelling-word-request" | "api:webcast:started" | "api:webcast:stopped" | "api:account:changed" | "api:account:deleted" | "api:
|
|
13
|
+
export declare const EVENT_NAMES: readonly [...("call:connecting" | "call:accepted" | "call:ended" | "call:failed" | "connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:sending" | "call:progress" | "call:confirmed" | "call:newDTMF" | "call:newInfo" | "call:hold" | "call:unhold" | "call:muted" | "call:unmuted" | "call:reinvite" | "call:update" | "call:refer" | "call:replaces" | "call:sdp" | "call:icecandidate" | "call:getusermediafailed" | "call:peerconnection:createofferfailed" | "call:peerconnection:createanswerfailed" | "call:peerconnection:setlocaldescriptionfailed" | "call:peerconnection:setremotedescriptionfailed" | "call:presentation:start" | "call:presentation:started" | "call:presentation:end" | "call:presentation:ended" | "call:presentation:failed" | "call:peerconnection:confirmed" | "call:peerconnection:ontrack" | "call:ended:fromserver" | "call:call-status-changed" | "call:remote-tracks-changed" | "call:remote-streams-changed" | "conference-state:state-changed" | "conference-state:state-reset" | "api:enter-room" | "api:main-cam-control" | "api:use-license" | "api:new-dtmf" | "api:conference:participant-token-issued" | "api:contented-stream:available" | "api:contented-stream:not-available" | "api:presentation:must-stop" | "api:channels:all" | "api:channels:notify" | "api:participant:added-to-list-moderators" | "api:participant:removed-from-list-moderators" | "api:participant:move-request-to-stream" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators" | "api:participant:move-request-to-spectators-synthetic" | "api:participant:move-request-to-spectators-with-audio-id" | "api:participation:accepting-word-request" | "api:participation:cancelling-word-request" | "api:webcast:started" | "api:webcast:stopped" | "api:account:changed" | "api:account:deleted" | "api:admin:start-main-cam" | "api:admin:stop-main-cam" | "api:admin:start-mic" | "api:admin:stop-mic" | "api:admin:force-sync-media-state" | "incoming-call:ringing" | "incoming-call:declinedIncomingCall" | "incoming-call:terminatedIncomingCall" | "incoming-call:failedIncomingCall" | "presentation:presentation:start" | "presentation:presentation:started" | "presentation:presentation:end" | "presentation:presentation:ended" | "presentation:presentation:failed" | "stats:collected" | "video-balancer:balancing-scheduled" | "video-balancer:balancing-started" | "video-balancer:balancing-stopped" | "video-balancer:parameters-updated" | "main-stream-health:no-inbound-frames" | "session:snapshot-changed")[], "disconnected-from-out-of-call", "connected-with-configuration-from-out-of-call", "stopped-presentation-by-server-command"];
|
|
14
14
|
export type TEventName = (typeof EVENT_NAMES)[number];
|
|
15
15
|
type PrefixedEventMap<T extends Record<string, unknown>, Prefix extends string> = {
|
|
16
16
|
[K in keyof T as `${Prefix}:${string & K}`]: T[K];
|
|
@@ -22,5 +22,5 @@ type TSipConnectorEventMap = {
|
|
|
22
22
|
};
|
|
23
23
|
export type TEventMap = PrefixedEventMap<TAutoConnectorManagerEventMap, 'auto-connect'> & PrefixedEventMap<TConnectionManagerEventMap, 'connection'> & PrefixedEventMap<TCallManagerEventMap, 'call'> & PrefixedEventMap<TConferenceStateManagerEventMap, 'conference-state'> & PrefixedEventMap<TApiManagerEventMap, 'api'> & PrefixedEventMap<TIncomingCallManagerEventMap, 'incoming-call'> & PrefixedEventMap<TPresentationManagerEventMap, 'presentation'> & PrefixedEventMap<TStatsManagerEventMap, 'stats'> & PrefixedEventMap<TVideoSendingBalancerManagerEventMap, 'video-balancer'> & PrefixedEventMap<TMainStreamHealthMonitorEventMap, 'main-stream-health'> & PrefixedEventMap<TSessionManagerEventMap, 'session'> & TSipConnectorEventMap;
|
|
24
24
|
export type TEvents = TypedEvents<TEventMap>;
|
|
25
|
-
export declare const createEvents: () => TypedEvents<TEventMap, readonly ("call:connecting" | "call:accepted" | "call:ended" | "call:failed" | "connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:sending" | "call:progress" | "call:confirmed" | "call:newDTMF" | "call:newInfo" | "call:hold" | "call:unhold" | "call:muted" | "call:unmuted" | "call:reinvite" | "call:update" | "call:refer" | "call:replaces" | "call:sdp" | "call:icecandidate" | "call:getusermediafailed" | "call:peerconnection:createofferfailed" | "call:peerconnection:createanswerfailed" | "call:peerconnection:setlocaldescriptionfailed" | "call:peerconnection:setremotedescriptionfailed" | "call:presentation:start" | "call:presentation:started" | "call:presentation:end" | "call:presentation:ended" | "call:presentation:failed" | "call:peerconnection:confirmed" | "call:peerconnection:ontrack" | "call:ended:fromserver" | "call:call-status-changed" | "call:remote-streams-changed" | "conference-state:state-changed" | "conference-state:state-reset" | "api:channels:notify" | "api:participant:added-to-list-moderators" | "api:participant:removed-from-list-moderators" | "api:participant:move-request-to-stream" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators" | "api:participant:move-request-to-spectators-synthetic" | "api:participant:move-request-to-spectators-with-audio-id" | "api:participation:accepting-word-request" | "api:participation:cancelling-word-request" | "api:webcast:started" | "api:webcast:stopped" | "api:account:changed" | "api:account:deleted" | "api:
|
|
25
|
+
export declare const createEvents: () => TypedEvents<TEventMap, readonly ("call:connecting" | "call:accepted" | "call:ended" | "call:failed" | "connection:connecting" | "connection:connected" | "connection:registered" | "connection:disconnected" | "auto-connect:before-attempt" | "auto-connect:success" | "auto-connect:failed-all-attempts" | "auto-connect:cancelled-attempts" | "auto-connect:changed-attempt-status" | "auto-connect:stop-attempts-by-error" | "auto-connect:limit-reached-attempts" | "connection:disconnecting" | "connection:newRTCSession" | "connection:unregistered" | "connection:registrationFailed" | "connection:newMessage" | "connection:sipEvent" | "connection:connect-started" | "connection:connect-succeeded" | "connection:connected-with-configuration" | "connection:connect-failed" | "connection:connect-parameters-resolve-success" | "connection:connect-parameters-resolve-failed" | "call:peerconnection" | "call:sending" | "call:progress" | "call:confirmed" | "call:newDTMF" | "call:newInfo" | "call:hold" | "call:unhold" | "call:muted" | "call:unmuted" | "call:reinvite" | "call:update" | "call:refer" | "call:replaces" | "call:sdp" | "call:icecandidate" | "call:getusermediafailed" | "call:peerconnection:createofferfailed" | "call:peerconnection:createanswerfailed" | "call:peerconnection:setlocaldescriptionfailed" | "call:peerconnection:setremotedescriptionfailed" | "call:presentation:start" | "call:presentation:started" | "call:presentation:end" | "call:presentation:ended" | "call:presentation:failed" | "call:peerconnection:confirmed" | "call:peerconnection:ontrack" | "call:ended:fromserver" | "call:call-status-changed" | "call:remote-tracks-changed" | "call:remote-streams-changed" | "conference-state:state-changed" | "conference-state:state-reset" | "api:enter-room" | "api:main-cam-control" | "api:use-license" | "api:new-dtmf" | "api:conference:participant-token-issued" | "api:contented-stream:available" | "api:contented-stream:not-available" | "api:presentation:must-stop" | "api:channels:all" | "api:channels:notify" | "api:participant:added-to-list-moderators" | "api:participant:removed-from-list-moderators" | "api:participant:move-request-to-stream" | "api:participant:move-request-to-participants" | "api:participant:move-request-to-spectators" | "api:participant:move-request-to-spectators-synthetic" | "api:participant:move-request-to-spectators-with-audio-id" | "api:participation:accepting-word-request" | "api:participation:cancelling-word-request" | "api:webcast:started" | "api:webcast:stopped" | "api:account:changed" | "api:account:deleted" | "api:admin:start-main-cam" | "api:admin:stop-main-cam" | "api:admin:start-mic" | "api:admin:stop-mic" | "api:admin:force-sync-media-state" | "incoming-call:ringing" | "incoming-call:declinedIncomingCall" | "incoming-call:terminatedIncomingCall" | "incoming-call:failedIncomingCall" | "presentation:presentation:start" | "presentation:presentation:started" | "presentation:presentation:end" | "presentation:presentation:ended" | "presentation:presentation:failed" | "stats:collected" | "video-balancer:balancing-scheduled" | "video-balancer:balancing-started" | "video-balancer:balancing-stopped" | "video-balancer:parameters-updated" | "main-stream-health:no-inbound-frames" | "session:snapshot-changed" | keyof TSipConnectorEventMap)[]>;
|
|
26
26
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EUseLicense } from '../ApiManager';
|
|
2
|
-
import { TOnAddedTransceiver } from '../CallManager
|
|
2
|
+
import { TOnAddedTransceiver, TRemoteStreams } from '../CallManager';
|
|
3
3
|
import { TParametersConnection, TConnectionConfigurationWithUa } from '../ConnectionManager';
|
|
4
4
|
import { TContentHint } from '../PresentationManager';
|
|
5
5
|
import { SipConnector } from '../SipConnector';
|
|
@@ -152,7 +152,7 @@ declare class SipConnectorFacade implements IProxyMethods {
|
|
|
152
152
|
}) => Promise<void>;
|
|
153
153
|
askPermissionToEnableCam: () => Promise<void>;
|
|
154
154
|
resolveHandleReadyRemoteStreamsDebounced: ({ onReadyRemoteStreams, }: {
|
|
155
|
-
onReadyRemoteStreams: (streams:
|
|
155
|
+
onReadyRemoteStreams: (streams: TRemoteStreams) => void;
|
|
156
156
|
}) => {
|
|
157
157
|
(this: unknown, ...args: [] & any[]): Promise<void>;
|
|
158
158
|
cancel: (reason?: any) => void;
|
|
@@ -162,7 +162,7 @@ declare class SipConnectorFacade implements IProxyMethods {
|
|
|
162
162
|
}) => ({ track }: {
|
|
163
163
|
track: MediaStreamTrack;
|
|
164
164
|
}) => void;
|
|
165
|
-
getRemoteStreams: () =>
|
|
165
|
+
getRemoteStreams: () => TRemoteStreams;
|
|
166
166
|
onUseLicense: (handler: (license: EUseLicense) => void) => (() => void);
|
|
167
167
|
onMustStopPresentation: (handler: () => void) => (() => void);
|
|
168
168
|
onMoveToSpectators: (handler: () => void) => (() => void);
|
|
@@ -14,7 +14,6 @@ export declare const SIP_EVENT = "sipEvent";
|
|
|
14
14
|
export declare const AVAILABLE_SECOND_REMOTE_STREAM_EVENT = "availableSecondRemoteStream";
|
|
15
15
|
export declare const NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT = "notAvailableSecondRemoteStream";
|
|
16
16
|
export declare const MUST_STOP_PRESENTATION_EVENT = "mustStopPresentation";
|
|
17
|
-
export declare const SHARE_STATE = "shareState";
|
|
18
17
|
export declare const ENTER_ROOM = "enterRoom";
|
|
19
18
|
export declare const USE_LICENSE = "useLicense";
|
|
20
19
|
export declare const PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed";
|
|
@@ -23,11 +22,11 @@ export declare const CHANNELS = "channels";
|
|
|
23
22
|
export declare const CHANNELS_NOTIFY = "channels:notify";
|
|
24
23
|
export declare const ENDED_FROM_SERVER = "ended:fromserver";
|
|
25
24
|
export declare const MAIN_CAM_CONTROL = "main-cam-control";
|
|
26
|
-
export declare const ADMIN_STOP_MAIN_CAM = "admin
|
|
27
|
-
export declare const ADMIN_START_MAIN_CAM = "admin
|
|
28
|
-
export declare const ADMIN_STOP_MIC = "admin
|
|
29
|
-
export declare const ADMIN_START_MIC = "admin
|
|
30
|
-
export declare const ADMIN_FORCE_SYNC_MEDIA_STATE = "admin
|
|
25
|
+
export declare const ADMIN_STOP_MAIN_CAM = "admin:stop-main-cam";
|
|
26
|
+
export declare const ADMIN_START_MAIN_CAM = "admin:start-main-cam";
|
|
27
|
+
export declare const ADMIN_STOP_MIC = "admin:stop-mic";
|
|
28
|
+
export declare const ADMIN_START_MIC = "admin:start-mic";
|
|
29
|
+
export declare const ADMIN_FORCE_SYNC_MEDIA_STATE = "admin:force-sync-media-state";
|
|
31
30
|
export declare const PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators";
|
|
32
31
|
export declare const PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators";
|
|
33
32
|
export declare const PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const UA_SYNTHETICS_EVENT_NAMES: readonly ["incomingCall", "declinedIncomingCall", "terminatedIncomingCall", "failedIncomingCall", "participation:accepting-word-request", "participation:cancelling-word-request", "participant:move-request-to-stream", "channels:notify", "conference:participant-token-issued", "account:changed", "account:deleted", "webcast:started", "webcast:stopped", "participant:added-to-list-moderators", "participant:removed-from-list-moderators"];
|
|
2
2
|
export declare const UA_JSSIP_EVENT_NAMES: readonly ["connecting", "connected", "disconnected", "newRTCSession", "registered", "unregistered", "registrationFailed", "newMessage", "sipEvent"];
|
|
3
|
-
export declare const SESSION_SYNTHETICS_EVENT_NAMES: readonly ["availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "
|
|
3
|
+
export declare const SESSION_SYNTHETICS_EVENT_NAMES: readonly ["availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "enterRoom", "useLicense", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "ended:fromserver", "main-cam-control", "admin:start-main-cam", "admin:stop-main-cam", "admin:stop-mic", "admin:start-mic", "admin:force-sync-media-state", "participant:move-request-to-spectators", "participant:move-request-to-participants"];
|
|
4
4
|
export declare const SESSION_JSSIP_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed"];
|
|
5
|
-
export declare const UA_EVENT_NAMES: ("channels:notify" | "participant:added-to-list-moderators" | "participant:removed-from-list-moderators" | "participant:move-request-to-stream" | "participation:accepting-word-request" | "participation:cancelling-word-request" | "webcast:started" | "webcast:stopped" | "account:changed" | "account:deleted" | "
|
|
6
|
-
export declare const SESSION_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "
|
|
5
|
+
export declare const UA_EVENT_NAMES: ("conference:participant-token-issued" | "channels:notify" | "participant:added-to-list-moderators" | "participant:removed-from-list-moderators" | "participant:move-request-to-stream" | "participation:accepting-word-request" | "participation:cancelling-word-request" | "webcast:started" | "webcast:stopped" | "account:changed" | "account:deleted" | "connecting" | "connected" | "disconnected" | "newRTCSession" | "registered" | "unregistered" | "registrationFailed" | "newMessage" | "sipEvent" | "declinedIncomingCall" | "terminatedIncomingCall" | "failedIncomingCall" | "incomingCall")[];
|
|
6
|
+
export declare const SESSION_EVENT_NAMES: readonly ["ended", "connecting", "sending", "reinvite", "replaces", "refer", "progress", "accepted", "confirmed", "peerconnection", "failed", "muted", "unmuted", "newDTMF", "newInfo", "hold", "unhold", "update", "sdp", "icecandidate", "getusermediafailed", "peerconnection:createofferfailed", "peerconnection:createanswerfailed", "peerconnection:setlocaldescriptionfailed", "peerconnection:setremotedescriptionfailed", "presentation:start", "presentation:started", "presentation:end", "presentation:ended", "presentation:failed", "availableSecondRemoteStream", "notAvailableSecondRemoteStream", "mustStopPresentation", "enterRoom", "useLicense", "peerconnection:confirmed", "peerconnection:ontrack", "channels", "ended:fromserver", "main-cam-control", "admin:start-main-cam", "admin:stop-main-cam", "admin:stop-mic", "admin:start-mic", "admin:force-sync-media-state", "participant:move-request-to-spectators", "participant:move-request-to-participants"];
|
|
7
7
|
export type TEventUA = (typeof UA_EVENT_NAMES)[number];
|
|
8
8
|
export type TEventSession = (typeof SESSION_EVENT_NAMES)[number];
|
package/dist/doMock.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("node:events"),U=require("@krivega/jssip/lib/NameAddrHeader"),j=require("@krivega/jssip/lib/URI"),H=require("@krivega/jssip/lib/SIPMessage"),a=require("@krivega/jssip"),_=require("webrtc-mock"),v=require("events-constructor"),D=require("./@SipConnector-C09GtMW6.cjs");class N extends H.IncomingRequest{headers;constructor(e){super(),this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)??""}}const q="incomingCall",G="declinedIncomingCall",x="failedIncomingCall",z="terminatedIncomingCall",y="connecting",Y="connected",B="disconnected",K="newRTCSession",J="registered",$="unregistered",Q="registrationFailed",X="newMessage",Z="sipEvent",ee="availableSecondRemoteStream",te="notAvailableSecondRemoteStream",re="mustStopPresentation",ne="shareState",oe="enterRoom",ie="useLicense",se="peerconnection:confirmed",ae="peerconnection:ontrack",ce="channels",de="channels:notify",Ee="ended:fromserver",he="main-cam-control",ue="admin-stop-main-cam",me="admin-start-main-cam",le="admin-stop-mic",pe="admin-start-mic",ge="admin-force-sync-media-state",_e="participant:added-to-list-moderators",Te="participant:removed-from-list-moderators",Ie="participant:move-request-to-stream",Se="participant:move-request-to-spectators",Ne="participant:move-request-to-participants",we="participation:accepting-word-request",Ce="participation:cancelling-word-request",fe="webcast:started",Re="webcast:stopped",Ae="account:changed",Me="account:deleted",Oe="conference:participant-token-issued",Pe="ended",ve="sending",De="reinvite",ye="replaces",Le="refer",Fe="progress",We="accepted",be="confirmed",ke="peerconnection",Ve="failed",Ue="muted",je="unmuted",He="newDTMF",qe="newInfo",Ge="hold",xe="unhold",ze="update",Ye="sdp",Be="icecandidate",Ke="getusermediafailed",Je="peerconnection:createofferfailed",$e="peerconnection:createanswerfailed",Qe="peerconnection:setlocaldescriptionfailed",Xe="peerconnection:setremotedescriptionfailed",Ze="presentation:start",et="presentation:started",tt="presentation:end",rt="presentation:ended",nt="presentation:failed",ot=[q,G,z,x,we,Ce,Ie,de,Oe,Ae,Me,fe,Re,_e,Te],L=[y,Y,B,K,J,$,Q,X,Z],it=[ee,te,re,ne,oe,ie,se,ae,ce,Ee,he,me,ue,le,pe,ge,Se,Ne],T=[Pe,y,ve,De,ye,Le,Fe,We,be,ke,Ve,Ue,je,He,qe,Ge,xe,ze,Ye,Be,Ke,Je,$e,Qe,Xe,Ze,et,tt,rt,nt];[...L,...ot];[...T,...it];class st{originator;connection;events;remote_identity;mutedOptions={audio:!1,video:!1};constructor({originator:e="local",eventHandlers:t,remoteIdentity:r}){this.originator=e,this.events=new v.Events(T),this.initEvents(t),this.remote_identity=r}get contact(){throw new Error("Method not implemented.")}get direction(){throw new Error("Method not implemented.")}get local_identity(){throw new Error("Method not implemented.")}get start_time(){throw new Error("Method not implemented.")}get end_time(){throw new Error("Method not implemented.")}get status(){throw new Error("Method not implemented.")}get C(){throw new Error("Method not implemented.")}get causes(){throw new Error("Method not implemented.")}get id(){throw new Error("Method not implemented.")}get data(){throw new Error("Method not implemented.")}set data(e){throw new Error("Method not implemented.")}isInProgress(){throw new Error("Method not implemented.")}isEnded(){throw new Error("Method not implemented.")}isReadyToReOffer(){throw new Error("Method not implemented.")}answer(e){throw new Error("Method not implemented.")}terminate(e){throw new Error("Method not implemented.")}async sendInfo(e,t,r){throw new Error("Method not implemented.")}hold(e,t){throw new Error("Method not implemented.")}unhold(e,t){throw new Error("Method not implemented.")}async renegotiate(e,t){throw new Error("Method not implemented.")}isOnHold(){throw new Error("Method not implemented.")}mute(e){throw new Error("Method not implemented.")}unmute(e){throw new Error("Method not implemented.")}isMuted(){throw new Error("Method not implemented.")}refer(e,t){throw new Error("Method not implemented.")}resetLocalMedia(){throw new Error("Method not implemented.")}async replaceMediaStream(e,t){throw new Error("Method not implemented.")}addListener(e,t){throw new Error("Method not implemented.")}once(e,t){throw new Error("Method not implemented.")}removeListener(e,t){throw new Error("Method not implemented.")}off(e,t){return this.events.off(e,t),this}removeAllListeners(e){return console.warn("Method not implemented. Event:",e),this}setMaxListeners(e){throw new Error("Method not implemented.")}getMaxListeners(){throw new Error("Method not implemented.")}listeners(e){throw new Error("Method not implemented.")}rawListeners(e){throw new Error("Method not implemented.")}emit(e,...t){throw new Error("Method not implemented.")}listenerCount(e){throw new Error("Method not implemented.")}prependListener(e,t){throw new Error("Method not implemented.")}prependOnceListener(e,t){throw new Error("Method not implemented.")}eventNames(){throw new Error("Method not implemented.")}initEvents(e){e&&Object.entries(e).forEach(([t,r])=>{this.on(t,r)})}on(e,t){return T.includes(e)&&this.events.on(e,t),this}trigger(e,t){this.events.trigger(e,t)}sendDTMF(){this.trigger("newDTMF",{originator:this.originator})}async startPresentation(e){return this.trigger("presentation:start",e),this.trigger("presentation:started",e),e}async stopPresentation(e){return this.trigger("presentation:end",e),this.trigger("presentation:ended",e),e}isEstablished(){return!0}}class R{stats=new Map().set("codec",{mimeType:"video/h264"});dtmf=null;track=null;transport=null;transform=null;parameters={encodings:[{}],transactionId:"0",codecs:[],headerExtensions:[],rtcp:{}};parametersGets;constructor({track:e}={}){this.track=e??null}async getStats(){return this.stats}async replaceTrack(e){this.track=e??null}async setParameters(e){if(e!==this.parametersGets)throw new Error("Failed to execute 'setParameters' on 'RTCRtpSender': Read-only field modified in setParameters().");const{transactionId:t}=this.parameters;this.parameters={...this.parameters,...e,transactionId:`${Number(t)+1}`}}getParameters(){return this.parametersGets={...this.parameters},this.parametersGets}setStreams(){throw new Error("Method not implemented.")}}class A{currentDirection="sendrecv";direction="sendrecv";mid=null;receiver;sender;stopped=!1;constructor(e){this.sender=e}setCodecPreferences(e){}stop(){}}class at extends EventTarget{senders=[];receivers=[];canTrickleIceCandidates;connectionState;currentLocalDescription;currentRemoteDescription;iceConnectionState;iceGatheringState;idpErrorInfo;idpLoginUrl;localDescription;onconnectionstatechange;ondatachannel;onicecandidate;onicecandidateerror=null;oniceconnectionstatechange;onicegatheringstatechange;onnegotiationneeded;onsignalingstatechange;ontrack;peerIdentity=void 0;pendingLocalDescription;pendingRemoteDescription;remoteDescription;sctp=null;signalingState;close=jest.fn();setLocalDescription=jest.fn(async e=>{});setRemoteDescription=jest.fn(async e=>{});addTransceiver=jest.fn((e,t)=>({}));createOffer=jest.fn(async(e,t,r)=>({type:"offer",sdp:"offer-sdp"}));constructor(e,t){super(),this.receivers=t?.map(r=>({track:r}))??[]}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(e){throw new Error("Method not implemented.")}restartIce(){throw new Error("Method not implemented.")}async createAnswer(e,t){throw new Error("Method not implemented.")}createDataChannel(e,t){throw new Error("Method not implemented.")}getConfiguration(){throw new Error("Method not implemented.")}async getIdentityAssertion(){throw new Error("Method not implemented.")}async getStats(e){throw new Error("Method not implemented.")}getTransceivers(){throw new Error("Method not implemented.")}removeTrack(e){throw new Error("Method not implemented.")}setConfiguration(e){throw new Error("Method not implemented.")}getReceivers=()=>this.receivers;getSenders=()=>this.senders;addTrack=(e,...t)=>{const r=new R({track:e}),o=new A(r);return o.mid=e.kind==="audio"?"0":"1",this.senders.push(r),this.dispatchTrackInternal(e,...t),r};addTrackWithMid=(e,t)=>{const r=new R({track:e}),o=new A(r);return t===void 0?o.mid=e.kind==="audio"?"0":"1":o.mid=t,this.senders.push(r),this.dispatchTrackInternal(e),r};dispatchTrack(e){this.dispatchTrackInternal(new _.MediaStreamTrackMock(e))}dispatchTrackInternal(e,...t){const r=new Event("track");Object.defineProperty(r,"track",{value:e}),Object.defineProperty(r,"streams",{value:t.length===0?[new MediaStream([e])]:t}),this.dispatchEvent(r)}}function ct(n){const e=n.match(/(purgatory)|[\d.]+/g);if(!e)throw new Error("wrong sip url");return e[0]}const M=400,F="777",dt=n=>n.getVideoTracks().length>0;class s extends st{static presentationError;static startPresentationError;static countStartPresentationError=Number.POSITIVE_INFINITY;static countStartsPresentation=0;url;status_code;renegotiate=jest.fn(async()=>!0);answer=jest.fn(({mediaStream:e})=>{if(this.originator!=="remote")throw new Error("answer available only for remote sessions");this.initPeerconnection(e),setTimeout(()=>{this.trigger("connecting"),setTimeout(()=>{this.trigger("accepted")},100),setTimeout(()=>{this.trigger("confirmed")},200)},M)});replaceMediaStream=jest.fn(async e=>{});_isReadyToReOffer=jest.fn(()=>!0);addTransceiver=jest.fn((e,t)=>({}));restartIce=jest.fn(async e=>!0);isEndedInner=!1;delayStartPresentation=0;timeoutStartPresentation;timeoutConnect;timeoutNewInfo;timeoutAccepted;timeoutConfirmed;constructor({eventHandlers:e,originator:t,remoteIdentity:r=new a.NameAddrHeader(new a.URI("sip","caller1","test1.com",5060),"Test Caller 1"),delayStartPresentation:o=0}){super({originator:t,eventHandlers:e,remoteIdentity:r}),this.delayStartPresentation=o}static get C(){return a.SessionStatus}static setPresentationError(e){this.presentationError=e}static resetPresentationError(){this.presentationError=void 0}static setStartPresentationError(e,{count:t=Number.POSITIVE_INFINITY}={}){this.startPresentationError=e,this.countStartPresentationError=t}static resetStartPresentationError(){this.startPresentationError=void 0,this.countStartPresentationError=Number.POSITIVE_INFINITY,this.countStartsPresentation=0}startPresentation=async e=>(s.countStartsPresentation+=1,new Promise((t,r)=>{this.timeoutStartPresentation=setTimeout(()=>{if(s.presentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.presentationError);return}if(s.startPresentationError&&s.countStartsPresentation<s.countStartPresentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.startPresentationError);return}t(super.startPresentation(e))},this.delayStartPresentation)}));stopPresentation=async e=>{if(s.presentationError)throw this.trigger("presentation:end",e),this.trigger("presentation:failed",e),s.presentationError;return super.stopPresentation(e)};initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const t=_.createAudioMediaStreamTrackMock();t.id="mainaudio1";const r=[t];if(dt(e)){const c=_.createVideoMediaStreamTrackMock();c.id="mainvideo1",r.push(c)}this.connection=new at(void 0,r),this.trigger("peerconnection",{peerconnection:this.connection}),this.addStream(e)}connect(e,{mediaStream:t}={}){const r=ct(e);return this.initPeerconnection(t),this.timeoutConnect=setTimeout(()=>{e.includes(F)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:"Rejected"}):(this.trigger("connecting"),this.timeoutNewInfo=setTimeout(()=>{this.newInfo({originator:D.Originator.REMOTE,request:{getHeader:o=>o==="content-type"?"application/vinteo.webrtc.roomname":o==="x-webrtc-enter-room"?r:o==="x-webrtc-participant-name"?"Test Caller 1":""}})},100),this.timeoutAccepted=setTimeout(()=>{this.trigger("accepted")},200),this.timeoutConfirmed=setTimeout(()=>{this.trigger("confirmed")},300))},M),this.connection}terminate({status_code:e,cause:t}={}){return this.status_code=e,this.trigger("ended",{status_code:e,cause:t,originator:"local"}),this.isEndedInner=!1,this}async terminateAsync({status_code:e,cause:t}={}){this.terminate({status_code:e,cause:t})}terminateRemote({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e,originator:"remote"}),this}addStream(e,t="getTracks"){e[t]().forEach(r=>this.connection.addTrack(r,e))}forEachSenders(e){const t=this.connection.getSenders();for(const r of t)e(r);return t}toggleMuteAudio(e){this.forEachSenders(({track:t})=>{t?.kind==="audio"&&(t.enabled=!e)})}toggleMuteVideo(e){this.forEachSenders(({track:t})=>{t?.kind==="video"&&(t.enabled=!e)})}mute(e){e.audio&&(this.mutedOptions.audio=!0,this.toggleMuteAudio(this.mutedOptions.audio)),e.video&&(this.mutedOptions.video=!0,this.toggleMuteVideo(this.mutedOptions.video)),this.onmute(e)}unmute(e){e.audio&&(this.mutedOptions.audio=!1),e.video&&(this.mutedOptions.video=!1),this.trigger("unmuted",e)}isMuted(){return this.mutedOptions}onmute({audio:e,video:t}){this.trigger("muted",{audio:e,video:t})}async sendInfo(){}isEnded(){return this.isEndedInner}newInfo(e){this.trigger("newInfo",e)}clear(){clearTimeout(this.timeoutStartPresentation),clearTimeout(this.timeoutConnect),clearTimeout(this.timeoutNewInfo),clearTimeout(this.timeoutAccepted),clearTimeout(this.timeoutConfirmed)}}class Et{extraHeaders=[];setExtraHeaders(e){this.extraHeaders=e}setExtraContactParams(){}}const d="PASSWORD_CORRECT",I="PASSWORD_CORRECT_2",W="NAME_INCORRECT",h=400,g={url:"wss://sipServerUrl/webrtc/wss/",sip_uri:"sip:sipServerUrl;transport=ws",via_transport:"WSS"},O={status_code:200,reason_phrase:"OK"},P={status_code:401,reason_phrase:"Unauthorized"};class i{static isAvailableTelephony=!0;static startError;static countStartError=Number.POSITIVE_INFINITY;static countStarts=0;events;registratorInner;call=jest.fn((e,t)=>{const{mediaStream:r,eventHandlers:o}=t;return this.session=new s({eventHandlers:o,originator:"local"}),this.session.connect(e,{mediaStream:r}),this.session});sendOptions=jest.fn((e,t,r)=>{console.log("sendOptions",e,t,r)});start=jest.fn(()=>{if(i.countStarts+=1,i.startError&&i.countStarts<i.countStartError){this.trigger("disconnected",i.startError);return}this.register()});stop=jest.fn(()=>{this.startedTimeout&&clearTimeout(this.startedTimeout),this.stopedTimeout&&clearTimeout(this.stopedTimeout),this.unregister(),this.isStarted()?this.stopedTimeout=setTimeout(()=>{this.trigger("disconnected",{error:!0,socket:g})},h):this.trigger("disconnected",{error:!0,socket:g})});removeAllListeners=jest.fn(()=>(this.events.removeEventHandlers(),this));once=jest.fn((e,t)=>(this.events.once(e,t),this));startedTimeout;stopedTimeout;session;isRegisteredInner;isConnectedInner;configuration;constructor(e){this.events=new v.Events(L);const[t,r]=e.uri.split(":"),[o,c]=r.split("@"),p={...e,uri:new a.URI(t,o,c)};this.configuration=p,this.registratorInner=new Et}static setStartError(e,{count:t=Number.POSITIVE_INFINITY}={}){i.startError=e,i.countStartError=t}static resetStartError(){i.startError=void 0,i.countStartError=Number.POSITIVE_INFINITY,i.countStarts=0}static setAvailableTelephony(){i.isAvailableTelephony=!0}static setNotAvailableTelephony(){i.isAvailableTelephony=!1}static reset(){i.resetStartError(),i.setAvailableTelephony()}on(e,t){return this.events.on(e,t),this}off(e,t){return this.events.off(e,t),this}trigger(e,t){this.events.trigger(e,t)}terminateSessions(){this.session?.terminate()}set(e,t){return this.configuration[e]=t,!0}register(){this.startedTimeout&&clearTimeout(this.startedTimeout);const{password:e,register:t,uri:r}=this.configuration;t===!0&&r.user.includes(W)?(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:P,cause:a.C.causes.REJECTED})},h)):!this.isRegistered()&&t===!0&&(e===d||e===I)?(this.isRegisteredInner=!0,this.startedTimeout=setTimeout(()=>{this.trigger("registered",{response:O})},h)):t===!0&&e!==d&&e!==I&&(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:P,cause:a.C.causes.REJECTED})},h)),i.isAvailableTelephony?(this.trigger("connected",{socket:g}),this.isConnectedInner=!0):this.stop()}unregister(){this.isRegisteredInner=!1,this.isConnectedInner=!1,this.trigger("unregistered",{response:O})}isRegistered(){return this.isRegisteredInner===!0}isConnected(){return this.isConnectedInner===!0}isStarted(){return this.configuration.register===!0&&this.isRegisteredInner===!0||this.configuration.register!==!0&&this.isConnectedInner===!0}newSipEvent(e){this.trigger("sipEvent",e)}registrator(){return this.registratorInner}}class ht{url;constructor(e){this.url=e}}class ut extends V.EventEmitter{contentType;body;constructor(e,t){super(),this.contentType=e,this.body=t}}const S="remote",mt=(n,e)=>{const t=new N(e),r={originator:S,request:t,info:new ut("","")};n.newInfo(r)},lt=(n,e)=>{const r={event:"sipEvent",request:new N(e)};n.newSipEvent(r)},pt=(n,{incomingNumber:e="1234",displayName:t,host:r})=>{const o=new s({originator:S,eventHandlers:{}}),c=new j("sip",e,r);o.remote_identity=new U(c,t);const p=new N([]);n.trigger("newRTCSession",{originator:S,session:o,request:p})},gt=(n,e)=>{e?n.trigger("failed",e):n.trigger("failed",n)},w={triggerNewInfo:mt,triggerNewSipEvent:lt,triggerIncomingSession:pt,triggerFailIncomingSession:gt,WebSocketInterface:ht,UA:i,C:{INVITE:"INVITE"}},u="user",E="displayName",m="SIP_SERVER_URL",C="SIP_WEB_SOCKET_SERVER_URL",_t=new w.WebSocketInterface(`wss://${C}/webrtc/wss/`),f={displayName:"DISPLAY_NAME",userAgent:"Chrome",sipServerIp:m,sipServerUrl:C},Tt={...f,displayName:"DISPLAY_NAME",register:!1},b={...f,user:u,password:d,register:!0},It={...b,displayName:E},St={...f,displayName:E,register:!1},l={session_timers:!1,sockets:[_t],user_agent:"Chrome",sdpSemantics:"unified-plan",register_expires:300,connection_recovery_max_interval:6,connection_recovery_min_interval:2},Nt={...l,password:d,uri:new a.URI("sip",u,m),display_name:"DISPLAY_NAME",register:!0},wt={...l,password:d,uri:new a.URI("sip",u,m),display_name:E,register:!0},Ct={...l,display_name:E,register:!1},ft={...l,display_name:"DISPLAY_NAME",register:!1},k="10.10.10.10",Rt=[`X-Vinteo-Remote: ${k}`],At=()=>new D.SipConnector({JsSIP:w});exports.FAILED_CONFERENCE_NUMBER=F;exports.JsSIP=w;exports.NAME_INCORRECT=W;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=I;exports.SIP_SERVER_URL=m;exports.SIP_WEB_SOCKET_SERVER_URL=C;exports.dataForConnectionWithAuthorization=b;exports.dataForConnectionWithAuthorizationWithDisplayName=It;exports.dataForConnectionWithoutAuthorization=St;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=Tt;exports.displayName=E;exports.doMockSipConnector=At;exports.extraHeadersRemoteAddress=Rt;exports.remoteAddress=k;exports.uaConfigurationWithAuthorization=Nt;exports.uaConfigurationWithAuthorizationWithDisplayName=wt;exports.uaConfigurationWithoutAuthorization=Ct;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=ft;exports.user=u;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("node:events"),U=require("@krivega/jssip/lib/NameAddrHeader"),j=require("@krivega/jssip/lib/URI"),q=require("@krivega/jssip/lib/SIPMessage"),a=require("@krivega/jssip"),_=require("webrtc-mock"),v=require("events-constructor"),D=require("./@SipConnector-mL9nMhkX.cjs");class N extends q.IncomingRequest{headers;constructor(e){super(),this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)??""}}const G="incomingCall",H="declinedIncomingCall",x="failedIncomingCall",z="terminatedIncomingCall",y="connecting",Y="connected",B="disconnected",K="newRTCSession",J="registered",$="unregistered",Q="registrationFailed",X="newMessage",Z="sipEvent",ee="availableSecondRemoteStream",te="notAvailableSecondRemoteStream",re="mustStopPresentation",ne="enterRoom",oe="useLicense",ie="peerconnection:confirmed",se="peerconnection:ontrack",ae="channels",ce="channels:notify",de="ended:fromserver",he="main-cam-control",Ee="admin:stop-main-cam",ue="admin:start-main-cam",me="admin:stop-mic",le="admin:start-mic",pe="admin:force-sync-media-state",ge="participant:added-to-list-moderators",_e="participant:removed-from-list-moderators",Te="participant:move-request-to-stream",Ie="participant:move-request-to-spectators",Se="participant:move-request-to-participants",Ne="participation:accepting-word-request",we="participation:cancelling-word-request",Ce="webcast:started",fe="webcast:stopped",Re="account:changed",Ae="account:deleted",Me="conference:participant-token-issued",Oe="ended",Pe="sending",ve="reinvite",De="replaces",ye="refer",Le="progress",Fe="accepted",We="confirmed",be="peerconnection",ke="failed",Ve="muted",Ue="unmuted",je="newDTMF",qe="newInfo",Ge="hold",He="unhold",xe="update",ze="sdp",Ye="icecandidate",Be="getusermediafailed",Ke="peerconnection:createofferfailed",Je="peerconnection:createanswerfailed",$e="peerconnection:setlocaldescriptionfailed",Qe="peerconnection:setremotedescriptionfailed",Xe="presentation:start",Ze="presentation:started",et="presentation:end",tt="presentation:ended",rt="presentation:failed",nt=[G,H,z,x,Ne,we,Te,ce,Me,Re,Ae,Ce,fe,ge,_e],L=[y,Y,B,K,J,$,Q,X,Z],ot=[ee,te,re,ne,oe,ie,se,ae,de,he,ue,Ee,me,le,pe,Ie,Se],T=[Oe,y,Pe,ve,De,ye,Le,Fe,We,be,ke,Ve,Ue,je,qe,Ge,He,xe,ze,Ye,Be,Ke,Je,$e,Qe,Xe,Ze,et,tt,rt];[...L,...nt];[...T,...ot];class it{originator;connection;events;remote_identity;mutedOptions={audio:!1,video:!1};constructor({originator:e="local",eventHandlers:t,remoteIdentity:r}){this.originator=e,this.events=new v.Events(T),this.initEvents(t),this.remote_identity=r}get contact(){throw new Error("Method not implemented.")}get direction(){throw new Error("Method not implemented.")}get local_identity(){throw new Error("Method not implemented.")}get start_time(){throw new Error("Method not implemented.")}get end_time(){throw new Error("Method not implemented.")}get status(){throw new Error("Method not implemented.")}get C(){throw new Error("Method not implemented.")}get causes(){throw new Error("Method not implemented.")}get id(){throw new Error("Method not implemented.")}get data(){throw new Error("Method not implemented.")}set data(e){throw new Error("Method not implemented.")}isInProgress(){throw new Error("Method not implemented.")}isEnded(){throw new Error("Method not implemented.")}isReadyToReOffer(){throw new Error("Method not implemented.")}answer(e){throw new Error("Method not implemented.")}terminate(e){throw new Error("Method not implemented.")}async sendInfo(e,t,r){throw new Error("Method not implemented.")}hold(e,t){throw new Error("Method not implemented.")}unhold(e,t){throw new Error("Method not implemented.")}async renegotiate(e,t){throw new Error("Method not implemented.")}isOnHold(){throw new Error("Method not implemented.")}mute(e){throw new Error("Method not implemented.")}unmute(e){throw new Error("Method not implemented.")}isMuted(){throw new Error("Method not implemented.")}refer(e,t){throw new Error("Method not implemented.")}resetLocalMedia(){throw new Error("Method not implemented.")}async replaceMediaStream(e,t){throw new Error("Method not implemented.")}addListener(e,t){throw new Error("Method not implemented.")}once(e,t){throw new Error("Method not implemented.")}removeListener(e,t){throw new Error("Method not implemented.")}off(e,t){return this.events.off(e,t),this}removeAllListeners(e){return console.warn("Method not implemented. Event:",e),this}setMaxListeners(e){throw new Error("Method not implemented.")}getMaxListeners(){throw new Error("Method not implemented.")}listeners(e){throw new Error("Method not implemented.")}rawListeners(e){throw new Error("Method not implemented.")}emit(e,...t){throw new Error("Method not implemented.")}listenerCount(e){throw new Error("Method not implemented.")}prependListener(e,t){throw new Error("Method not implemented.")}prependOnceListener(e,t){throw new Error("Method not implemented.")}eventNames(){throw new Error("Method not implemented.")}initEvents(e){e&&Object.entries(e).forEach(([t,r])=>{this.on(t,r)})}on(e,t){return T.includes(e)&&this.events.on(e,t),this}trigger(e,t){this.events.trigger(e,t)}sendDTMF(){this.trigger("newDTMF",{originator:this.originator})}async startPresentation(e){return this.trigger("presentation:start",e),this.trigger("presentation:started",e),e}async stopPresentation(e){return this.trigger("presentation:end",e),this.trigger("presentation:ended",e),e}isEstablished(){return!0}}class R{stats=new Map().set("codec",{mimeType:"video/h264"});dtmf=null;track=null;transport=null;transform=null;parameters={encodings:[{}],transactionId:"0",codecs:[],headerExtensions:[],rtcp:{}};parametersGets;constructor({track:e}={}){this.track=e??null}async getStats(){return this.stats}async replaceTrack(e){this.track=e??null}async setParameters(e){if(e!==this.parametersGets)throw new Error("Failed to execute 'setParameters' on 'RTCRtpSender': Read-only field modified in setParameters().");const{transactionId:t}=this.parameters;this.parameters={...this.parameters,...e,transactionId:`${Number(t)+1}`}}getParameters(){return this.parametersGets={...this.parameters},this.parametersGets}setStreams(){throw new Error("Method not implemented.")}}class A{currentDirection="sendrecv";direction="sendrecv";mid=null;receiver;sender;stopped=!1;constructor(e){this.sender=e}setCodecPreferences(e){}stop(){}}class st extends EventTarget{senders=[];receivers=[];canTrickleIceCandidates;connectionState;currentLocalDescription;currentRemoteDescription;iceConnectionState;iceGatheringState;idpErrorInfo;idpLoginUrl;localDescription;onconnectionstatechange;ondatachannel;onicecandidate;onicecandidateerror=null;oniceconnectionstatechange;onicegatheringstatechange;onnegotiationneeded;onsignalingstatechange;ontrack;peerIdentity=void 0;pendingLocalDescription;pendingRemoteDescription;remoteDescription;sctp=null;signalingState;close=jest.fn();setLocalDescription=jest.fn(async e=>{});setRemoteDescription=jest.fn(async e=>{});addTransceiver=jest.fn((e,t)=>({}));createOffer=jest.fn(async(e,t,r)=>({type:"offer",sdp:"offer-sdp"}));constructor(e,t){super(),this.receivers=t?.map(r=>({track:r}))??[]}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(e){throw new Error("Method not implemented.")}restartIce(){throw new Error("Method not implemented.")}async createAnswer(e,t){throw new Error("Method not implemented.")}createDataChannel(e,t){throw new Error("Method not implemented.")}getConfiguration(){throw new Error("Method not implemented.")}async getIdentityAssertion(){throw new Error("Method not implemented.")}async getStats(e){throw new Error("Method not implemented.")}getTransceivers(){throw new Error("Method not implemented.")}removeTrack(e){throw new Error("Method not implemented.")}setConfiguration(e){throw new Error("Method not implemented.")}getReceivers=()=>this.receivers;getSenders=()=>this.senders;addTrack=(e,...t)=>{const r=new R({track:e}),o=new A(r);return o.mid=e.kind==="audio"?"0":"1",this.senders.push(r),this.dispatchTrackInternal(e,...t),r};addTrackWithMid=(e,t)=>{const r=new R({track:e}),o=new A(r);return t===void 0?o.mid=e.kind==="audio"?"0":"1":o.mid=t,this.senders.push(r),this.dispatchTrackInternal(e),r};dispatchTrack(e){this.dispatchTrackInternal(new _.MediaStreamTrackMock(e))}dispatchTrackInternal(e,...t){const r=new Event("track");Object.defineProperty(r,"track",{value:e}),Object.defineProperty(r,"streams",{value:t.length===0?[new MediaStream([e])]:t}),this.dispatchEvent(r)}}function at(n){const e=n.match(/(purgatory)|[\d.]+/g);if(!e)throw new Error("wrong sip url");return e[0]}const M=400,F="777",ct=n=>n.getVideoTracks().length>0;class s extends it{static presentationError;static startPresentationError;static countStartPresentationError=Number.POSITIVE_INFINITY;static countStartsPresentation=0;url;status_code;renegotiate=jest.fn(async()=>!0);answer=jest.fn(({mediaStream:e})=>{if(this.originator!=="remote")throw new Error("answer available only for remote sessions");this.initPeerconnection(e),setTimeout(()=>{this.trigger("connecting"),setTimeout(()=>{this.trigger("accepted")},100),setTimeout(()=>{this.trigger("confirmed")},200)},M)});replaceMediaStream=jest.fn(async e=>{});_isReadyToReOffer=jest.fn(()=>!0);addTransceiver=jest.fn((e,t)=>({}));restartIce=jest.fn(async e=>!0);isEndedInner=!1;delayStartPresentation=0;timeoutStartPresentation;timeoutConnect;timeoutNewInfo;timeoutAccepted;timeoutConfirmed;constructor({eventHandlers:e,originator:t,remoteIdentity:r=new a.NameAddrHeader(new a.URI("sip","caller1","test1.com",5060),"Test Caller 1"),delayStartPresentation:o=0}){super({originator:t,eventHandlers:e,remoteIdentity:r}),this.delayStartPresentation=o}static get C(){return a.SessionStatus}static setPresentationError(e){this.presentationError=e}static resetPresentationError(){this.presentationError=void 0}static setStartPresentationError(e,{count:t=Number.POSITIVE_INFINITY}={}){this.startPresentationError=e,this.countStartPresentationError=t}static resetStartPresentationError(){this.startPresentationError=void 0,this.countStartPresentationError=Number.POSITIVE_INFINITY,this.countStartsPresentation=0}startPresentation=async e=>(s.countStartsPresentation+=1,new Promise((t,r)=>{this.timeoutStartPresentation=setTimeout(()=>{if(s.presentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.presentationError);return}if(s.startPresentationError&&s.countStartsPresentation<s.countStartPresentationError){this.trigger("presentation:start",e),this.trigger("presentation:failed",e),r(s.startPresentationError);return}t(super.startPresentation(e))},this.delayStartPresentation)}));stopPresentation=async e=>{if(s.presentationError)throw this.trigger("presentation:end",e),this.trigger("presentation:failed",e),s.presentationError;return super.stopPresentation(e)};initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const t=_.createAudioMediaStreamTrackMock();t.id="mainaudio1";const r=[t];if(ct(e)){const c=_.createVideoMediaStreamTrackMock();c.id="mainvideo1",r.push(c)}this.connection=new st(void 0,r),this.trigger("peerconnection",{peerconnection:this.connection}),this.addStream(e)}connect(e,{mediaStream:t}={}){const r=at(e);return this.initPeerconnection(t),this.timeoutConnect=setTimeout(()=>{e.includes(F)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:"Rejected"}):(this.trigger("connecting"),this.timeoutNewInfo=setTimeout(()=>{this.newInfo({originator:D.Originator.REMOTE,request:{getHeader:o=>o==="content-type"?"application/vinteo.webrtc.roomname":o==="x-webrtc-enter-room"?r:o==="x-webrtc-participant-name"?"Test Caller 1":""}})},100),this.timeoutAccepted=setTimeout(()=>{this.trigger("accepted")},200),this.timeoutConfirmed=setTimeout(()=>{this.trigger("confirmed")},300))},M),this.connection}terminate({status_code:e,cause:t}={}){return this.status_code=e,this.trigger("ended",{status_code:e,cause:t,originator:"local"}),this.isEndedInner=!1,this}async terminateAsync({status_code:e,cause:t}={}){this.terminate({status_code:e,cause:t})}terminateRemote({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e,originator:"remote"}),this}addStream(e,t="getTracks"){e[t]().forEach(r=>this.connection.addTrack(r,e))}forEachSenders(e){const t=this.connection.getSenders();for(const r of t)e(r);return t}toggleMuteAudio(e){this.forEachSenders(({track:t})=>{t?.kind==="audio"&&(t.enabled=!e)})}toggleMuteVideo(e){this.forEachSenders(({track:t})=>{t?.kind==="video"&&(t.enabled=!e)})}mute(e){e.audio&&(this.mutedOptions.audio=!0,this.toggleMuteAudio(this.mutedOptions.audio)),e.video&&(this.mutedOptions.video=!0,this.toggleMuteVideo(this.mutedOptions.video)),this.onmute(e)}unmute(e){e.audio&&(this.mutedOptions.audio=!1),e.video&&(this.mutedOptions.video=!1),this.trigger("unmuted",e)}isMuted(){return this.mutedOptions}onmute({audio:e,video:t}){this.trigger("muted",{audio:e,video:t})}async sendInfo(){}isEnded(){return this.isEndedInner}newInfo(e){this.trigger("newInfo",e)}clear(){clearTimeout(this.timeoutStartPresentation),clearTimeout(this.timeoutConnect),clearTimeout(this.timeoutNewInfo),clearTimeout(this.timeoutAccepted),clearTimeout(this.timeoutConfirmed)}}class dt{extraHeaders=[];setExtraHeaders(e){this.extraHeaders=e}setExtraContactParams(){}}const d="PASSWORD_CORRECT",I="PASSWORD_CORRECT_2",W="NAME_INCORRECT",E=400,g={url:"wss://sipServerUrl/webrtc/wss/",sip_uri:"sip:sipServerUrl;transport=ws",via_transport:"WSS"},O={status_code:200,reason_phrase:"OK"},P={status_code:401,reason_phrase:"Unauthorized"};class i{static isAvailableTelephony=!0;static startError;static countStartError=Number.POSITIVE_INFINITY;static countStarts=0;events;registratorInner;call=jest.fn((e,t)=>{const{mediaStream:r,eventHandlers:o}=t;return this.session=new s({eventHandlers:o,originator:"local"}),this.session.connect(e,{mediaStream:r}),this.session});sendOptions=jest.fn((e,t,r)=>{console.log("sendOptions",e,t,r)});start=jest.fn(()=>{if(i.countStarts+=1,i.startError&&i.countStarts<i.countStartError){this.trigger("disconnected",i.startError);return}this.register()});stop=jest.fn(()=>{this.startedTimeout&&clearTimeout(this.startedTimeout),this.stopedTimeout&&clearTimeout(this.stopedTimeout),this.unregister(),this.isStarted()?this.stopedTimeout=setTimeout(()=>{this.trigger("disconnected",{error:!0,socket:g})},E):this.trigger("disconnected",{error:!0,socket:g})});removeAllListeners=jest.fn(()=>(this.events.removeEventHandlers(),this));once=jest.fn((e,t)=>(this.events.once(e,t),this));startedTimeout;stopedTimeout;session;isRegisteredInner;isConnectedInner;configuration;constructor(e){this.events=new v.Events(L);const[t,r]=e.uri.split(":"),[o,c]=r.split("@"),p={...e,uri:new a.URI(t,o,c)};this.configuration=p,this.registratorInner=new dt}static setStartError(e,{count:t=Number.POSITIVE_INFINITY}={}){i.startError=e,i.countStartError=t}static resetStartError(){i.startError=void 0,i.countStartError=Number.POSITIVE_INFINITY,i.countStarts=0}static setAvailableTelephony(){i.isAvailableTelephony=!0}static setNotAvailableTelephony(){i.isAvailableTelephony=!1}static reset(){i.resetStartError(),i.setAvailableTelephony()}on(e,t){return this.events.on(e,t),this}off(e,t){return this.events.off(e,t),this}trigger(e,t){this.events.trigger(e,t)}terminateSessions(){this.session?.terminate()}set(e,t){return this.configuration[e]=t,!0}register(){this.startedTimeout&&clearTimeout(this.startedTimeout);const{password:e,register:t,uri:r}=this.configuration;t===!0&&r.user.includes(W)?(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:P,cause:a.C.causes.REJECTED})},E)):!this.isRegistered()&&t===!0&&(e===d||e===I)?(this.isRegisteredInner=!0,this.startedTimeout=setTimeout(()=>{this.trigger("registered",{response:O})},E)):t===!0&&e!==d&&e!==I&&(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:P,cause:a.C.causes.REJECTED})},E)),i.isAvailableTelephony?(this.trigger("connected",{socket:g}),this.isConnectedInner=!0):this.stop()}unregister(){this.isRegisteredInner=!1,this.isConnectedInner=!1,this.trigger("unregistered",{response:O})}isRegistered(){return this.isRegisteredInner===!0}isConnected(){return this.isConnectedInner===!0}isStarted(){return this.configuration.register===!0&&this.isRegisteredInner===!0||this.configuration.register!==!0&&this.isConnectedInner===!0}newSipEvent(e){this.trigger("sipEvent",e)}registrator(){return this.registratorInner}}class ht{url;constructor(e){this.url=e}}class Et extends V.EventEmitter{contentType;body;constructor(e,t){super(),this.contentType=e,this.body=t}}const S="remote",ut=(n,e)=>{const t=new N(e),r={originator:S,request:t,info:new Et("","")};n.newInfo(r)},mt=(n,e)=>{const r={event:"sipEvent",request:new N(e)};n.newSipEvent(r)},lt=(n,{incomingNumber:e="1234",displayName:t,host:r})=>{const o=new s({originator:S,eventHandlers:{}}),c=new j("sip",e,r);o.remote_identity=new U(c,t);const p=new N([]);n.trigger("newRTCSession",{originator:S,session:o,request:p})},pt=(n,e)=>{e?n.trigger("failed",e):n.trigger("failed",n)},w={triggerNewInfo:ut,triggerNewSipEvent:mt,triggerIncomingSession:lt,triggerFailIncomingSession:pt,WebSocketInterface:ht,UA:i,C:{INVITE:"INVITE"}},u="user",h="displayName",m="SIP_SERVER_URL",C="SIP_WEB_SOCKET_SERVER_URL",gt=new w.WebSocketInterface(`wss://${C}/webrtc/wss/`),f={displayName:"DISPLAY_NAME",userAgent:"Chrome",sipServerIp:m,sipServerUrl:C},_t={...f,displayName:"DISPLAY_NAME",register:!1},b={...f,user:u,password:d,register:!0},Tt={...b,displayName:h},It={...f,displayName:h,register:!1},l={session_timers:!1,sockets:[gt],user_agent:"Chrome",sdpSemantics:"unified-plan",register_expires:300,connection_recovery_max_interval:6,connection_recovery_min_interval:2},St={...l,password:d,uri:new a.URI("sip",u,m),display_name:"DISPLAY_NAME",register:!0},Nt={...l,password:d,uri:new a.URI("sip",u,m),display_name:h,register:!0},wt={...l,display_name:h,register:!1},Ct={...l,display_name:"DISPLAY_NAME",register:!1},k="10.10.10.10",ft=[`X-Vinteo-Remote: ${k}`],Rt=()=>new D.SipConnector({JsSIP:w});exports.FAILED_CONFERENCE_NUMBER=F;exports.JsSIP=w;exports.NAME_INCORRECT=W;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=I;exports.SIP_SERVER_URL=m;exports.SIP_WEB_SOCKET_SERVER_URL=C;exports.dataForConnectionWithAuthorization=b;exports.dataForConnectionWithAuthorizationWithDisplayName=Tt;exports.dataForConnectionWithoutAuthorization=It;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=_t;exports.displayName=h;exports.doMockSipConnector=Rt;exports.extraHeadersRemoteAddress=ft;exports.remoteAddress=k;exports.uaConfigurationWithAuthorization=St;exports.uaConfigurationWithAuthorizationWithDisplayName=Nt;exports.uaConfigurationWithoutAuthorization=wt;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=Ct;exports.user=u;
|
package/dist/doMock.js
CHANGED
|
@@ -5,7 +5,7 @@ import { IncomingRequest as b } from "@krivega/jssip/lib/SIPMessage";
|
|
|
5
5
|
import { NameAddrHeader as V, URI as E, SessionStatus as W, C as N } from "@krivega/jssip";
|
|
6
6
|
import { MediaStreamTrackMock as j, createAudioMediaStreamTrackMock as U, createVideoMediaStreamTrackMock as G } from "webrtc-mock";
|
|
7
7
|
import { Events as O } from "events-constructor";
|
|
8
|
-
import { O as H, S as x } from "./@SipConnector-
|
|
8
|
+
import { O as H, S as x } from "./@SipConnector-OAqRbRF0.js";
|
|
9
9
|
class T extends b {
|
|
10
10
|
headers;
|
|
11
11
|
constructor(e) {
|
|
@@ -15,22 +15,22 @@ class T extends b {
|
|
|
15
15
|
return this.headers.get(e) ?? "";
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
const Y = "incomingCall", q = "declinedIncomingCall", z = "failedIncomingCall", B = "terminatedIncomingCall", P = "connecting", K = "connected", $ = "disconnected", J = "newRTCSession", Q = "registered", X = "unregistered", Z = "registrationFailed", ee = "newMessage", te = "sipEvent", re = "availableSecondRemoteStream", ne = "notAvailableSecondRemoteStream", oe = "mustStopPresentation", se = "
|
|
18
|
+
const Y = "incomingCall", q = "declinedIncomingCall", z = "failedIncomingCall", B = "terminatedIncomingCall", P = "connecting", K = "connected", $ = "disconnected", J = "newRTCSession", Q = "registered", X = "unregistered", Z = "registrationFailed", ee = "newMessage", te = "sipEvent", re = "availableSecondRemoteStream", ne = "notAvailableSecondRemoteStream", oe = "mustStopPresentation", se = "enterRoom", ie = "useLicense", ae = "peerconnection:confirmed", ce = "peerconnection:ontrack", de = "channels", Ee = "channels:notify", he = "ended:fromserver", me = "main-cam-control", ue = "admin:stop-main-cam", le = "admin:start-main-cam", pe = "admin:stop-mic", ge = "admin:start-mic", Te = "admin:force-sync-media-state", _e = "participant:added-to-list-moderators", Ie = "participant:removed-from-list-moderators", Se = "participant:move-request-to-stream", Ne = "participant:move-request-to-spectators", we = "participant:move-request-to-participants", fe = "participation:accepting-word-request", Ce = "participation:cancelling-word-request", Re = "webcast:started", Ae = "webcast:stopped", Me = "account:changed", Oe = "account:deleted", Pe = "conference:participant-token-issued", ve = "ended", De = "sending", ye = "reinvite", Le = "replaces", ke = "refer", Fe = "progress", be = "accepted", Ve = "confirmed", We = "peerconnection", je = "failed", Ue = "muted", Ge = "unmuted", He = "newDTMF", xe = "newInfo", Ye = "hold", qe = "unhold", ze = "update", Be = "sdp", Ke = "icecandidate", $e = "getusermediafailed", Je = "peerconnection:createofferfailed", Qe = "peerconnection:createanswerfailed", Xe = "peerconnection:setlocaldescriptionfailed", Ze = "peerconnection:setremotedescriptionfailed", et = "presentation:start", tt = "presentation:started", rt = "presentation:end", nt = "presentation:ended", ot = "presentation:failed", st = [
|
|
19
19
|
Y,
|
|
20
20
|
q,
|
|
21
21
|
B,
|
|
22
22
|
z,
|
|
23
|
+
fe,
|
|
23
24
|
Ce,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
he,
|
|
27
|
-
ve,
|
|
28
|
-
Oe,
|
|
25
|
+
Se,
|
|
26
|
+
Ee,
|
|
29
27
|
Pe,
|
|
30
|
-
Ae,
|
|
31
28
|
Me,
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
Oe,
|
|
30
|
+
Re,
|
|
31
|
+
Ae,
|
|
32
|
+
_e,
|
|
33
|
+
Ie
|
|
34
34
|
], v = [
|
|
35
35
|
P,
|
|
36
36
|
K,
|
|
@@ -41,7 +41,7 @@ const Y = "incomingCall", q = "declinedIncomingCall", z = "failedIncomingCall",
|
|
|
41
41
|
Z,
|
|
42
42
|
ee,
|
|
43
43
|
te
|
|
44
|
-
],
|
|
44
|
+
], it = [
|
|
45
45
|
re,
|
|
46
46
|
ne,
|
|
47
47
|
oe,
|
|
@@ -50,19 +50,19 @@ const Y = "incomingCall", q = "declinedIncomingCall", z = "failedIncomingCall",
|
|
|
50
50
|
ae,
|
|
51
51
|
ce,
|
|
52
52
|
de,
|
|
53
|
-
|
|
53
|
+
he,
|
|
54
54
|
me,
|
|
55
|
+
le,
|
|
55
56
|
ue,
|
|
56
57
|
pe,
|
|
57
|
-
le,
|
|
58
58
|
ge,
|
|
59
59
|
Te,
|
|
60
|
-
|
|
61
|
-
we
|
|
62
|
-
fe
|
|
60
|
+
Ne,
|
|
61
|
+
we
|
|
63
62
|
], p = [
|
|
64
|
-
|
|
63
|
+
ve,
|
|
65
64
|
P,
|
|
65
|
+
De,
|
|
66
66
|
ye,
|
|
67
67
|
Le,
|
|
68
68
|
ke,
|
|
@@ -89,15 +89,14 @@ const Y = "incomingCall", q = "declinedIncomingCall", z = "failedIncomingCall",
|
|
|
89
89
|
tt,
|
|
90
90
|
rt,
|
|
91
91
|
nt,
|
|
92
|
-
ot
|
|
93
|
-
st
|
|
92
|
+
ot
|
|
94
93
|
];
|
|
95
|
-
[...v, ...
|
|
94
|
+
[...v, ...st];
|
|
96
95
|
[
|
|
97
96
|
...p,
|
|
98
|
-
...
|
|
97
|
+
...it
|
|
99
98
|
];
|
|
100
|
-
class
|
|
99
|
+
class at {
|
|
101
100
|
originator;
|
|
102
101
|
connection;
|
|
103
102
|
events;
|
|
@@ -329,7 +328,7 @@ class f {
|
|
|
329
328
|
stop() {
|
|
330
329
|
}
|
|
331
330
|
}
|
|
332
|
-
class
|
|
331
|
+
class ct extends EventTarget {
|
|
333
332
|
senders = [];
|
|
334
333
|
receivers = [];
|
|
335
334
|
canTrickleIceCandidates;
|
|
@@ -435,14 +434,14 @@ class dt extends EventTarget {
|
|
|
435
434
|
}), this.dispatchEvent(r);
|
|
436
435
|
}
|
|
437
436
|
}
|
|
438
|
-
function
|
|
437
|
+
function dt(n) {
|
|
439
438
|
const e = n.match(/(purgatory)|[\d.]+/g);
|
|
440
439
|
if (!e)
|
|
441
440
|
throw new Error("wrong sip url");
|
|
442
441
|
return e[0];
|
|
443
442
|
}
|
|
444
|
-
const C = 400,
|
|
445
|
-
class i extends
|
|
443
|
+
const C = 400, Et = "777", ht = (n) => n.getVideoTracks().length > 0;
|
|
444
|
+
class i extends at {
|
|
446
445
|
static presentationError;
|
|
447
446
|
static startPresentationError;
|
|
448
447
|
static countStartPresentationError = Number.POSITIVE_INFINITY;
|
|
@@ -537,16 +536,16 @@ class i extends ct {
|
|
|
537
536
|
const t = U();
|
|
538
537
|
t.id = "mainaudio1";
|
|
539
538
|
const r = [t];
|
|
540
|
-
if (
|
|
539
|
+
if (ht(e)) {
|
|
541
540
|
const a = G();
|
|
542
541
|
a.id = "mainvideo1", r.push(a);
|
|
543
542
|
}
|
|
544
|
-
this.connection = new
|
|
543
|
+
this.connection = new ct(void 0, r), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
|
|
545
544
|
}
|
|
546
545
|
connect(e, { mediaStream: t } = {}) {
|
|
547
|
-
const r =
|
|
546
|
+
const r = dt(e);
|
|
548
547
|
return this.initPeerconnection(t), this.timeoutConnect = setTimeout(() => {
|
|
549
|
-
e.includes(
|
|
548
|
+
e.includes(Et) ? this.trigger("failed", {
|
|
550
549
|
originator: "remote",
|
|
551
550
|
message: "IncomingResponse",
|
|
552
551
|
cause: "Rejected"
|
|
@@ -624,7 +623,7 @@ class i extends ct {
|
|
|
624
623
|
clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
|
|
625
624
|
}
|
|
626
625
|
}
|
|
627
|
-
class
|
|
626
|
+
class mt {
|
|
628
627
|
extraHeaders = [];
|
|
629
628
|
setExtraHeaders(e) {
|
|
630
629
|
this.extraHeaders = e;
|
|
@@ -633,7 +632,7 @@ class ut {
|
|
|
633
632
|
setExtraContactParams() {
|
|
634
633
|
}
|
|
635
634
|
}
|
|
636
|
-
const c = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2",
|
|
635
|
+
const c = "PASSWORD_CORRECT", R = "PASSWORD_CORRECT_2", ut = "NAME_INCORRECT", d = 400, l = {
|
|
637
636
|
url: "wss://sipServerUrl/webrtc/wss/",
|
|
638
637
|
sip_uri: "sip:sipServerUrl;transport=ws",
|
|
639
638
|
via_transport: "WSS"
|
|
@@ -695,7 +694,7 @@ class s {
|
|
|
695
694
|
...e,
|
|
696
695
|
uri: new E(t, o, a)
|
|
697
696
|
};
|
|
698
|
-
this.configuration = u, this.registratorInner = new
|
|
697
|
+
this.configuration = u, this.registratorInner = new mt();
|
|
699
698
|
}
|
|
700
699
|
static setStartError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
|
|
701
700
|
s.startError = e, s.countStartError = t;
|
|
@@ -740,7 +739,7 @@ class s {
|
|
|
740
739
|
register() {
|
|
741
740
|
this.startedTimeout && clearTimeout(this.startedTimeout);
|
|
742
741
|
const { password: e, register: t, uri: r } = this.configuration;
|
|
743
|
-
t === !0 && r.user.includes(
|
|
742
|
+
t === !0 && r.user.includes(ut) ? (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
|
|
744
743
|
this.trigger("registrationFailed", { response: M, cause: N.causes.REJECTED });
|
|
745
744
|
}, d)) : !this.isRegistered() && t === !0 && (e === c || e === R) ? (this.isRegisteredInner = !0, this.startedTimeout = setTimeout(() => {
|
|
746
745
|
this.trigger("registered", { response: A });
|
|
@@ -777,30 +776,30 @@ class s {
|
|
|
777
776
|
return this.registratorInner;
|
|
778
777
|
}
|
|
779
778
|
}
|
|
780
|
-
class
|
|
779
|
+
class lt {
|
|
781
780
|
url;
|
|
782
781
|
constructor(e) {
|
|
783
782
|
this.url = e;
|
|
784
783
|
}
|
|
785
784
|
}
|
|
786
|
-
class
|
|
785
|
+
class pt extends L {
|
|
787
786
|
contentType;
|
|
788
787
|
body;
|
|
789
788
|
constructor(e, t) {
|
|
790
789
|
super(), this.contentType = e, this.body = t;
|
|
791
790
|
}
|
|
792
791
|
}
|
|
793
|
-
const g = "remote",
|
|
792
|
+
const g = "remote", gt = (n, e) => {
|
|
794
793
|
const t = new T(e), r = {
|
|
795
794
|
originator: g,
|
|
796
795
|
request: t,
|
|
797
|
-
info: new
|
|
796
|
+
info: new pt("", "")
|
|
798
797
|
};
|
|
799
798
|
n.newInfo(r);
|
|
800
|
-
},
|
|
799
|
+
}, Tt = (n, e) => {
|
|
801
800
|
const r = { event: "sipEvent", request: new T(e) };
|
|
802
801
|
n.newSipEvent(r);
|
|
803
|
-
},
|
|
802
|
+
}, _t = (n, {
|
|
804
803
|
incomingNumber: e = "1234",
|
|
805
804
|
displayName: t,
|
|
806
805
|
host: r
|
|
@@ -813,89 +812,89 @@ const g = "remote", Tt = (n, e) => {
|
|
|
813
812
|
session: o,
|
|
814
813
|
request: u
|
|
815
814
|
});
|
|
816
|
-
},
|
|
815
|
+
}, It = (n, e) => {
|
|
817
816
|
e ? n.trigger("failed", e) : n.trigger("failed", n);
|
|
818
817
|
}, D = {
|
|
819
|
-
triggerNewInfo:
|
|
820
|
-
triggerNewSipEvent:
|
|
821
|
-
triggerIncomingSession:
|
|
822
|
-
triggerFailIncomingSession:
|
|
823
|
-
WebSocketInterface:
|
|
818
|
+
triggerNewInfo: gt,
|
|
819
|
+
triggerNewSipEvent: Tt,
|
|
820
|
+
triggerIncomingSession: _t,
|
|
821
|
+
triggerFailIncomingSession: It,
|
|
822
|
+
WebSocketInterface: lt,
|
|
824
823
|
UA: s,
|
|
825
824
|
C: {
|
|
826
825
|
INVITE: "INVITE"
|
|
827
826
|
}
|
|
828
|
-
}, _ = "user", h = "displayName", I = "SIP_SERVER_URL", y = "SIP_WEB_SOCKET_SERVER_URL",
|
|
827
|
+
}, _ = "user", h = "displayName", I = "SIP_SERVER_URL", y = "SIP_WEB_SOCKET_SERVER_URL", St = new D.WebSocketInterface(`wss://${y}/webrtc/wss/`), S = {
|
|
829
828
|
displayName: "DISPLAY_NAME",
|
|
830
829
|
userAgent: "Chrome",
|
|
831
830
|
sipServerIp: I,
|
|
832
831
|
sipServerUrl: y
|
|
833
|
-
},
|
|
832
|
+
}, Dt = {
|
|
834
833
|
...S,
|
|
835
834
|
displayName: "DISPLAY_NAME",
|
|
836
835
|
register: !1
|
|
837
|
-
},
|
|
836
|
+
}, Nt = {
|
|
838
837
|
...S,
|
|
839
838
|
user: _,
|
|
840
839
|
password: c,
|
|
841
840
|
register: !0
|
|
842
|
-
},
|
|
843
|
-
...
|
|
841
|
+
}, yt = {
|
|
842
|
+
...Nt,
|
|
844
843
|
displayName: h
|
|
845
|
-
},
|
|
844
|
+
}, Lt = {
|
|
846
845
|
...S,
|
|
847
846
|
displayName: h,
|
|
848
847
|
register: !1
|
|
849
848
|
}, m = {
|
|
850
849
|
session_timers: !1,
|
|
851
|
-
sockets: [
|
|
850
|
+
sockets: [St],
|
|
852
851
|
user_agent: "Chrome",
|
|
853
852
|
sdpSemantics: "unified-plan",
|
|
854
853
|
register_expires: 300,
|
|
855
854
|
connection_recovery_max_interval: 6,
|
|
856
855
|
connection_recovery_min_interval: 2
|
|
857
|
-
},
|
|
856
|
+
}, kt = {
|
|
858
857
|
...m,
|
|
859
858
|
password: c,
|
|
860
859
|
uri: new E("sip", _, I),
|
|
861
860
|
display_name: "DISPLAY_NAME",
|
|
862
861
|
register: !0
|
|
863
|
-
},
|
|
862
|
+
}, Ft = {
|
|
864
863
|
...m,
|
|
865
864
|
password: c,
|
|
866
865
|
uri: new E("sip", _, I),
|
|
867
866
|
display_name: h,
|
|
868
867
|
register: !0
|
|
869
|
-
},
|
|
868
|
+
}, bt = {
|
|
870
869
|
...m,
|
|
871
870
|
display_name: h,
|
|
872
871
|
register: !1
|
|
873
|
-
},
|
|
872
|
+
}, Vt = {
|
|
874
873
|
...m,
|
|
875
874
|
display_name: "DISPLAY_NAME",
|
|
876
875
|
register: !1
|
|
877
|
-
},
|
|
876
|
+
}, wt = "10.10.10.10", Wt = [`X-Vinteo-Remote: ${wt}`], jt = () => new x({
|
|
878
877
|
JsSIP: D
|
|
879
878
|
});
|
|
880
879
|
export {
|
|
881
|
-
|
|
880
|
+
Et as FAILED_CONFERENCE_NUMBER,
|
|
882
881
|
D as JsSIP,
|
|
883
|
-
|
|
882
|
+
ut as NAME_INCORRECT,
|
|
884
883
|
c as PASSWORD_CORRECT,
|
|
885
884
|
R as PASSWORD_CORRECT_2,
|
|
886
885
|
I as SIP_SERVER_URL,
|
|
887
886
|
y as SIP_WEB_SOCKET_SERVER_URL,
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
887
|
+
Nt as dataForConnectionWithAuthorization,
|
|
888
|
+
yt as dataForConnectionWithAuthorizationWithDisplayName,
|
|
889
|
+
Lt as dataForConnectionWithoutAuthorization,
|
|
890
|
+
Dt as dataForConnectionWithoutAuthorizationWithoutDisplayName,
|
|
892
891
|
h as displayName,
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
892
|
+
jt as doMockSipConnector,
|
|
893
|
+
Wt as extraHeadersRemoteAddress,
|
|
894
|
+
wt as remoteAddress,
|
|
895
|
+
kt as uaConfigurationWithAuthorization,
|
|
896
|
+
Ft as uaConfigurationWithAuthorizationWithDisplayName,
|
|
897
|
+
bt as uaConfigurationWithoutAuthorization,
|
|
898
|
+
Vt as uaConfigurationWithoutAuthorizationWithoutDisplayName,
|
|
900
899
|
_ as user
|
|
901
900
|
};
|