sip-connector 16.0.0 → 16.0.2

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.
@@ -291,7 +291,7 @@ class be extends De {
291
291
  delete this.rtcSession, this.remoteStreamsManager.reset(), this.unsubscribeFromSessionEvents(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
292
292
  };
293
293
  }
294
- class Ue {
294
+ class we {
295
295
  events;
296
296
  strategy;
297
297
  constructor(e) {
@@ -343,7 +343,7 @@ const G = "sip-connector", R = q(G), un = () => {
343
343
  q.enable(G);
344
344
  }, Tn = () => {
345
345
  q.enable(`-${G}`);
346
- }, we = "Error decline with 603", Le = 1006, Be = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Le, ke = (n) => n.message === we;
346
+ }, Ue = "Error decline with 603", Le = 1006, Be = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Le, ke = (n) => n.message === Ue;
347
347
  var l = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n.AVAILABLE_INCOMING_BITRATE = "X-WEBRTC-AVAILABLE-INCOMING-BITRATE", n))(l || {}), k = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(k || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}), O = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(O || {}), M = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n.STATS = "application/vinteo.webrtc.stats", n))(M || {}), P = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(P || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(W || {}), H = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(H || {}), Fe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Fe || {}), g = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(g || {});
348
348
  const ie = [
349
349
  "participation:accepting-word-request",
@@ -900,6 +900,8 @@ class et {
900
900
  this.cancelSendPresentationWithRepeatedCalls();
901
901
  const t = this.streamPresentationCurrent;
902
902
  let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
903
+ this.promisePendingStartPresentation && await this.promisePendingStartPresentation.catch(() => {
904
+ });
903
905
  const i = this.callManager.getEstablishedRTCSession();
904
906
  return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
905
907
  throw this.events.trigger(f.FAILED_PRESENTATION, r), r;
@@ -923,7 +925,7 @@ class et {
923
925
  }).then(async (o) => (await this.setMaxBitrate(), o));
924
926
  }
925
927
  cancelSendPresentationWithRepeatedCalls() {
926
- this.cancelableSendPresentationWithRepeatedCalls?.cancel();
928
+ this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
927
929
  }
928
930
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
929
931
  on(e, t) {
@@ -2033,7 +2035,7 @@ class dt {
2033
2035
  };
2034
2036
  getUa = () => this.ua;
2035
2037
  }
2036
- var w = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(w || {}), x = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(x || {});
2038
+ var U = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {}), x = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(x || {});
2037
2039
  const le = [
2038
2040
  "incomingCall",
2039
2041
  "declinedIncomingCall",
@@ -2080,7 +2082,7 @@ class lt {
2080
2082
  return new Promise((t, s) => {
2081
2083
  try {
2082
2084
  const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
2083
- this.removeIncomingSession(), this.events.trigger(w.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
2085
+ this.removeIncomingSession(), this.events.trigger(U.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
2084
2086
  } catch (i) {
2085
2087
  s(i);
2086
2088
  }
@@ -2124,14 +2126,14 @@ class lt {
2124
2126
  this.incomingRTCSession = e;
2125
2127
  const t = this.remoteCallerData;
2126
2128
  e.on("failed", (s) => {
2127
- this.removeIncomingSession(), s.originator === x.LOCAL ? this.events.trigger(w.TERMINATED_INCOMING_CALL, t) : this.events.trigger(w.FAILED_INCOMING_CALL, t);
2128
- }), this.events.trigger(w.INCOMING_CALL, t);
2129
+ this.removeIncomingSession(), s.originator === x.LOCAL ? this.events.trigger(U.TERMINATED_INCOMING_CALL, t) : this.events.trigger(U.FAILED_INCOMING_CALL, t);
2130
+ }), this.events.trigger(U.INCOMING_CALL, t);
2129
2131
  }
2130
2132
  removeIncomingSession() {
2131
2133
  delete this.incomingRTCSession;
2132
2134
  }
2133
2135
  }
2134
- const U = 1e3;
2136
+ const w = 1e3;
2135
2137
  var E = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(E || {});
2136
2138
  const ue = ["collected"], Y = () => "performance" in window ? performance.now() : Date.now(), L = (n) => [...n.keys()].reduce((e, t) => {
2137
2139
  const s = n.get(t);
@@ -2323,7 +2325,7 @@ class Rt {
2323
2325
  return this.setTimeoutRequest.requested;
2324
2326
  }
2325
2327
  start(e, {
2326
- interval: t = U,
2328
+ interval: t = w,
2327
2329
  onError: s = At
2328
2330
  } = {}) {
2329
2331
  this.stop(), this.setTimeoutRequest.request(() => {
@@ -2357,8 +2359,8 @@ class Rt {
2357
2359
  this.requesterAllStatistics.request(e).then((i) => {
2358
2360
  this.events.trigger("collected", Ct(i));
2359
2361
  const a = Y() - s;
2360
- let o = U;
2361
- a > 48 ? o = U * 4 : a > 32 ? o = U * 3 : a > 16 && (o = U * 2), this.start(e, {
2362
+ let o = w;
2363
+ a > 48 ? o = w * 4 : a > 32 ? o = w * 3 : a > 16 && (o = w * 2), this.start(e, {
2362
2364
  onError: t,
2363
2365
  interval: o
2364
2366
  });
@@ -2482,8 +2484,8 @@ class bt {
2482
2484
  this.taskQueue.stop();
2483
2485
  }
2484
2486
  }
2485
- const Se = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Ut = 1e6, p = (n) => n * Ut, Ee = p(0.06), Ce = p(4), wt = (n) => n <= 64 ? Ee : n <= 128 ? p(0.12) : n <= 256 ? p(0.25) : n <= 384 ? p(0.32) : n <= 426 ? p(0.38) : n <= 640 ? p(0.5) : n <= 848 ? p(0.7) : n <= 1280 ? p(1) : n <= 1920 ? p(2) : Ce, Lt = "av1", Bt = (n) => Se(n, Lt), kt = 0.6, Q = (n, e) => Bt(e) ? n * kt : n, Ft = (n) => Q(Ee, n), $t = (n) => Q(Ce, n), X = (n, e) => {
2486
- const t = wt(n);
2487
+ const Se = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), wt = 1e6, p = (n) => n * wt, Ee = p(0.06), Ce = p(4), Ut = (n) => n <= 64 ? Ee : n <= 128 ? p(0.12) : n <= 256 ? p(0.25) : n <= 384 ? p(0.32) : n <= 426 ? p(0.38) : n <= 640 ? p(0.5) : n <= 848 ? p(0.7) : n <= 1280 ? p(1) : n <= 1920 ? p(2) : Ce, Lt = "av1", Bt = (n) => Se(n, Lt), kt = 0.6, Q = (n, e) => Bt(e) ? n * kt : n, Ft = (n) => Q(Ee, n), $t = (n) => Q(Ce, n), X = (n, e) => {
2488
+ const t = Ut(n);
2487
2489
  return Q(t, e);
2488
2490
  }, V = 1, Vt = ({
2489
2491
  videoTrack: n,
@@ -2869,7 +2871,7 @@ class En {
2869
2871
  excludeMimeTypesVideoCodecs: s,
2870
2872
  videoBalancerOptions: i
2871
2873
  } = {}) {
2872
- this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new D(nn), this.connectionManager = new dt({ JsSIP: e }), this.callManager = new Ue(), this.apiManager = new $e({
2874
+ this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.events = new D(nn), this.connectionManager = new dt({ JsSIP: e }), this.callManager = new we(), this.apiManager = new $e({
2873
2875
  connectionManager: this.connectionManager,
2874
2876
  callManager: this.callManager
2875
2877
  }), this.incomingCallManager = new lt(this.connectionManager), this.presentationManager = new et({
@@ -23,10 +23,17 @@ declare class RTCSessionMock extends BaseSession {
23
23
  }], any>;
24
24
  replaceMediaStream: jest.Mock<Promise<void>, [_mediaStream: MediaStream], any>;
25
25
  private isEndedInner;
26
- constructor({ eventHandlers, originator, remoteIdentity, }: {
26
+ private readonly delayStartPresentation;
27
+ private timeoutStartPresentation?;
28
+ private timeoutConnect?;
29
+ private timeoutNewInfo?;
30
+ private timeoutAccepted?;
31
+ private timeoutConfirmed?;
32
+ constructor({ eventHandlers, originator, remoteIdentity, delayStartPresentation, }: {
27
33
  eventHandlers: TEventHandlers;
28
34
  originator: string;
29
35
  remoteIdentity?: NameAddrHeader;
36
+ delayStartPresentation?: number;
30
37
  });
31
38
  static setPresentationError(presentationError: Error): void;
32
39
  static resetPresentationError(): void;
@@ -75,5 +82,6 @@ declare class RTCSessionMock extends BaseSession {
75
82
  sendInfo(): Promise<void>;
76
83
  isEnded(): boolean;
77
84
  newInfo(data: IncomingInfoEvent): void;
85
+ clear(): void;
78
86
  }
79
87
  export default RTCSessionMock;
package/dist/doMock.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("node:events"),V=require("@krivega/jssip/lib/NameAddrHeader"),k=require("@krivega/jssip/lib/URI"),U=require("@krivega/jssip/lib/SIPMessage"),a=require("@krivega/jssip"),f=require("webrtc-mock"),S=require("events-constructor"),P=require("./@SipConnector-DcaeAFrM.cjs");class N extends U.IncomingRequest{headers;constructor(e){super(),this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)??""}}const H="incomingCall",q="declinedIncomingCall",G="failedIncomingCall",x="terminatedIncomingCall",v="connecting",z="connected",j="disconnected",Y="newRTCSession",B="registered",K="unregistered",J="registrationFailed",$="newMessage",Q="sipEvent",X="availableSecondRemoteStream",Z="notAvailableSecondRemoteStream",ee="mustStopPresentation",te="shareState",re="enterRoom",ne="useLicense",oe="peerconnection:confirmed",se="peerconnection:ontrack",ie="channels",ae="channels:notify",ce="ended:fromserver",de="main-cam-control",Ee="admin-stop-main-cam",he="admin-start-main-cam",ue="admin-stop-mic",me="admin-start-mic",le="admin-force-sync-media-state",pe="participant:added-to-list-moderators",ge="participant:removed-from-list-moderators",_e="participant:move-request-to-stream",Te="participant:move-request-to-spectators",Ie="participant:move-request-to-participants",Se="participation:accepting-word-request",Ne="participation:cancelling-word-request",we="webcast:started",Ce="webcast:stopped",Re="account:changed",fe="account:deleted",Ae="conference:participant-token-issued",Me="ended",Oe="sending",Pe="reinvite",ve="replaces",De="refer",ye="progress",Le="accepted",Fe="confirmed",We="peerconnection",be="failed",Ve="muted",ke="unmuted",Ue="newDTMF",He="newInfo",qe="hold",Ge="unhold",xe="update",ze="sdp",je="icecandidate",Ye="getusermediafailed",Be="peerconnection:createofferfailed",Ke="peerconnection:createanswerfailed",Je="peerconnection:setlocaldescriptionfailed",$e="peerconnection:setremotedescriptionfailed",Qe="presentation:start",Xe="presentation:started",Ze="presentation:end",et="presentation:ended",tt="presentation:failed",rt=[H,q,x,G,Se,Ne,_e,ae,Ae,Re,fe,we,Ce,pe,ge],D=[v,z,j,Y,B,K,J,$,Q],nt=[X,Z,ee,te,re,ne,oe,se,ie,ce,de,he,Ee,ue,me,le,Te,Ie],_=[Me,v,Oe,Pe,ve,De,ye,Le,Fe,We,be,Ve,ke,Ue,He,qe,Ge,xe,ze,je,Ye,Be,Ke,Je,$e,Qe,Xe,Ze,et,tt];[...D,...rt];[..._,...nt];class ot{originator;connection;events;remote_identity;mutedOptions={audio:!1,video:!1};constructor({originator:e="local",eventHandlers:t,remoteIdentity:r}){this.originator=e,this.events=new S.Events(_),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 _.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 st{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.")}}const it=["track"];class at{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;events;constructor(e,t){this.events=new S.Events(it),this.receivers=t.map(r=>({track:r}))}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(e){throw new Error("Method not implemented.")}addTransceiver(e,t){throw new Error("Method not implemented.")}close(){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.")}async createOffer(e,t,r){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.")}async setLocalDescription(e){throw new Error("Method not implemented.")}async setRemoteDescription(e){throw new Error("Method not implemented.")}addEventListener(e,t,r){this.events.on(e,t)}removeEventListener(e,t,r){this.events.off(e,t)}dispatchEvent(e){throw new Error("Method not implemented.")}getReceivers=()=>this.receivers;getSenders=()=>this.senders;addTrack=e=>{const t=new st({track:e});return this.senders.push(t),this.events.trigger("track",{track:e}),t}}function ct(n){const e=n.match(/(purgatory)|[\d.]+/g);if(!e)throw new Error("wrong sip url");return e[0]}const A=400,y="777",dt=n=>n.getVideoTracks().length>0;class i extends ot{static presentationError;static startPresentationError;static countStartPresentationError=Number.POSITIVE_INFINITY;static countStartsPresentation=0;url;status_code;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)},A)});replaceMediaStream=jest.fn(async e=>{});isEndedInner=!1;constructor({eventHandlers:e,originator:t,remoteIdentity:r=new a.NameAddrHeader(new a.URI("sip","caller1","test1.com",5060),"Test Caller 1")}){super({originator:t,eventHandlers:e,remoteIdentity:r})}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=>{if(i.countStartsPresentation+=1,i.presentationError)throw this.trigger("presentation:start",e),this.trigger("presentation:failed",e),i.presentationError;if(i.startPresentationError&&i.countStartsPresentation<i.countStartPresentationError)throw this.trigger("presentation:start",e),this.trigger("presentation:failed",e),i.startPresentationError;return super.startPresentation(e)};stopPresentation=async e=>{if(i.presentationError)throw this.trigger("presentation:end",e),this.trigger("presentation:failed",e),i.presentationError;return super.stopPresentation(e)};initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const t=f.createAudioMediaStreamTrackMock();t.id="mainaudio1";const r=[t];if(dt(e)){const c=f.createVideoMediaStreamTrackMock();c.id="mainvideo1",r.push(c)}this.connection=new at(void 0,r),this.addStream(e),this.trigger("peerconnection",{peerconnection:this.connection})}connect(e,{mediaStream:t}={}){const r=ct(e);return this.initPeerconnection(t),setTimeout(()=>{e.includes(y)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:"Rejected"}):(this.trigger("connecting"),setTimeout(()=>{this.newInfo({originator:P.Originator.REMOTE,request:{getHeader:s=>s==="content-type"?"application/vinteo.webrtc.roomname":s==="x-webrtc-enter-room"?r:s==="x-webrtc-participant-name"?"Test Caller 1":""}})},100),setTimeout(()=>{this.trigger("accepted")},200),setTimeout(()=>{this.trigger("confirmed")},300))},A),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))}forEachSenders(e){const t=this.connection.getSenders();for(const r of t)e(r);return t}toggleMuteAudio(e){this.forEachSenders(({track:t})=>{t&&t.kind==="audio"&&(t.enabled=!e)})}toggleMuteVideo(e){this.forEachSenders(({track:t})=>{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)}}class Et{extraHeaders=[];setExtraHeaders(e){this.extraHeaders=e}setExtraContactParams(){}}const d="PASSWORD_CORRECT",T="PASSWORD_CORRECT_2",L="NAME_INCORRECT",h=400,g={url:"wss://sipServerUrl/webrtc/wss/",sip_uri:"sip:sipServerUrl;transport=ws",via_transport:"WSS"},M={status_code:200,reason_phrase:"OK"},O={status_code:401,reason_phrase:"Unauthorized"};class o{static isAvailableTelephony=!0;static startError;static countStartError=Number.POSITIVE_INFINITY;static countStarts=0;events;registratorInner;call=jest.fn((e,t)=>{const{mediaStream:r,eventHandlers:s}=t;return this.session=new i({eventHandlers:s,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(o.countStarts+=1,o.startError&&o.countStarts<o.countStartError){this.trigger("disconnected",o.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 S.Events(D);const[t,r]=e.uri.split(":"),[s,c]=r.split("@"),p={...e,uri:new a.URI(t,s,c)};this.configuration=p,this.registratorInner=new Et}static setStartError(e,{count:t=Number.POSITIVE_INFINITY}={}){o.startError=e,o.countStartError=t}static resetStartError(){o.startError=void 0,o.countStartError=Number.POSITIVE_INFINITY,o.countStarts=0}static setAvailableTelephony(){o.isAvailableTelephony=!0}static setNotAvailableTelephony(){o.isAvailableTelephony=!1}static reset(){o.resetStartError(),o.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(L)?(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:O,cause:a.C.causes.REJECTED})},h)):!this.isRegistered()&&t===!0&&(e===d||e===T)?(this.isRegisteredInner=!0,this.startedTimeout=setTimeout(()=>{this.trigger("registered",{response:M})},h)):t===!0&&e!==d&&e!==T&&(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:O,cause:a.C.causes.REJECTED})},h)),o.isAvailableTelephony?(this.trigger("connected",{socket:g}),this.isConnectedInner=!0):this.stop()}unregister(){this.isRegisteredInner=!1,this.isConnectedInner=!1,this.trigger("unregistered",{response:M})}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 b.EventEmitter{contentType;body;constructor(e,t){super(),this.contentType=e,this.body=t}}const I="remote",mt=(n,e)=>{const t=new N(e),r={originator:I,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 s=new i({originator:I,eventHandlers:{}}),c=new k("sip",e,r);s.remote_identity=new V(c,t);const p=new N([]);n.trigger("newRTCSession",{originator:I,session:s,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:o,C:{INVITE:"INVITE"}},u="user",E="displayName",m="SIP_SERVER_URL",C="SIP_WEB_SOCKET_SERVER_URL",_t=new w.WebSocketInterface(C),R={userAgent:"Chrome",sipServerUrl:m,sipWebSocketServerURL:C},Tt={...R},F={...R,user:u,password:d,register:!0},It={...F,displayName:E},St={...R,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:"",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},Rt={...l,display_name:"",register:!1},W="10.10.10.10",ft=[`X-Vinteo-Remote: ${W}`],At=()=>new P.SipConnector({JsSIP:w});exports.FAILED_CONFERENCE_NUMBER=y;exports.JsSIP=w;exports.NAME_INCORRECT=L;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=T;exports.SIP_SERVER_URL=m;exports.SIP_WEB_SOCKET_SERVER_URL=C;exports.dataForConnectionWithAuthorization=F;exports.dataForConnectionWithAuthorizationWithDisplayName=It;exports.dataForConnectionWithoutAuthorization=St;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=Tt;exports.displayName=E;exports.doMockSipConnector=At;exports.extraHeadersRemoteAddress=ft;exports.remoteAddress=W;exports.uaConfigurationWithAuthorization=Nt;exports.uaConfigurationWithAuthorizationWithDisplayName=wt;exports.uaConfigurationWithoutAuthorization=Ct;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=Rt;exports.user=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("node:events"),V=require("@krivega/jssip/lib/NameAddrHeader"),k=require("@krivega/jssip/lib/URI"),U=require("@krivega/jssip/lib/SIPMessage"),a=require("@krivega/jssip"),f=require("webrtc-mock"),S=require("events-constructor"),P=require("./@SipConnector-BjWfal-x.cjs");class N extends U.IncomingRequest{headers;constructor(e){super(),this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)??""}}const H="incomingCall",q="declinedIncomingCall",G="failedIncomingCall",x="terminatedIncomingCall",v="connecting",z="connected",j="disconnected",Y="newRTCSession",B="registered",K="unregistered",J="registrationFailed",$="newMessage",Q="sipEvent",X="availableSecondRemoteStream",Z="notAvailableSecondRemoteStream",ee="mustStopPresentation",te="shareState",re="enterRoom",ne="useLicense",oe="peerconnection:confirmed",ie="peerconnection:ontrack",se="channels",ae="channels:notify",ce="ended:fromserver",de="main-cam-control",Ee="admin-stop-main-cam",he="admin-start-main-cam",ue="admin-stop-mic",me="admin-start-mic",le="admin-force-sync-media-state",pe="participant:added-to-list-moderators",ge="participant:removed-from-list-moderators",_e="participant:move-request-to-stream",Te="participant:move-request-to-spectators",Ie="participant:move-request-to-participants",Se="participation:accepting-word-request",Ne="participation:cancelling-word-request",we="webcast:started",Ce="webcast:stopped",Re="account:changed",fe="account:deleted",Ae="conference:participant-token-issued",Me="ended",Oe="sending",Pe="reinvite",ve="replaces",De="refer",ye="progress",Le="accepted",Fe="confirmed",We="peerconnection",be="failed",Ve="muted",ke="unmuted",Ue="newDTMF",He="newInfo",qe="hold",Ge="unhold",xe="update",ze="sdp",je="icecandidate",Ye="getusermediafailed",Be="peerconnection:createofferfailed",Ke="peerconnection:createanswerfailed",Je="peerconnection:setlocaldescriptionfailed",$e="peerconnection:setremotedescriptionfailed",Qe="presentation:start",Xe="presentation:started",Ze="presentation:end",et="presentation:ended",tt="presentation:failed",rt=[H,q,x,G,Se,Ne,_e,ae,Ae,Re,fe,we,Ce,pe,ge],D=[v,z,j,Y,B,K,J,$,Q],nt=[X,Z,ee,te,re,ne,oe,ie,se,ce,de,he,Ee,ue,me,le,Te,Ie],_=[Me,v,Oe,Pe,ve,De,ye,Le,Fe,We,be,Ve,ke,Ue,He,qe,Ge,xe,ze,je,Ye,Be,Ke,Je,$e,Qe,Xe,Ze,et,tt];[...D,...rt];[..._,...nt];class ot{originator;connection;events;remote_identity;mutedOptions={audio:!1,video:!1};constructor({originator:e="local",eventHandlers:t,remoteIdentity:r}){this.originator=e,this.events=new S.Events(_),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 _.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 it{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.")}}const st=["track"];class at{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;events;constructor(e,t){this.events=new S.Events(st),this.receivers=t.map(r=>({track:r}))}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(e){throw new Error("Method not implemented.")}addTransceiver(e,t){throw new Error("Method not implemented.")}close(){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.")}async createOffer(e,t,r){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.")}async setLocalDescription(e){throw new Error("Method not implemented.")}async setRemoteDescription(e){throw new Error("Method not implemented.")}addEventListener(e,t,r){this.events.on(e,t)}removeEventListener(e,t,r){this.events.off(e,t)}dispatchEvent(e){throw new Error("Method not implemented.")}getReceivers=()=>this.receivers;getSenders=()=>this.senders;addTrack=e=>{const t=new it({track:e});return this.senders.push(t),this.events.trigger("track",{track:e}),t}}function ct(n){const e=n.match(/(purgatory)|[\d.]+/g);if(!e)throw new Error("wrong sip url");return e[0]}const A=400,y="777",dt=n=>n.getVideoTracks().length>0;class s extends ot{static presentationError;static startPresentationError;static countStartPresentationError=Number.POSITIVE_INFINITY;static countStartsPresentation=0;url;status_code;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)},A)});replaceMediaStream=jest.fn(async e=>{});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:i=0}){super({originator:t,eventHandlers:e,remoteIdentity:r}),this.delayStartPresentation=i}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=f.createAudioMediaStreamTrackMock();t.id="mainaudio1";const r=[t];if(dt(e)){const c=f.createVideoMediaStreamTrackMock();c.id="mainvideo1",r.push(c)}this.connection=new at(void 0,r),this.addStream(e),this.trigger("peerconnection",{peerconnection:this.connection})}connect(e,{mediaStream:t}={}){const r=ct(e);return this.initPeerconnection(t),this.timeoutConnect=setTimeout(()=>{e.includes(y)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:"Rejected"}):(this.trigger("connecting"),this.timeoutNewInfo=setTimeout(()=>{this.newInfo({originator:P.Originator.REMOTE,request:{getHeader:i=>i==="content-type"?"application/vinteo.webrtc.roomname":i==="x-webrtc-enter-room"?r:i==="x-webrtc-participant-name"?"Test Caller 1":""}})},100),this.timeoutAccepted=setTimeout(()=>{this.trigger("accepted")},200),this.timeoutConfirmed=setTimeout(()=>{this.trigger("confirmed")},300))},A),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))}forEachSenders(e){const t=this.connection.getSenders();for(const r of t)e(r);return t}toggleMuteAudio(e){this.forEachSenders(({track:t})=>{t&&t.kind==="audio"&&(t.enabled=!e)})}toggleMuteVideo(e){this.forEachSenders(({track:t})=>{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",T="PASSWORD_CORRECT_2",L="NAME_INCORRECT",h=400,g={url:"wss://sipServerUrl/webrtc/wss/",sip_uri:"sip:sipServerUrl;transport=ws",via_transport:"WSS"},M={status_code:200,reason_phrase:"OK"},O={status_code:401,reason_phrase:"Unauthorized"};class o{static isAvailableTelephony=!0;static startError;static countStartError=Number.POSITIVE_INFINITY;static countStarts=0;events;registratorInner;call=jest.fn((e,t)=>{const{mediaStream:r,eventHandlers:i}=t;return this.session=new s({eventHandlers:i,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(o.countStarts+=1,o.startError&&o.countStarts<o.countStartError){this.trigger("disconnected",o.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 S.Events(D);const[t,r]=e.uri.split(":"),[i,c]=r.split("@"),p={...e,uri:new a.URI(t,i,c)};this.configuration=p,this.registratorInner=new Et}static setStartError(e,{count:t=Number.POSITIVE_INFINITY}={}){o.startError=e,o.countStartError=t}static resetStartError(){o.startError=void 0,o.countStartError=Number.POSITIVE_INFINITY,o.countStarts=0}static setAvailableTelephony(){o.isAvailableTelephony=!0}static setNotAvailableTelephony(){o.isAvailableTelephony=!1}static reset(){o.resetStartError(),o.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(L)?(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:O,cause:a.C.causes.REJECTED})},h)):!this.isRegistered()&&t===!0&&(e===d||e===T)?(this.isRegisteredInner=!0,this.startedTimeout=setTimeout(()=>{this.trigger("registered",{response:M})},h)):t===!0&&e!==d&&e!==T&&(this.isRegisteredInner=!1,this.isConnectedInner=!1,this.startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:O,cause:a.C.causes.REJECTED})},h)),o.isAvailableTelephony?(this.trigger("connected",{socket:g}),this.isConnectedInner=!0):this.stop()}unregister(){this.isRegisteredInner=!1,this.isConnectedInner=!1,this.trigger("unregistered",{response:M})}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 b.EventEmitter{contentType;body;constructor(e,t){super(),this.contentType=e,this.body=t}}const I="remote",mt=(n,e)=>{const t=new N(e),r={originator:I,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 i=new s({originator:I,eventHandlers:{}}),c=new k("sip",e,r);i.remote_identity=new V(c,t);const p=new N([]);n.trigger("newRTCSession",{originator:I,session:i,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:o,C:{INVITE:"INVITE"}},u="user",E="displayName",m="SIP_SERVER_URL",C="SIP_WEB_SOCKET_SERVER_URL",_t=new w.WebSocketInterface(C),R={userAgent:"Chrome",sipServerUrl:m,sipWebSocketServerURL:C},Tt={...R},F={...R,user:u,password:d,register:!0},It={...F,displayName:E},St={...R,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:"",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},Rt={...l,display_name:"",register:!1},W="10.10.10.10",ft=[`X-Vinteo-Remote: ${W}`],At=()=>new P.SipConnector({JsSIP:w});exports.FAILED_CONFERENCE_NUMBER=y;exports.JsSIP=w;exports.NAME_INCORRECT=L;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=T;exports.SIP_SERVER_URL=m;exports.SIP_WEB_SOCKET_SERVER_URL=C;exports.dataForConnectionWithAuthorization=F;exports.dataForConnectionWithAuthorizationWithDisplayName=It;exports.dataForConnectionWithoutAuthorization=St;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=Tt;exports.displayName=E;exports.doMockSipConnector=At;exports.extraHeadersRemoteAddress=ft;exports.remoteAddress=W;exports.uaConfigurationWithAuthorization=Nt;exports.uaConfigurationWithAuthorizationWithDisplayName=wt;exports.uaConfigurationWithoutAuthorization=Ct;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=Rt;exports.user=u;
package/dist/doMock.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { EventEmitter as D } from "node:events";
2
- import L from "@krivega/jssip/lib/NameAddrHeader";
3
- import y from "@krivega/jssip/lib/URI";
2
+ import y from "@krivega/jssip/lib/NameAddrHeader";
3
+ import L from "@krivega/jssip/lib/URI";
4
4
  import { IncomingRequest as F } from "@krivega/jssip/lib/SIPMessage";
5
5
  import { NameAddrHeader as b, URI as E, C as N } from "@krivega/jssip";
6
6
  import { createAudioMediaStreamTrackMock as V, createVideoMediaStreamTrackMock as k } from "webrtc-mock";
7
- import { Events as _ } from "events-constructor";
8
- import { O as W, S as U } from "./@SipConnector-uiUlVCMv.js";
9
- class T extends F {
7
+ import { Events as T } from "events-constructor";
8
+ import { O as W, S as U } from "./@SipConnector-CoBe6WQF.js";
9
+ class _ extends F {
10
10
  headers;
11
11
  constructor(e) {
12
12
  super(), this.headers = new Headers(e);
@@ -15,14 +15,14 @@ class T extends F {
15
15
  return this.headers.get(e) ?? "";
16
16
  }
17
17
  }
18
- const G = "incomingCall", H = "declinedIncomingCall", x = "failedIncomingCall", q = "terminatedIncomingCall", A = "connecting", Y = "connected", j = "disconnected", z = "newRTCSession", B = "registered", $ = "unregistered", J = "registrationFailed", K = "newMessage", Q = "sipEvent", X = "availableSecondRemoteStream", Z = "notAvailableSecondRemoteStream", ee = "mustStopPresentation", te = "shareState", re = "enterRoom", ne = "useLicense", oe = "peerconnection:confirmed", se = "peerconnection:ontrack", ie = "channels", ae = "channels:notify", ce = "ended:fromserver", de = "main-cam-control", Ee = "admin-stop-main-cam", he = "admin-start-main-cam", me = "admin-stop-mic", le = "admin-start-mic", ue = "admin-force-sync-media-state", pe = "participant:added-to-list-moderators", ge = "participant:removed-from-list-moderators", _e = "participant:move-request-to-stream", Te = "participant:move-request-to-spectators", Ie = "participant:move-request-to-participants", we = "participation:accepting-word-request", Se = "participation:cancelling-word-request", Ne = "webcast:started", fe = "webcast:stopped", Ce = "account:changed", Re = "account:deleted", Me = "conference:participant-token-issued", Ae = "ended", Oe = "sending", Pe = "reinvite", ve = "replaces", De = "refer", Le = "progress", ye = "accepted", Fe = "confirmed", be = "peerconnection", Ve = "failed", ke = "muted", We = "unmuted", Ue = "newDTMF", Ge = "newInfo", He = "hold", xe = "unhold", qe = "update", Ye = "sdp", je = "icecandidate", ze = "getusermediafailed", Be = "peerconnection:createofferfailed", $e = "peerconnection:createanswerfailed", Je = "peerconnection:setlocaldescriptionfailed", Ke = "peerconnection:setremotedescriptionfailed", Qe = "presentation:start", Xe = "presentation:started", Ze = "presentation:end", et = "presentation:ended", tt = "presentation:failed", rt = [
18
+ const G = "incomingCall", H = "declinedIncomingCall", x = "failedIncomingCall", q = "terminatedIncomingCall", A = "connecting", Y = "connected", j = "disconnected", z = "newRTCSession", B = "registered", $ = "unregistered", J = "registrationFailed", K = "newMessage", Q = "sipEvent", X = "availableSecondRemoteStream", Z = "notAvailableSecondRemoteStream", ee = "mustStopPresentation", te = "shareState", re = "enterRoom", ne = "useLicense", oe = "peerconnection:confirmed", se = "peerconnection:ontrack", ie = "channels", ae = "channels:notify", ce = "ended:fromserver", de = "main-cam-control", Ee = "admin-stop-main-cam", he = "admin-start-main-cam", me = "admin-stop-mic", ue = "admin-start-mic", le = "admin-force-sync-media-state", pe = "participant:added-to-list-moderators", ge = "participant:removed-from-list-moderators", Te = "participant:move-request-to-stream", _e = "participant:move-request-to-spectators", Ie = "participant:move-request-to-participants", Se = "participation:accepting-word-request", we = "participation:cancelling-word-request", Ne = "webcast:started", fe = "webcast:stopped", Ce = "account:changed", Re = "account:deleted", Me = "conference:participant-token-issued", Ae = "ended", Oe = "sending", Pe = "reinvite", ve = "replaces", De = "refer", ye = "progress", Le = "accepted", Fe = "confirmed", be = "peerconnection", Ve = "failed", ke = "muted", We = "unmuted", Ue = "newDTMF", Ge = "newInfo", He = "hold", xe = "unhold", qe = "update", Ye = "sdp", je = "icecandidate", ze = "getusermediafailed", Be = "peerconnection:createofferfailed", $e = "peerconnection:createanswerfailed", Je = "peerconnection:setlocaldescriptionfailed", Ke = "peerconnection:setremotedescriptionfailed", Qe = "presentation:start", Xe = "presentation:started", Ze = "presentation:end", et = "presentation:ended", tt = "presentation:failed", rt = [
19
19
  G,
20
20
  H,
21
21
  q,
22
22
  x,
23
- we,
24
23
  Se,
25
- _e,
24
+ we,
25
+ Te,
26
26
  ae,
27
27
  Me,
28
28
  Ce,
@@ -56,9 +56,9 @@ const G = "incomingCall", H = "declinedIncomingCall", x = "failedIncomingCall",
56
56
  he,
57
57
  Ee,
58
58
  me,
59
- le,
60
59
  ue,
61
- Te,
60
+ le,
61
+ _e,
62
62
  Ie
63
63
  ], p = [
64
64
  Ae,
@@ -67,8 +67,8 @@ const G = "incomingCall", H = "declinedIncomingCall", x = "failedIncomingCall",
67
67
  Pe,
68
68
  ve,
69
69
  De,
70
- Le,
71
70
  ye,
71
+ Le,
72
72
  Fe,
73
73
  be,
74
74
  Ve,
@@ -108,7 +108,7 @@ class ot {
108
108
  eventHandlers: t,
109
109
  remoteIdentity: r
110
110
  }) {
111
- this.originator = e, this.events = new _(p), this.initEvents(t), this.remote_identity = r;
111
+ this.originator = e, this.events = new T(p), this.initEvents(t), this.remote_identity = r;
112
112
  }
113
113
  get contact() {
114
114
  throw new Error("Method not implemented.");
@@ -343,7 +343,7 @@ class at {
343
343
  signalingState;
344
344
  events;
345
345
  constructor(e, t) {
346
- this.events = new _(it), this.receivers = t.map((r) => ({ track: r }));
346
+ this.events = new T(it), this.receivers = t.map((r) => ({ track: r }));
347
347
  }
348
348
  getRemoteStreams() {
349
349
  throw new Error("Method not implemented.");
@@ -446,15 +446,22 @@ class i extends ot {
446
446
  replaceMediaStream = jest.fn(async (e) => {
447
447
  });
448
448
  isEndedInner = !1;
449
+ delayStartPresentation = 0;
450
+ timeoutStartPresentation;
451
+ timeoutConnect;
452
+ timeoutNewInfo;
453
+ timeoutAccepted;
454
+ timeoutConfirmed;
449
455
  constructor({
450
456
  eventHandlers: e,
451
457
  originator: t,
452
458
  remoteIdentity: r = new b(
453
459
  new E("sip", "caller1", "test1.com", 5060),
454
460
  "Test Caller 1"
455
- )
461
+ ),
462
+ delayStartPresentation: s = 0
456
463
  }) {
457
- super({ originator: t, eventHandlers: e, remoteIdentity: r });
464
+ super({ originator: t, eventHandlers: e, remoteIdentity: r }), this.delayStartPresentation = s;
458
465
  }
459
466
  static setPresentationError(e) {
460
467
  this.presentationError = e;
@@ -468,13 +475,19 @@ class i extends ot {
468
475
  static resetStartPresentationError() {
469
476
  this.startPresentationError = void 0, this.countStartPresentationError = Number.POSITIVE_INFINITY, this.countStartsPresentation = 0;
470
477
  }
471
- startPresentation = async (e) => {
472
- if (i.countStartsPresentation += 1, i.presentationError)
473
- throw this.trigger("presentation:start", e), this.trigger("presentation:failed", e), i.presentationError;
474
- if (i.startPresentationError && i.countStartsPresentation < i.countStartPresentationError)
475
- throw this.trigger("presentation:start", e), this.trigger("presentation:failed", e), i.startPresentationError;
476
- return super.startPresentation(e);
477
- };
478
+ startPresentation = async (e) => (i.countStartsPresentation += 1, new Promise((t, r) => {
479
+ this.timeoutStartPresentation = setTimeout(() => {
480
+ if (i.presentationError) {
481
+ this.trigger("presentation:start", e), this.trigger("presentation:failed", e), r(i.presentationError);
482
+ return;
483
+ }
484
+ if (i.startPresentationError && i.countStartsPresentation < i.countStartPresentationError) {
485
+ this.trigger("presentation:start", e), this.trigger("presentation:failed", e), r(i.startPresentationError);
486
+ return;
487
+ }
488
+ t(super.startPresentation(e));
489
+ }, this.delayStartPresentation);
490
+ }));
478
491
  stopPresentation = async (e) => {
479
492
  if (i.presentationError)
480
493
  throw this.trigger("presentation:end", e), this.trigger("presentation:failed", e), i.presentationError;
@@ -495,12 +508,12 @@ class i extends ot {
495
508
  }
496
509
  connect(e, { mediaStream: t } = {}) {
497
510
  const r = ct(e);
498
- return this.initPeerconnection(t), setTimeout(() => {
511
+ return this.initPeerconnection(t), this.timeoutConnect = setTimeout(() => {
499
512
  e.includes(dt) ? this.trigger("failed", {
500
513
  originator: "remote",
501
514
  message: "IncomingResponse",
502
515
  cause: "Rejected"
503
- }) : (this.trigger("connecting"), setTimeout(() => {
516
+ }) : (this.trigger("connecting"), this.timeoutNewInfo = setTimeout(() => {
504
517
  this.newInfo({
505
518
  originator: W.REMOTE,
506
519
  // @ts-expect-error
@@ -508,9 +521,9 @@ class i extends ot {
508
521
  getHeader: (s) => s === "content-type" ? "application/vinteo.webrtc.roomname" : s === "x-webrtc-enter-room" ? r : s === "x-webrtc-participant-name" ? "Test Caller 1" : ""
509
522
  }
510
523
  });
511
- }, 100), setTimeout(() => {
524
+ }, 100), this.timeoutAccepted = setTimeout(() => {
512
525
  this.trigger("accepted");
513
- }, 200), setTimeout(() => {
526
+ }, 200), this.timeoutConfirmed = setTimeout(() => {
514
527
  this.trigger("confirmed");
515
528
  }, 300));
516
529
  }, f), this.connection;
@@ -573,6 +586,9 @@ class i extends ot {
573
586
  newInfo(e) {
574
587
  this.trigger("newInfo", e);
575
588
  }
589
+ clear() {
590
+ clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
591
+ }
576
592
  /* eslint-enable no-param-reassign */
577
593
  }
578
594
  class ht {
@@ -584,7 +600,7 @@ class ht {
584
600
  setExtraContactParams() {
585
601
  }
586
602
  }
587
- const c = "PASSWORD_CORRECT", C = "PASSWORD_CORRECT_2", mt = "NAME_INCORRECT", d = 400, u = {
603
+ const c = "PASSWORD_CORRECT", C = "PASSWORD_CORRECT_2", mt = "NAME_INCORRECT", d = 400, l = {
588
604
  url: "wss://sipServerUrl/webrtc/wss/",
589
605
  sip_uri: "sip:sipServerUrl;transport=ws",
590
606
  via_transport: "WSS"
@@ -629,8 +645,8 @@ class o {
629
645
  */
630
646
  stop = jest.fn(() => {
631
647
  this.startedTimeout && clearTimeout(this.startedTimeout), this.stopedTimeout && clearTimeout(this.stopedTimeout), this.unregister(), this.isStarted() ? this.stopedTimeout = setTimeout(() => {
632
- this.trigger("disconnected", { error: !0, socket: u });
633
- }, d) : this.trigger("disconnected", { error: !0, socket: u });
648
+ this.trigger("disconnected", { error: !0, socket: l });
649
+ }, d) : this.trigger("disconnected", { error: !0, socket: l });
634
650
  });
635
651
  removeAllListeners = jest.fn(() => (this.events.removeEventHandlers(), this));
636
652
  once = jest.fn((e, t) => (this.events.once(e, t), this));
@@ -641,12 +657,12 @@ class o {
641
657
  isConnectedInner;
642
658
  configuration;
643
659
  constructor(e) {
644
- this.events = new _(O);
645
- const [t, r] = e.uri.split(":"), [s, a] = r.split("@"), l = {
660
+ this.events = new T(O);
661
+ const [t, r] = e.uri.split(":"), [s, a] = r.split("@"), u = {
646
662
  ...e,
647
663
  uri: new E(t, s, a)
648
664
  };
649
- this.configuration = l, this.registratorInner = new ht();
665
+ this.configuration = u, this.registratorInner = new ht();
650
666
  }
651
667
  static setStartError(e, { count: t = Number.POSITIVE_INFINITY } = {}) {
652
668
  o.startError = e, o.countStartError = t;
@@ -697,7 +713,7 @@ class o {
697
713
  this.trigger("registered", { response: R });
698
714
  }, d)) : t === !0 && e !== c && e !== C && (this.isRegisteredInner = !1, this.isConnectedInner = !1, this.startedTimeout = setTimeout(() => {
699
715
  this.trigger("registrationFailed", { response: M, cause: N.causes.REJECTED });
700
- }, d)), o.isAvailableTelephony ? (this.trigger("connected", { socket: u }), this.isConnectedInner = !0) : this.stop();
716
+ }, d)), o.isAvailableTelephony ? (this.trigger("connected", { socket: l }), this.isConnectedInner = !0) : this.stop();
701
717
  }
702
718
  /**
703
719
  * unregister
@@ -728,13 +744,13 @@ class o {
728
744
  return this.registratorInner;
729
745
  }
730
746
  }
731
- class lt {
747
+ class ut {
732
748
  url;
733
749
  constructor(e) {
734
750
  this.url = e;
735
751
  }
736
752
  }
737
- class ut extends D {
753
+ class lt extends D {
738
754
  contentType;
739
755
  body;
740
756
  constructor(e, t) {
@@ -742,56 +758,56 @@ class ut extends D {
742
758
  }
743
759
  }
744
760
  const g = "remote", pt = (n, e) => {
745
- const t = new T(e), r = {
761
+ const t = new _(e), r = {
746
762
  originator: g,
747
763
  request: t,
748
- info: new ut("", "")
764
+ info: new lt("", "")
749
765
  };
750
766
  n.newInfo(r);
751
767
  }, gt = (n, e) => {
752
- const r = { event: "sipEvent", request: new T(e) };
768
+ const r = { event: "sipEvent", request: new _(e) };
753
769
  n.newSipEvent(r);
754
- }, _t = (n, {
770
+ }, Tt = (n, {
755
771
  incomingNumber: e = "1234",
756
772
  displayName: t,
757
773
  host: r
758
774
  }) => {
759
- const s = new i({ originator: g, eventHandlers: {} }), a = new y("sip", e, r);
760
- s.remote_identity = new L(a, t);
761
- const l = new T([]);
775
+ const s = new i({ originator: g, eventHandlers: {} }), a = new L("sip", e, r);
776
+ s.remote_identity = new y(a, t);
777
+ const u = new _([]);
762
778
  n.trigger("newRTCSession", {
763
779
  originator: g,
764
780
  session: s,
765
- request: l
781
+ request: u
766
782
  });
767
- }, Tt = (n, e) => {
783
+ }, _t = (n, e) => {
768
784
  e ? n.trigger("failed", e) : n.trigger("failed", n);
769
785
  }, P = {
770
786
  triggerNewInfo: pt,
771
787
  triggerNewSipEvent: gt,
772
- triggerIncomingSession: _t,
773
- triggerFailIncomingSession: Tt,
774
- WebSocketInterface: lt,
788
+ triggerIncomingSession: Tt,
789
+ triggerFailIncomingSession: _t,
790
+ WebSocketInterface: ut,
775
791
  UA: o,
776
792
  C: {
777
793
  INVITE: "INVITE"
778
794
  }
779
- }, I = "user", h = "displayName", w = "SIP_SERVER_URL", v = "SIP_WEB_SOCKET_SERVER_URL", It = new P.WebSocketInterface(v), S = {
795
+ }, I = "user", h = "displayName", S = "SIP_SERVER_URL", v = "SIP_WEB_SOCKET_SERVER_URL", It = new P.WebSocketInterface(v), w = {
780
796
  userAgent: "Chrome",
781
- sipServerUrl: w,
797
+ sipServerUrl: S,
782
798
  sipWebSocketServerURL: v
783
799
  }, vt = {
784
- ...S
785
- }, wt = {
786
- ...S,
800
+ ...w
801
+ }, St = {
802
+ ...w,
787
803
  user: I,
788
804
  password: c,
789
805
  register: !0
790
806
  }, Dt = {
791
- ...wt,
807
+ ...St,
792
808
  displayName: h
793
- }, Lt = {
794
- ...S,
809
+ }, yt = {
810
+ ...w,
795
811
  displayName: h,
796
812
  register: !1
797
813
  }, m = {
@@ -802,16 +818,16 @@ const g = "remote", pt = (n, e) => {
802
818
  register_expires: 300,
803
819
  connection_recovery_max_interval: 6,
804
820
  connection_recovery_min_interval: 2
805
- }, yt = {
821
+ }, Lt = {
806
822
  ...m,
807
823
  password: c,
808
- uri: new E("sip", I, w),
824
+ uri: new E("sip", I, S),
809
825
  display_name: "",
810
826
  register: !0
811
827
  }, Ft = {
812
828
  ...m,
813
829
  password: c,
814
- uri: new E("sip", I, w),
830
+ uri: new E("sip", I, S),
815
831
  display_name: h,
816
832
  register: !0
817
833
  }, bt = {
@@ -822,7 +838,7 @@ const g = "remote", pt = (n, e) => {
822
838
  ...m,
823
839
  display_name: "",
824
840
  register: !1
825
- }, St = "10.10.10.10", kt = [`X-Vinteo-Remote: ${St}`], Wt = () => new U({
841
+ }, wt = "10.10.10.10", kt = [`X-Vinteo-Remote: ${wt}`], Wt = () => new U({
826
842
  JsSIP: P
827
843
  });
828
844
  export {
@@ -831,17 +847,17 @@ export {
831
847
  mt as NAME_INCORRECT,
832
848
  c as PASSWORD_CORRECT,
833
849
  C as PASSWORD_CORRECT_2,
834
- w as SIP_SERVER_URL,
850
+ S as SIP_SERVER_URL,
835
851
  v as SIP_WEB_SOCKET_SERVER_URL,
836
- wt as dataForConnectionWithAuthorization,
852
+ St as dataForConnectionWithAuthorization,
837
853
  Dt as dataForConnectionWithAuthorizationWithDisplayName,
838
- Lt as dataForConnectionWithoutAuthorization,
854
+ yt as dataForConnectionWithoutAuthorization,
839
855
  vt as dataForConnectionWithoutAuthorizationWithoutDisplayName,
840
856
  h as displayName,
841
857
  Wt as doMockSipConnector,
842
858
  kt as extraHeadersRemoteAddress,
843
- St as remoteAddress,
844
- yt as uaConfigurationWithAuthorization,
859
+ wt as remoteAddress,
860
+ Lt as uaConfigurationWithAuthorization,
845
861
  Ft as uaConfigurationWithAuthorizationWithDisplayName,
846
862
  bt as uaConfigurationWithoutAuthorization,
847
863
  Vt as uaConfigurationWithoutAuthorizationWithoutDisplayName,