sip-connector 14.0.1-0 → 14.1.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-BPIL3yLc.js +1343 -0
- package/dist/SipConnector-BUbfMgHs.cjs +1 -0
- package/dist/{src/SipConnector.d.ts → SipConnector.d.ts} +77 -63
- package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +31 -19
- package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +14 -14
- package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.d.ts +2 -2
- package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +27 -23
- package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +43 -24
- package/dist/{src/__fixtures__ → __fixtures__}/channelsNotify.d.ts +2 -2
- package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +1 -1
- package/dist/{src/__fixtures__ → __fixtures__}/participantNotify.d.ts +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +390 -379
- package/dist/index.cjs +1 -1
- package/dist/{src/index.d.ts → index.d.ts} +1 -1
- package/dist/index.js +519 -510
- package/dist/{src/types.d.ts → types.d.ts} +1 -2
- package/dist/utils.d.ts +4 -0
- package/package.json +32 -32
- package/dist/SipConnector-CJN8qKAC.js +0 -1316
- package/dist/SipConnector-DO0YvSq6.cjs +0 -1
- /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +0 -0
- /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/channels.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/utils.d.ts +0 -0
- /package/dist/{src/__fixtures__ → __fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{src/causes.d.ts → causes.d.ts} +0 -0
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/doMock.d.ts → doMock.d.ts} +0 -0
- /package/dist/{src/eventNames.d.ts → eventNames.d.ts} +0 -0
- /package/dist/{src/getExtraHeadersRemoteAddress.d.ts → getExtraHeadersRemoteAddress.d.ts} +0 -0
- /package/dist/{src/headers.d.ts → headers.d.ts} +0 -0
- /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/index.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{src/setParametersToSender → setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{src/tools → tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/getLinkError.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{src/tools → tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{src/tools → tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{src/tools → tools}/getUserAgent.d.ts +0 -0
- /package/dist/{src/tools → tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{src/tools → tools}/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/prepareMediaStream.d.ts +0 -0
- /package/dist/{src/tools → tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{src/tools → tools}/sendDTMFAccumulated.d.ts +0 -0
- /package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/index.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
- /package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
- /package/dist/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/{src/utils → utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{src/utils → utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{src/utils → utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Dt=Object.defineProperty;var Mt=(s,e,t)=>e in s?Dt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>Mt(s,typeof e!="symbol"?e+"":e,t);const N=require("@krivega/cancelable-promise"),Ue=require("events-constructor"),J=require("repeated-calls"),X=require("debug"),pt="Connection Error",Be="Request Timeout",vt="SIP Failure Code",yt="Internal Error",bt="Busy",Q="Rejected",wt="Redirected",Ut="Unavailable",Fe="Not Found",Lt="Address Incomplete",Ht="Incompatible SDP",Wt="Missing SDP",qt="Authentication Error",xe="Terminated",kt="WebRTC Error",Ve="Canceled",Bt="No Answer",Ft="Expires",xt="No ACK",Vt="Dialog Error",Yt="User Denied Media Access",Ye="Bad Media Description",$t="RTP Timeout",Gt=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_INCOMPLETE:Lt,AUTHENTICATION_ERROR:qt,BAD_MEDIA_DESCRIPTION:Ye,BUSY:bt,BYE:xe,CANCELED:Ve,CONNECTION_ERROR:pt,DIALOG_ERROR:Vt,EXPIRES:Ft,INCOMPATIBLE_SDP:Ht,INTERNAL_ERROR:yt,MISSING_SDP:Wt,NOT_FOUND:Fe,NO_ACK:xt,NO_ANSWER:Bt,REDIRECTED:wt,REJECTED:Q,REQUEST_TIMEOUT:Be,RTP_TIMEOUT:$t,SIP_FAILURE_CODE:vt,UNAVAILABLE:Ut,USER_DENIED_MEDIA_ACCESS:Yt,WEBRTC_ERROR:kt},Symbol.toStringTag,{value:"Module"})),z="incomingCall",j="declinedIncomingCall",K="failedIncomingCall",Z="terminatedIncomingCall",x="connecting",m="connected",C="disconnected",w="newRTCSession",D="registered",ee="unregistered",M="registrationFailed",$e="newMessage",te="sipEvent",ne="availableSecondRemoteStream",se="notAvailableSecondRemoteStream",ie="mustStopPresentation",U="shareState",re="enterRoom",oe="useLicense",ae="peerconnection:confirmed",ce="peerconnection:ontrack",L="channels",Ee="channels:notify",_e="ended:fromserver",le="main-cam-control",de="admin-stop-main-cam",he="admin-start-main-cam",Se="admin-stop-mic",Te="admin-start-mic",H="admin-force-sync-media-state",ue="participant:added-to-list-moderators",Ce="participant:removed-from-list-moderators",Ne="participant:move-request-to-stream",V="participant:move-request-to-spectators",Y="participant:move-request-to-participants",ge="participation:accepting-word-request",Ae="participation:cancelling-word-request",Re="webcast:started",Ie="webcast:stopped",fe="account:changed",Pe="account:deleted",Oe="conference:participant-token-issued",p="ended",Ge="sending",Je="reinvite",Xe="replaces",Qe="refer",ze="progress",je="accepted",W="confirmed",q="peerconnection",I="failed",Ke="muted",Ze="unmuted",me="newDTMF",De="newInfo",et="hold",tt="unhold",nt="update",st="sdp",it="icecandidate",rt="getusermediafailed",ot="peerconnection:createofferfailed",at="peerconnection:createanswerfailed",ct="peerconnection:setlocaldescriptionfailed",Et="peerconnection:setremotedescriptionfailed",_t="presentation:start",lt="presentation:started",dt="presentation:end",Me="presentation:ended",k="presentation:failed",ht="SPECTATOR",St="PARTICIPANT",Tt=1e6;var R=(s=>(s.LOCAL="local",s.REMOTE="remote",s.SYSTEM="system",s))(R||{});const Jt=Object.freeze(Object.defineProperty({__proto__:null,ACCEPTED:je,ACCOUNT_CHANGED:fe,ACCOUNT_DELETED:Pe,ADMIN_FORCE_SYNC_MEDIA_STATE:H,ADMIN_START_MAIN_CAM:he,ADMIN_START_MIC:Te,ADMIN_STOP_MAIN_CAM:de,ADMIN_STOP_MIC:Se,AVAILABLE_SECOND_REMOTE_STREAM_EVENT:ne,CHANNELS:L,CHANNELS_NOTIFY:Ee,CONFERENCE_PARTICIPANT_TOKEN_ISSUED:Oe,CONFIRMED:W,CONNECTED:m,CONNECTING:x,DECLINED_INCOMING_CALL:j,DISCONNECTED:C,ENDED:p,ENDED_FROM_SERVER:_e,ENTER_ROOM:re,FAILED:I,FAILED_INCOMING_CALL:K,GET_USER_MEDIA_FAILED:rt,HOLD:et,ICE_CANDIDATE:it,INCOMING_CALL:z,MAIN_CAM_CONTROL:le,MUST_STOP_PRESENTATION_EVENT:ie,MUTED:Ke,NEW_DTMF:me,NEW_INFO:De,NEW_MESSAGE:$e,NEW_RTC_SESSION:w,NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:se,ONE_MEGABIT_IN_BITS:Tt,Originator:R,PARTICIPANT:St,PARTICIPANT_ADDED_TO_LIST_MODERATORS:ue,PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS:Y,PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:V,PARTICIPANT_MOVE_REQUEST_TO_STREAM:Ne,PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:Ce,PARTICIPATION_ACCEPTING_WORD_REQUEST:ge,PARTICIPATION_CANCELLING_WORD_REQUEST:Ae,PEER_CONNECTION:q,PEER_CONNECTION_CONFIRMED:ae,PEER_CONNECTION_CREATE_ANSWER_FAILED:at,PEER_CONNECTION_CREATE_OFFER_FAILED:ot,PEER_CONNECTION_ONTRACK:ce,PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:ct,PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:Et,PRESENTATION_END:dt,PRESENTATION_ENDED:Me,PRESENTATION_FAILED:k,PRESENTATION_START:_t,PRESENTATION_STARTED:lt,PROGRESS:ze,REFER:Qe,REGISTERED:D,REGISTRATION_FAILED:M,REINVITE:Je,REPLACES:Xe,SDP:st,SENDING:Ge,SHARE_STATE:U,SIP_EVENT:te,SPECTATOR:ht,TERMINATED_INCOMING_CALL:Z,UNHOLD:tt,UNMUTED:Ze,UNREGISTERED:ee,UPDATE:nt,USE_LICENSE:oe,WEBCAST_STARTED:Re,WEBCAST_STOPPED:Ie},Symbol.toStringTag,{value:"Module"})),ut=[z,j,Z,K,ge,Ae,Ne,Ee,Oe,fe,Pe,Re,Ie,ue,Ce],pe=[x,m,C,w,D,ee,M,$e,te],Ct=[ne,se,ie,U,re,oe,ae,ce,L,_e,le,he,de,Se,Te,H,V,Y],ve=[p,x,Ge,Je,Xe,Qe,ze,je,W,q,I,Ke,Ze,me,De,et,tt,nt,st,it,rt,ot,at,ct,Et,_t,lt,dt,Me,k],ye=[...pe,...ut],be=[...ve,...Ct],Xt=Object.freeze(Object.defineProperty({__proto__:null,SESSION_EVENT_NAMES:be,SESSION_JSSIP_EVENT_NAMES:ve,SESSION_SYNTHETICS_EVENT_NAMES:Ct,UA_EVENT_NAMES:ye,UA_JSSIP_EVENT_NAMES:pe,UA_SYNTHETICS_EVENT_NAMES:ut},Symbol.toStringTag,{value:"Module"})),we="sip-connector",b=X(we),Qt=()=>{X.enable(we)},zt=()=>{X.enable(`-${we}`)},jt=(s,e)=>(s.degradationPreference=e.degradationPreference,s),Kt=(s,e)=>{s.encodings===void 0&&(s.encodings=[]);for(let t=s.encodings.length;t<e;t+=1)s.encodings.push({});return s},Nt=s=>(e,t)=>t!==void 0&&e!==t||t===void 0&&e!==s,Zt=Nt(),en=(s,e)=>{if(Zt(s,e))return s},tn=(s,e)=>{const t=s.maxBitrate,n=en(e,t);return n!==void 0&&(s.maxBitrate=n),s},gt=1,nn=Nt(gt),sn=(s,e)=>{const t=s===void 0?void 0:Math.max(s,gt);if(t!==void 0&&nn(t,e))return t},rn=(s,e)=>{const t=s.scaleResolutionDownBy,n=sn(e,t);return n!==void 0&&(s.scaleResolutionDownBy=n),s},on=(s,e)=>{var n;const t=((n=e.encodings)==null?void 0:n.length)??0;return Kt(s,t),s.encodings.forEach((i,o)=>{const a=((e==null?void 0:e.encodings)??[])[o],c=a==null?void 0:a.maxBitrate,E=a==null?void 0:a.scaleResolutionDownBy;tn(i,c),rn(i,E)}),s},an=(s,e)=>{var t,n,i,o,a,c,E,_,h,S,l,T;if(((t=s.codecs)==null?void 0:t.length)!==((n=e.codecs)==null?void 0:n.length))return!0;for(let d=0;d<(((i=s.codecs)==null?void 0:i.length)??0);d++)if(JSON.stringify(s.codecs[d])!==JSON.stringify(e.codecs[d]))return!0;if(((o=s.headerExtensions)==null?void 0:o.length)!==((a=e.headerExtensions)==null?void 0:a.length))return!0;for(let d=0;d<(((c=s.headerExtensions)==null?void 0:c.length)??0);d++)if(JSON.stringify(s.headerExtensions[d])!==JSON.stringify(e.headerExtensions[d]))return!0;if(((E=s.encodings)==null?void 0:E.length)!==((_=e.encodings)==null?void 0:_.length))return!0;for(let d=0;d<(s.encodings.length??0);d++)if(JSON.stringify(s.encodings[d])!==JSON.stringify(e.encodings[d]))return!0;return((h=s.rtcp)==null?void 0:h.cname)!==((S=e.rtcp)==null?void 0:S.cname)||((l=s.rtcp)==null?void 0:l.reducedSize)!==((T=e.rtcp)==null?void 0:T.reducedSize)||s.degradationPreference!==e.degradationPreference},At=async(s,e)=>{const t=s.getParameters(),n=JSON.parse(JSON.stringify(t));on(t,e),jt(t,e);const i=an(n,t);return i&&await s.setParameters(t),{parameters:t,isChanged:i}};var f=(s=>(s.PAUSE_MAIN_CAM="PAUSEMAINCAM",s.RESUME_MAIN_CAM="RESUMEMAINCAM",s.MAX_MAIN_CAM_RESOLUTION="MAXMAINCAMRESOLUTION",s.ADMIN_STOP_MAIN_CAM="ADMINSTOPMAINCAM",s.ADMIN_START_MAIN_CAM="ADMINSTARTMAINCAM",s))(f||{}),B=(s=>(s.ADMIN_STOP_MIC="ADMINSTOPMIC",s.ADMIN_START_MIC="ADMINSTARTMIC",s))(B||{}),F=(s=>(s.ADMIN_SYNC_FORCED="1",s.ADMIN_SYNC_NOT_FORCED="0",s))(F||{}),Rt=(s=>(s.AUDIO="AUDIO",s.VIDEO="VIDEO",s.AUDIOPLUSPRESENTATION="AUDIOPLUSPRESENTATION",s))(Rt||{}),It=(s=>(s.VP8="video/VP8",s.VP9="video/VP9",s.H264="video/H264",s.AV1="video/AV1",s.rtx="video/rtx",s.red="video/red",s.flexfec03="video/flexfec-03",s))(It||{});const ft=async(s,e,t)=>{const{isChanged:n,parameters:i}=await At(s,{encodings:[{scaleResolutionDownBy:e.scaleResolutionDownBy,maxBitrate:e.maxBitrate}]});return n&&t&&t(i),{isChanged:n,parameters:i}},cn=s=>{const e=[];return s&&e.push(`X-Vinteo-Remote: ${s}`),e},En="content-type",_n="x-webrtc-enter-room",v="application/vinteo.webrtc.sharedesktop",ln="application/vinteo.webrtc.roomname",dn="application/vinteo.webrtc.channels",hn="application/vinteo.webrtc.mediastate",Sn="application/vinteo.webrtc.refusal",Le="application/vinteo.webrtc.maincam",Tn="application/vinteo.webrtc.mic",un="application/vinteo.webrtc.uselic",Cn="X-WEBRTC-USE-LICENSE",Nn="X-WEBRTC-PARTICIPANT-NAME",He="X-WEBRTC-INPUT-CHANNELS",We="X-WEBRTC-OUTPUT-CHANNELS",gn="X-WEBRTC-MAINCAM",An="X-WEBRTC-MIC",qe="X-WEBRTC-SYNC",Rn="X-WEBRTC-MAINCAM-RESOLUTION",In="X-WEBRTC-MEDIA-STATE",fn="X-Vinteo-Media-Type",Pn="X-Vinteo-MainCam-State",On="X-Vinteo-Mic-State",mn="application/vinteo.webrtc.partstate",Dn="X-WEBRTC-PARTSTATE",Mn="application/vinteo.webrtc.notify",pn="X-VINTEO-NOTIFY",P="x-webrtc-share-state",vn=`${P}: LETMESTARTPRESENTATION`,yn=`${P}: STOPPRESENTATION`,Pt="YOUCANRECEIVECONTENT",Ot="CONTENTEND",mt="YOUMUSTSTOPSENDCONTENT",bn=`${P}: ${mt}`,wn=`${P}: ${Pt}`,Un=`${P}: ${Ot}`,Ln="X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE",Hn=`${Ln}: LETMESTARTMAINCAM`,Wn=(s,e)=>{s.getVideoTracks().forEach(n=>{"contentHint"in n&&n.contentHint!==e&&(n.contentHint=e)})},y=(s,{directionVideo:e,directionAudio:t,contentHint:n}={})=>{if(!s||e==="recvonly"&&t==="recvonly")return;const i=t==="recvonly"?[]:s.getAudioTracks(),o=e==="recvonly"?[]:s.getVideoTracks(),a=[...i,...o],c=new MediaStream(a);return c.getTracks=()=>[...c.getAudioTracks(),...c.getVideoTracks()],n&&n!=="none"&&Wn(c,n),c};function qn(s){return e=>`sip:${e}@${s}`}const kn=(s,e)=>()=>Math.floor(Math.random()*(e-s))+s,ke=s=>s.trim().replaceAll(" ","_"),Bn=kn(1e5,99999999),Fn=s=>s.some(t=>{const{kind:n}=t;return n==="video"}),xn="Error decline with 603",Vn=1006,Yn=s=>typeof s=="object"&&s!==null&&"code"in s&&s.code===Vn,$n=s=>s.message===xn,Gn=(s,e)=>s.find(t=>t.track&&e.getTracks().includes(t.track)),Jn=async(s,e,t)=>{const n=Gn(s,e);if(n)return ft(n,{maxBitrate:t})},Xn=486,Qn=487,zn=3,jn=1,Kn=s=>s instanceof Object&&("originator"in s||"cause"in s),Zn=s=>{if(N.isCanceledError(s))return!0;if(!Kn(s))return!1;const{originator:e,cause:t}=s;return typeof t=="string"?t===Be||t===Q||e===R.LOCAL&&(t===Ve||t===xe):!1},es=s=>J.hasCanceledError(s),A="SipConnector",ts="channels",ns="WebcastStarted",ss="WebcastStopped",is="accountChanged",rs="accountDeleted",os="addedToListModerators",as="removedFromListModerators",cs="ParticipationRequestAccepted",Es="ParticipationRequestRejected",_s="ParticipantMovedToWebcast",ls="ConferenceParticipantTokenIssued";class ds{constructor({JsSIP:e}){r(this,"_isRegisterConfig",!1);r(this,"_connectionConfiguration",{});r(this,"_remoteStreams",{});r(this,"JsSIP");r(this,"_sessionEvents");r(this,"_uaEvents");r(this,"_cancelableConnect");r(this,"_cancelableConnectWithRepeatedCalls");r(this,"_cancelableSendPresentationWithRepeatedCalls");r(this,"_cancelableInitUa");r(this,"_cancelableDisconnect");r(this,"_cancelableSet");r(this,"_cancelableCall");r(this,"_cancelableAnswer");r(this,"_cancelableSendDTMF");r(this,"getSipServerUrl",e=>e);r(this,"promisePendingStartPresentation");r(this,"promisePendingStopPresentation");r(this,"ua");r(this,"rtcSession");r(this,"incomingRTCSession");r(this,"_streamPresentationCurrent");r(this,"socket");r(this,"connect",async(e,t)=>(this._cancelRequests(),this._connectWithDuplicatedCalls(e,t)));r(this,"initUa",async e=>this._cancelableInitUa.request(e));r(this,"set",async e=>this._cancelableSet.request(e));r(this,"call",async e=>this._cancelableCall.request(e));r(this,"disconnect",async()=>(this._cancelRequests(),this._disconnectWithoutCancelRequests()));r(this,"answerToIncomingCall",async e=>this._cancelableAnswer.request(e));r(this,"sendDTMF",async e=>this._cancelableSendDTMF.request(e));r(this,"hangUp",async()=>(this._cancelRequests(),this._hangUpWithoutCancelRequests()));r(this,"tryRegister",async()=>{if(!this.isRegisterConfig)throw new Error("Config is not registered");this._uaEvents.trigger(x,void 0);try{await this.unregister()}catch(e){b("tryRegister",e)}return this.register()});r(this,"declineToIncomingCall",async({statusCode:e=Qn}={})=>new Promise((t,n)=>{if(!this.isAvailableIncomingCall){n(new Error("no incomingRTCSession"));return}const i=this.incomingRTCSession,o=this.remoteCallerData;this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this.removeIncomingSession(),this._uaEvents.trigger(j,o),t(i.terminate({status_code:e}))}));r(this,"busyIncomingCall",async()=>this.declineToIncomingCall({statusCode:Xn}));r(this,"removeIncomingSession",()=>{delete this.incomingRTCSession});r(this,"_connectWithDuplicatedCalls",async(e,{callLimit:t=zn}={})=>{const n=async()=>this._cancelableConnect.request(e),i=o=>{var _;const c=!!((_=this.ua)!=null&&_.isConnected())&&this.hasEqualConnectionConfiguration(e),E=!!o&&!Yn(o);return c||E};return this._cancelableConnectWithRepeatedCalls=J.repeatedCallsAsync({targetFunction:n,isComplete:i,callLimit:t,isRejectAsValid:!0,isCheckBeforeCall:!1,onAfterCancel:()=>{this._cancelableConnect.cancelRequest()}}),this._cancelableConnectWithRepeatedCalls.then(o=>{if(o instanceof this.JsSIP.UA)return o;throw o})});r(this,"handleNewRTCSession",({originator:e,session:t})=>{if(e===R.REMOTE){this.incomingRTCSession=t;const n=this.remoteCallerData;t.on(I,i=>{this.removeIncomingSession(),i.originator===R.LOCAL?this._uaEvents.trigger(Z,n):this._uaEvents.trigger(K,n)}),this._uaEvents.trigger(z,n)}});r(this,"_connect",async e=>this.initUa(e).then(async()=>this._start()));r(this,"_initUa",async({user:e,password:t,sipServerUrl:n,sipWebSocketServerURL:i,remoteAddress:o,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:E,connectionRecoveryMaxInterval:_,userAgent:h,displayName:S="",register:l=!1,extraHeaders:T=[]})=>{if(!n)throw new Error("sipServerUrl is required");if(!i)throw new Error("sipWebSocketServerURL is required");if(l&&!e)throw new Error("user is required for authorized connection");if(l&&!t)throw new Error("password is required for authorized connection");this._connectionConfiguration={sipServerUrl:n,displayName:S,register:l,user:e,password:t};const{configuration:d,helpers:u}=this.createUaConfiguration({user:e,sipServerUrl:n,sipWebSocketServerURL:i,password:t,displayName:S,register:l,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:E,connectionRecoveryMaxInterval:_,userAgent:h});return this.getSipServerUrl=u.getSipServerUrl,this.socket=u.socket,this.ua&&await this._disconnectWithoutCancelRequests(),this._isRegisterConfig=!!l,this.ua=this._createUa({...d,remoteAddress:o,extraHeaders:T}),this._uaEvents.eachTriggers((g,$)=>{const O=pe.find(G=>G===$);O&&this.ua&&this.ua.on(O,g)}),this.ua});r(this,"_createUa",({remoteAddress:e,extraHeaders:t=[],...n})=>{const i=new this.JsSIP.UA(n),a=[...e?cn(e):[],...t];return a.length>0&&i.registrator().setExtraHeaders(a),i});r(this,"_start",async()=>new Promise((e,t)=>{const{ua:n}=this;if(!n){t(new Error("this.ua is not initialized"));return}const i=()=>{c(),e(n)},o=E=>{c(),t(E)},a=()=>{this.isRegisterConfig?(this.on(D,i),this.on(M,o)):this.on(m,i),this.on(C,o)},c=()=>{this.off(D,i),this.off(M,o),this.off(m,i),this.off(C,o)};a(),this.on(w,this.handleNewRTCSession),n.start()}));r(this,"_set",async({displayName:e,password:t})=>new Promise((n,i)=>{const{ua:o}=this;if(!o){i(new Error("this.ua is not initialized"));return}let a=!1,c=!1;e!==void 0&&e!==this._connectionConfiguration.displayName&&(a=o.set("display_name",ke(e)),this._connectionConfiguration.displayName=e),t!==void 0&&t!==this._connectionConfiguration.password&&(c=o.set("password",t),this._connectionConfiguration.password=t);const E=a||c;c&&this.isRegisterConfig?this.register().then(()=>{n(E)}).catch(_=>{i(_)}):E?n(E):i(new Error("nothing changed"))}));r(this,"_disconnectWithoutCancelRequests",async()=>this._cancelableDisconnect.request());r(this,"_disconnect",async()=>{this.off(w,this.handleNewRTCSession);const e=new Promise(t=>{this.once(C,()=>{delete this.ua,t()})});return this.ua?(await this._hangUpWithoutCancelRequests(),this.ua?this.ua.stop():this._uaEvents.trigger(C,void 0)):this._uaEvents.trigger(C,void 0),e});r(this,"_call",async({number:e,mediaStream:t,extraHeaders:n=[],ontrack:i,iceServers:o,directionVideo:a,directionAudio:c,contentHint:E,offerToReceiveAudio:_=!0,offerToReceiveVideo:h=!0,sendEncodings:S,onAddedTransceiver:l})=>new Promise((T,d)=>{const{ua:u}=this;if(!u){d(new Error("this.ua is not initialized"));return}this._connectionConfiguration.number=e,this._connectionConfiguration.answer=!1,this._handleCall({ontrack:i}).then(T).catch(g=>{d(g)}),this.rtcSession=u.call(this.getSipServerUrl(e),{extraHeaders:n,mediaStream:y(t,{directionVideo:a,directionAudio:c,contentHint:E}),eventHandlers:this._sessionEvents.triggers,directionVideo:a,directionAudio:c,pcConfig:{iceServers:o},rtcOfferConstraints:{offerToReceiveAudio:_,offerToReceiveVideo:h},sendEncodings:S,onAddedTransceiver:l})}));r(this,"_answer",async({mediaStream:e,ontrack:t,extraHeaders:n=[],iceServers:i,directionVideo:o,directionAudio:a,offerToReceiveAudio:c,offerToReceiveVideo:E,contentHint:_,sendEncodings:h,onAddedTransceiver:S})=>new Promise((l,T)=>{if(!this.isAvailableIncomingCall){T(new Error("no incomingRTCSession"));return}this.rtcSession=this.incomingRTCSession,this.removeIncomingSession();const{rtcSession:d}=this;if(!d){T(new Error("No rtcSession established"));return}this._sessionEvents.eachTriggers((g,$)=>{const O=ve.find(G=>G===$);O&&d.on(O,g)}),this._connectionConfiguration.answer=!0,this._connectionConfiguration.number=d.remote_identity.uri.user,this._handleCall({ontrack:t}).then(l).catch(g=>{T(g)});const u=y(e,{directionVideo:o,directionAudio:a,contentHint:_});d.answer({extraHeaders:n,directionVideo:o,directionAudio:a,mediaStream:u,pcConfig:{iceServers:i},rtcOfferConstraints:{offerToReceiveAudio:c,offerToReceiveVideo:E},sendEncodings:h,onAddedTransceiver:S})}));r(this,"_handleCall",async({ontrack:e})=>new Promise((t,n)=>{const i=()=>{this.onSession(q,h),this.onSession(W,S)},o=()=>{this.offSession(q,h),this.offSession(W,S)},a=()=>{this.onSession(I,E),this.onSession(p,E)},c=()=>{this.offSession(I,E),this.offSession(p,E)},E=l=>{o(),c(),n(l)};let _;const h=({peerconnection:l})=>{_=l,_.ontrack=T=>{this._sessionEvents.trigger(ce,_),e&&e(T)}},S=()=>{_&&this._sessionEvents.trigger(ae,_),o(),c(),t(_)};i(),a()}));r(this,"_restoreSession",()=>{this._cancelRequestsAndResetPresentation(),delete this._connectionConfiguration.number,delete this.rtcSession,this._remoteStreams={}});r(this,"_sendDTMF",async e=>new Promise((t,n)=>{const{rtcSession:i}=this;if(!i){n(new Error("No rtcSession established"));return}this.onceSession(me,({originator:o})=>{o===R.LOCAL&&t()}),i.sendDTMF(e,{duration:120,interToneGap:600})}));r(this,"_hangUpWithoutCancelRequests",async()=>{if(this.ua&&this.rtcSession){const{rtcSession:e}=this;if(this._streamPresentationCurrent)try{await this.stopPresentation()}catch(t){b("error stop presentation: ",t)}if(this._restoreSession(),!e.isEnded())return e.terminateAsync()}});r(this,"_handleShareState",e=>{switch(e){case Pt:{this._sessionEvents.trigger(ne,void 0);break}case Ot:{this._sessionEvents.trigger(se,void 0);break}case mt:{this._sessionEvents.trigger(ie,void 0);break}}});r(this,"_maybeTriggerChannels",e=>{const t=e.getHeader(He),n=e.getHeader(We);if(t&&n){const i={inputChannels:t,outputChannels:n};this._sessionEvents.trigger(L,i)}});r(this,"_handleNotify",e=>{switch(e.cmd){case ts:{const t=e;this._triggerChannelsNotify(t);break}case ns:{const t=e;this._triggerWebcastStartedNotify(t);break}case ss:{const t=e;this._triggerWebcastStoppedNotify(t);break}case os:{const t=e;this._triggerAddedToListModeratorsNotify(t);break}case as:{const t=e;this._triggerRemovedFromListModeratorsNotify(t);break}case cs:{const t=e;this._triggerParticipationAcceptingWordRequest(t);break}case Es:{const t=e;this._triggerParticipationCancellingWordRequest(t);break}case _s:{const t=e;this._triggerParticipantMoveRequestToStream(t);break}case is:{this._triggerAccountChangedNotify();break}case rs:{this._triggerAccountDeletedNotify();break}case ls:{const t=e;this._triggerConferenceParticipantTokenIssued(t);break}default:b("unknown cmd",e.cmd)}});r(this,"_triggerRemovedFromListModeratorsNotify",({conference:e})=>{const t={conference:e};this._uaEvents.trigger(Ce,t)});r(this,"_triggerAddedToListModeratorsNotify",({conference:e})=>{const t={conference:e};this._uaEvents.trigger(ue,t)});r(this,"_triggerWebcastStartedNotify",({body:{conference:e,type:t}})=>{const n={conference:e,type:t};this._uaEvents.trigger(Re,n)});r(this,"_triggerWebcastStoppedNotify",({body:{conference:e,type:t}})=>{const n={conference:e,type:t};this._uaEvents.trigger(Ie,n)});r(this,"_triggerAccountChangedNotify",()=>{this._uaEvents.trigger(fe,void 0)});r(this,"_triggerAccountDeletedNotify",()=>{this._uaEvents.trigger(Pe,void 0)});r(this,"_triggerConferenceParticipantTokenIssued",({body:{conference:e,participant:t,jwt:n}})=>{const i={conference:e,participant:t,jwt:n};this._uaEvents.trigger(Oe,i)});r(this,"_triggerChannelsNotify",e=>{const t=e.input,n=e.output,i={inputChannels:t,outputChannels:n};this._uaEvents.trigger(Ee,i)});r(this,"_triggerParticipationAcceptingWordRequest",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(ge,t)});r(this,"_triggerParticipationCancellingWordRequest",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(Ae,t)});r(this,"_triggerParticipantMoveRequestToStream",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(Ne,t)});r(this,"_triggerEnterRoom",e=>{const t=e.getHeader(_n),n=e.getHeader(Nn);this._sessionEvents.trigger(re,{room:t,participantName:n})});r(this,"_triggerShareState",e=>{const t=e.getHeader(P);this._sessionEvents.trigger(U,t)});r(this,"_maybeTriggerParticipantMoveRequest",e=>{const t=e.getHeader(Dn);t===ht&&this._sessionEvents.trigger(V,void 0),t===St&&this._sessionEvents.trigger(Y,void 0)});r(this,"_triggerMainCamControl",e=>{const t=e.getHeader(gn),n=e.getHeader(qe),i=n===F.ADMIN_SYNC_FORCED;if(t===f.ADMIN_START_MAIN_CAM){this._sessionEvents.trigger(he,{isSyncForced:i});return}if(t===f.ADMIN_STOP_MAIN_CAM){this._sessionEvents.trigger(de,{isSyncForced:i});return}(t===f.RESUME_MAIN_CAM||t===f.PAUSE_MAIN_CAM)&&n&&this._sessionEvents.trigger(H,{isSyncForced:i});const o=e.getHeader(Rn);this._sessionEvents.trigger(le,{mainCam:t,resolutionMainCam:o})});r(this,"_triggerMicControl",e=>{const t=e.getHeader(An),i=e.getHeader(qe)===F.ADMIN_SYNC_FORCED;t===B.ADMIN_START_MIC?this._sessionEvents.trigger(Te,{isSyncForced:i}):t===B.ADMIN_STOP_MIC&&this._sessionEvents.trigger(Se,{isSyncForced:i})});r(this,"_triggerUseLicense",e=>{const t=e.getHeader(Cn);this._sessionEvents.trigger(oe,t)});r(this,"_handleNewInfo",e=>{const{originator:t}=e;if(t!=="remote")return;const{request:n}=e,i=n.getHeader(En);if(i)switch(i){case ln:{this._triggerEnterRoom(n),this._maybeTriggerChannels(n);break}case Mn:{this._maybeHandleNotify(n);break}case v:{this._triggerShareState(n);break}case Le:{this._triggerMainCamControl(n);break}case Tn:{this._triggerMicControl(n);break}case un:{this._triggerUseLicense(n);break}case mn:{this._maybeTriggerParticipantMoveRequest(n);break}}});r(this,"_handleSipEvent",({request:e})=>{this._maybeHandleNotify(e)});r(this,"_maybeHandleNotify",e=>{const t=e.getHeader(pn);if(t){const n=JSON.parse(t);this._handleNotify(n)}});r(this,"_handleEnded",e=>{const{originator:t}=e;t===R.REMOTE&&this._sessionEvents.trigger(_e,e),this._restoreSession()});this.JsSIP=e,this._sessionEvents=new Ue(be),this._uaEvents=new Ue(ye),this._cancelableConnect=new N.CancelableRequest(this._connect,{moduleName:A,afterCancelRequest:()=>{this._cancelableInitUa.cancelRequest(),this._cancelableDisconnect.cancelRequest()}}),this._cancelableInitUa=new N.CancelableRequest(this._initUa,{moduleName:A}),this._cancelableDisconnect=new N.CancelableRequest(this._disconnect,{moduleName:A}),this._cancelableSet=new N.CancelableRequest(this._set,{moduleName:A}),this._cancelableCall=new N.CancelableRequest(this._call,{moduleName:A}),this._cancelableAnswer=new N.CancelableRequest(this._answer,{moduleName:A}),this._cancelableSendDTMF=new N.CancelableRequest(this._sendDTMF,{moduleName:A}),this.onSession(U,this._handleShareState),this.onSession(De,this._handleNewInfo),this.on(te,this._handleSipEvent),this.onSession(I,this._handleEnded),this.onSession(p,this._handleEnded)}async register(){return new Promise((e,t)=>{this.isRegisterConfig&&this.ua?(this.ua.on(D,e),this.ua.on(M,t),this.ua.register()):t(new Error("Config is not registered"))})}async unregister(){return new Promise((e,t)=>{this.isRegistered&&this.ua?(this.ua.on(ee,e),this.ua.unregister()):t(new Error("ua is not registered"))})}async sendOptions(e,t,n){if(!this.ua)throw new Error("is not connected");return new Promise((i,o)=>{try{this.ua.sendOptions(e,t,{extraHeaders:n,eventHandlers:{succeeded:()=>{i()},failed:o}})}catch(a){o(a)}})}async ping(e,t){var i;if(!((i=this.ua)!=null&&i.configuration.uri))throw new Error("is not connected");const n=this.ua.configuration.uri;return this.sendOptions(n,e,t)}async checkTelephony({userAgent:e,displayName:t,sipServerUrl:n,sipWebSocketServerURL:i,remoteAddress:o,extraHeaders:a}){return new Promise((c,E)=>{const{configuration:_}=this.createUaConfiguration({sipWebSocketServerURL:i,displayName:t,userAgent:e,sipServerUrl:n}),h=this._createUa({..._,remoteAddress:o,extraHeaders:a}),S=()=>{const T=new Error("Telephony is not available");E(T)};h.once(C,S);const l=()=>{h.removeAllListeners(),h.once(C,c),h.stop()};h.once(m,l),h.start()})}async replaceMediaStream(e,t){if(!this.rtcSession)throw new Error("No rtcSession established");const{contentHint:n}=t??{},i=y(e,{contentHint:n});return this.rtcSession.replaceMediaStream(i,t)}async askPermissionToEnableCam(e={}){if(!this.rtcSession)throw new Error("No rtcSession established");const t=[Hn];return this.rtcSession.sendInfo(Le,void 0,{noTerminateWhenError:!0,...e,extraHeaders:t}).catch(n=>{if($n(n))throw n})}get isPendingPresentation(){return!!this.promisePendingStartPresentation||!!this.promisePendingStopPresentation}async _sendPresentationWithDuplicatedCalls({rtcSession:e,stream:t,presentationOptions:n,options:i={callLimit:jn}}){const o=async()=>this._sendPresentation(e,t,n),a=()=>!!this._streamPresentationCurrent;return this._cancelableSendPresentationWithRepeatedCalls=J.repeatedCallsAsync({targetFunction:o,isComplete:a,isRejectAsValid:!0,...i}),this._cancelableSendPresentationWithRepeatedCalls.then(c=>c)}hasEqualConnectionConfiguration(e){var i;const{configuration:t}=this.createUaConfiguration(e),n=(i=this.ua)==null?void 0:i.configuration;return(n==null?void 0:n.password)===t.password&&(n==null?void 0:n.register)===t.register&&(n==null?void 0:n.uri.toString())===t.uri&&(n==null?void 0:n.display_name)===t.display_name&&(n==null?void 0:n.user_agent)===t.user_agent&&(n==null?void 0:n.sockets)===t.sockets&&(n==null?void 0:n.session_timers)===t.session_timers&&(n==null?void 0:n.register_expires)===t.register_expires&&(n==null?void 0:n.connection_recovery_min_interval)===t.connection_recovery_min_interval&&(n==null?void 0:n.connection_recovery_max_interval)===t.connection_recovery_max_interval}createUaConfiguration({user:e,password:t,sipWebSocketServerURL:n,displayName:i="",sipServerUrl:o,register:a=!1,sessionTimers:c=!1,registerExpires:E=60*5,connectionRecoveryMinInterval:_=2,connectionRecoveryMaxInterval:h=6,userAgent:S}){if(a&&!t)throw new Error("password is required for authorized connection");const l=a&&e?e.trim():`${Bn()}`,T=qn(o),d=T(l),u=new this.JsSIP.WebSocketInterface(n);return{configuration:{password:t,register:a,uri:d,display_name:ke(i),user_agent:S,sdp_semantics:"unified-plan",sockets:[u],session_timers:c,register_expires:E,connection_recovery_min_interval:_,connection_recovery_max_interval:h},helpers:{socket:u,getSipServerUrl:T}}}async _sendPresentation(e,t,{maxBitrate:n=Tt,isNeedReinvite:i=!0,isP2P:o=!1,contentHint:a="detail",sendEncodings:c,onAddedTransceiver:E}){const _=y(t,{contentHint:a});this._streamPresentationCurrent=_;const h=o?[wn]:[vn],S=e.sendInfo(v,void 0,{extraHeaders:h}).then(async()=>e.startPresentation(_,i,{sendEncodings:c,onAddedTransceiver:E})).then(async()=>{const{connection:l}=this;if(!l||n===void 0)return;const T=l.getSenders();await Jn(T,t,n)}).then(()=>t).catch(l=>{throw this._removeStreamPresentationCurrent(),this._sessionEvents.trigger(k,l),l});return this.promisePendingStartPresentation=S,S.finally(()=>{this.promisePendingStartPresentation=void 0})}async startPresentation(e,{isNeedReinvite:t,isP2P:n,maxBitrate:i,contentHint:o,sendEncodings:a,onAddedTransceiver:c}={},E){const _=this.establishedRTCSession;if(!_)throw new Error("No rtcSession established");if(this._streamPresentationCurrent)throw new Error("Presentation is already started");return n&&await this.sendMustStopPresentation(_),this._sendPresentationWithDuplicatedCalls({rtcSession:_,stream:e,presentationOptions:{isNeedReinvite:t,isP2P:n,maxBitrate:i,contentHint:o,sendEncodings:a,onAddedTransceiver:c},options:E})}async sendMustStopPresentation(e){await e.sendInfo(v,void 0,{extraHeaders:[bn]})}async stopPresentation({isP2P:e=!1}={}){this._cancelSendPresentationWithRepeatedCalls();const t=this._streamPresentationCurrent;let n=this.promisePendingStartPresentation??Promise.resolve();const i=e?[Un]:[yn],o=this.establishedRTCSession;return o&&t&&(n=n.then(async()=>o.sendInfo(v,void 0,{extraHeaders:i})).then(async()=>o.stopPresentation(t)).catch(a=>{throw this._sessionEvents.trigger(k,a),a})),!o&&t&&this._sessionEvents.trigger(Me,t),this.promisePendingStopPresentation=n,n.finally(()=>{this._resetPresentation()})}async updatePresentation(e,{isP2P:t,maxBitrate:n,contentHint:i,sendEncodings:o,onAddedTransceiver:a}={}){const c=this.establishedRTCSession;if(!c)throw new Error("No rtcSession established");if(!this._streamPresentationCurrent)throw new Error("Presentation has not started yet");return this.promisePendingStartPresentation&&await this.promisePendingStartPresentation,this._sendPresentation(c,e,{isP2P:t,maxBitrate:n,contentHint:i,isNeedReinvite:!1,sendEncodings:o,onAddedTransceiver:a})}_removeStreamPresentationCurrent(){delete this._streamPresentationCurrent}_resetPresentation(){this._removeStreamPresentationCurrent(),this.promisePendingStartPresentation=void 0,this.promisePendingStopPresentation=void 0}_cancelRequestsAndResetPresentation(){this._cancelSendPresentationWithRepeatedCalls(),this._resetPresentation()}on(e,t){return this._uaEvents.on(e,t)}once(e,t){return this._uaEvents.once(e,t)}onceRace(e,t){return this._uaEvents.onceRace(e,t)}async wait(e){return this._uaEvents.wait(e)}off(e,t){this._uaEvents.off(e,t)}onSession(e,t){return this._sessionEvents.on(e,t)}onceSession(e,t){return this._sessionEvents.once(e,t)}onceRaceSession(e,t){return this._sessionEvents.onceRace(e,t)}async waitSession(e){return this._sessionEvents.wait(e)}offSession(e,t){this._sessionEvents.off(e,t)}isConfigured(){return!!this.ua}getConnectionConfiguration(){return{...this._connectionConfiguration}}getRemoteStreams(){if(!this.connection)return;const t=this.connection.getReceivers().map(({track:n})=>n);return Fn(t)?this._generateStreams(t):this._generateAudioStreams(t)}get connection(){var t;return(t=this.rtcSession)==null?void 0:t.connection}get remoteCallerData(){var e,t,n,i,o,a;return{displayName:(t=(e=this.incomingRTCSession)==null?void 0:e.remote_identity)==null?void 0:t.display_name,host:(i=(n=this.incomingRTCSession)==null?void 0:n.remote_identity)==null?void 0:i.uri.host,incomingNumber:(a=(o=this.incomingRTCSession)==null?void 0:o.remote_identity)==null?void 0:a.uri.user,rtcSession:this.incomingRTCSession}}get requested(){return this._cancelableConnect.requested||this._cancelableInitUa.requested||this._cancelableCall.requested||this._cancelableAnswer.requested}get establishedRTCSession(){var e;return(e=this.rtcSession)!=null&&e.isEstablished()?this.rtcSession:void 0}get isRegistered(){return!!this.ua&&this.ua.isRegistered()}get isRegisterConfig(){return!!this.ua&&this._isRegisterConfig}get isCallActive(){return!!(this.ua&&this.rtcSession)}get isAvailableIncomingCall(){return!!this.incomingRTCSession}_generateStream(e,t){const{id:n}=e,i=this._remoteStreams[n]||new MediaStream;return t&&i.addTrack(t),i.addTrack(e),this._remoteStreams[n]=i,i}_generateAudioStream(e){const{id:t}=e,n=this._remoteStreams[t]||new MediaStream;return n.addTrack(e),this._remoteStreams[t]=n,n}_generateStreams(e){const t=[];return e.forEach((n,i)=>{if(n.kind==="audio")return;const o=n,a=e[i-1];let c;a&&a.kind==="audio"&&(c=a);const E=this._generateStream(o,c);t.push(E)}),t}_generateAudioStreams(e){return e.map(n=>this._generateAudioStream(n))}_cancelRequests(){this._cancelActionsRequests(),this._cancelCallRequests(),this._cancelConnectWithRepeatedCalls()}_cancelConnectWithRepeatedCalls(){var e;(e=this._cancelableConnectWithRepeatedCalls)==null||e.cancel()}_cancelSendPresentationWithRepeatedCalls(){var e;(e=this._cancelableSendPresentationWithRepeatedCalls)==null||e.cancel()}_cancelCallRequests(){this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest()}_cancelActionsRequests(){this._cancelableAnswer.cancelRequest(),this._cancelableSendDTMF.cancelRequest()}async waitChannels(){return this.waitSession(L)}async waitSyncMediaState(){return this.waitSession(H)}async sendChannels({inputChannels:e,outputChannels:t}){if(!this.rtcSession)throw new Error("No rtcSession established");const n=`${He}: ${e}`,i=`${We}: ${t}`,o=[n,i];return this.rtcSession.sendInfo(dn,void 0,{extraHeaders:o})}async sendMediaState({cam:e,mic:t},n={}){if(!this.rtcSession)throw new Error("No rtcSession established");const i=`${In}: currentstate`,o=`${Pn}: ${Number(e)}`,a=`${On}: ${Number(t)}`,c=[i,o,a];return this.rtcSession.sendInfo(hn,void 0,{noTerminateWhenError:!0,...n,extraHeaders:c})}async _sendRefusalToTurnOn(e,t={}){if(!this.rtcSession)throw new Error("No rtcSession established");const c=[`${fn}: ${e==="mic"?0:1}`];return this.rtcSession.sendInfo(Sn,void 0,{noTerminateWhenError:!0,...t,extraHeaders:c})}async sendRefusalToTurnOnMic(e={}){if(!this.rtcSession)throw new Error("No rtcSession established");return this._sendRefusalToTurnOn("mic",{noTerminateWhenError:!0,...e})}async sendRefusalToTurnOnCam(e={}){if(!this.rtcSession)throw new Error("No rtcSession established");return this._sendRefusalToTurnOn("cam",{noTerminateWhenError:!0,...e})}}exports.BAD_MEDIA_DESCRIPTION=Ye;exports.EEventsMainCAM=f;exports.EEventsMic=B;exports.EEventsSyncMediaState=F;exports.EMimeTypesVideoCodecs=It;exports.EUseLicense=Rt;exports.NOT_FOUND=Fe;exports.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS=Y;exports.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS=V;exports.REJECTED=Q;exports.SESSION_EVENT_NAMES=be;exports.SipConnector=ds;exports.UA_EVENT_NAMES=ye;exports.causes=Gt;exports.constants=Jt;exports.disableDebug=zt;exports.enableDebug=Qt;exports.eventNames=Xt;exports.hasCanceledCallError=Zn;exports.hasCanceledStartPresentationError=es;exports.logger=b;exports.setEncodingsToSender=ft;exports.setParametersToSender=At;
|
|
@@ -2,6 +2,7 @@ import { IncomingInfoEvent, IncomingRTCSessionEvent, IncomingRequest, OutgoingIn
|
|
|
2
2
|
import { TEventSession, TEventUA } from './eventNames';
|
|
3
3
|
import { TContentHint, TCustomError, TJsSIP, TOnAddedTransceiver } from './types';
|
|
4
4
|
export declare const hasCanceledCallError: (error: unknown) => boolean;
|
|
5
|
+
export declare const hasCanceledStartPresentationError: (error: unknown) => error is import('repeated-calls/utils').TCanceledError<unknown>;
|
|
5
6
|
type TChannels = {
|
|
6
7
|
inputChannels: string;
|
|
7
8
|
outputChannels: string;
|
|
@@ -127,34 +128,44 @@ type TParametersCall = TParametersAnswerToIncomingCall & {
|
|
|
127
128
|
number: string;
|
|
128
129
|
};
|
|
129
130
|
type TCall = (parameters: TParametersCall) => Promise<RTCPeerConnection>;
|
|
131
|
+
type TDisconnect = () => Promise<void>;
|
|
130
132
|
type TAnswerToIncomingCall = (parameters: TParametersAnswerToIncomingCall) => Promise<RTCPeerConnection>;
|
|
131
133
|
type TSendDTMF = (tone: number | string) => Promise<void>;
|
|
132
134
|
type THangUp = () => Promise<void>;
|
|
133
135
|
export default class SipConnector {
|
|
134
|
-
private
|
|
135
|
-
private
|
|
136
|
-
private
|
|
136
|
+
private _isRegisterConfig;
|
|
137
|
+
private _connectionConfiguration;
|
|
138
|
+
private _remoteStreams;
|
|
137
139
|
private readonly JsSIP;
|
|
138
|
-
private readonly
|
|
139
|
-
private readonly
|
|
140
|
+
private readonly _sessionEvents;
|
|
141
|
+
private readonly _uaEvents;
|
|
142
|
+
private readonly _cancelableConnect;
|
|
143
|
+
private _cancelableConnectWithRepeatedCalls;
|
|
144
|
+
private _cancelableSendPresentationWithRepeatedCalls;
|
|
145
|
+
private readonly _cancelableInitUa;
|
|
146
|
+
private readonly _cancelableDisconnect;
|
|
147
|
+
private readonly _cancelableSet;
|
|
148
|
+
private readonly _cancelableCall;
|
|
149
|
+
private readonly _cancelableAnswer;
|
|
150
|
+
private readonly _cancelableSendDTMF;
|
|
140
151
|
private getSipServerUrl;
|
|
141
|
-
private cancelableConnectWithRepeatedCalls;
|
|
142
|
-
private cancelableSendPresentationWithRepeatedCalls;
|
|
143
|
-
private isPendingConnect;
|
|
144
|
-
private isPendingInitUa;
|
|
145
|
-
private isPendingCall;
|
|
146
|
-
private isPendingAnswer;
|
|
147
152
|
promisePendingStartPresentation?: Promise<MediaStream>;
|
|
148
153
|
promisePendingStopPresentation?: Promise<MediaStream | void>;
|
|
149
154
|
ua?: UA;
|
|
150
155
|
rtcSession?: RTCSession;
|
|
151
156
|
incomingRTCSession?: RTCSession;
|
|
152
|
-
|
|
157
|
+
_streamPresentationCurrent?: MediaStream;
|
|
153
158
|
socket?: WebSocketInterface;
|
|
154
159
|
constructor({ JsSIP }: {
|
|
155
160
|
JsSIP: TJsSIP;
|
|
156
161
|
});
|
|
157
162
|
connect: TConnect;
|
|
163
|
+
initUa: TInitUa;
|
|
164
|
+
set: TSet;
|
|
165
|
+
call: TCall;
|
|
166
|
+
disconnect: TDisconnect;
|
|
167
|
+
answerToIncomingCall: TAnswerToIncomingCall;
|
|
168
|
+
sendDTMF: TSendDTMF;
|
|
158
169
|
hangUp: THangUp;
|
|
159
170
|
register(): Promise<RegisteredEvent>;
|
|
160
171
|
unregister(): Promise<UnRegisteredEvent>;
|
|
@@ -177,11 +188,11 @@ export default class SipConnector {
|
|
|
177
188
|
removeIncomingSession: () => void;
|
|
178
189
|
askPermissionToEnableCam(options?: TOptionsInfoMediaState): Promise<void>;
|
|
179
190
|
get isPendingPresentation(): boolean;
|
|
180
|
-
private readonly
|
|
181
|
-
private
|
|
191
|
+
private readonly _connectWithDuplicatedCalls;
|
|
192
|
+
private _sendPresentationWithDuplicatedCalls;
|
|
182
193
|
private hasEqualConnectionConfiguration;
|
|
183
194
|
private createUaConfiguration;
|
|
184
|
-
private
|
|
195
|
+
private _sendPresentation;
|
|
185
196
|
startPresentation(stream: MediaStream, { isNeedReinvite, isP2P, maxBitrate, contentHint, sendEncodings, onAddedTransceiver, }?: {
|
|
186
197
|
isNeedReinvite?: boolean;
|
|
187
198
|
isP2P?: boolean;
|
|
@@ -203,11 +214,11 @@ export default class SipConnector {
|
|
|
203
214
|
sendEncodings?: RTCRtpEncodingParameters[];
|
|
204
215
|
onAddedTransceiver?: TOnAddedTransceiver;
|
|
205
216
|
}): Promise<MediaStream | void>;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
217
|
+
_removeStreamPresentationCurrent(): void;
|
|
218
|
+
_resetPresentation(): void;
|
|
219
|
+
_cancelRequestsAndResetPresentation(): void;
|
|
209
220
|
handleNewRTCSession: ({ originator, session: rtcSession }: IncomingRTCSessionEvent) => void;
|
|
210
|
-
on<T>(eventName: TEventUA, handler: (data: T) => void): () => void;
|
|
221
|
+
on<T = void>(eventName: TEventUA, handler: (data: T) => void): () => void;
|
|
211
222
|
once<T>(eventName: TEventUA, handler: (data: T) => void): () => void;
|
|
212
223
|
onceRace<T>(eventNames: TEventUA[], handler: (data: T, eventName: string) => void): () => void;
|
|
213
224
|
wait<T>(eventName: TEventUA): Promise<T>;
|
|
@@ -241,61 +252,64 @@ export default class SipConnector {
|
|
|
241
252
|
get isRegisterConfig(): boolean;
|
|
242
253
|
get isCallActive(): boolean;
|
|
243
254
|
get isAvailableIncomingCall(): boolean;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
_connect: TConnect;
|
|
256
|
+
_initUa: TInitUa;
|
|
257
|
+
_createUa: TCreateUa;
|
|
258
|
+
_start: TStart;
|
|
259
|
+
_set: TSet;
|
|
260
|
+
_disconnectWithoutCancelRequests: TDisconnect;
|
|
261
|
+
_disconnect: () => Promise<void>;
|
|
262
|
+
_call: TCall;
|
|
263
|
+
_answer: TAnswerToIncomingCall;
|
|
264
|
+
_handleCall: ({ ontrack }: {
|
|
253
265
|
ontrack?: TOntrack;
|
|
254
266
|
}) => Promise<RTCPeerConnection>;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
267
|
+
_restoreSession: () => void;
|
|
268
|
+
_sendDTMF: TSendDTMF;
|
|
269
|
+
_generateStream(videoTrack: MediaStreamTrack, audioTrack?: MediaStreamTrack): MediaStream;
|
|
270
|
+
_generateAudioStream(audioTrack: MediaStreamTrack): MediaStream;
|
|
271
|
+
_generateStreams(remoteTracks: MediaStreamTrack[]): MediaStream[];
|
|
272
|
+
_generateAudioStreams(remoteTracks: MediaStreamTrack[]): MediaStream[];
|
|
273
|
+
_hangUpWithoutCancelRequests: THangUp;
|
|
274
|
+
_cancelRequests(): void;
|
|
275
|
+
_cancelConnectWithRepeatedCalls(): void;
|
|
276
|
+
_cancelSendPresentationWithRepeatedCalls(): void;
|
|
277
|
+
_cancelCallRequests(): void;
|
|
278
|
+
_cancelActionsRequests(): void;
|
|
279
|
+
_handleShareState: (eventName: string) => void;
|
|
280
|
+
_maybeTriggerChannels: (request: IncomingRequest) => void;
|
|
281
|
+
_handleNotify: (header: TInfoNotify) => void;
|
|
282
|
+
_triggerRemovedFromListModeratorsNotify: ({ conference, }: TRemovedFromListModeratorsInfoNotify) => void;
|
|
283
|
+
_triggerAddedToListModeratorsNotify: ({ conference }: TAddedToListModeratorsInfoNotify) => void;
|
|
284
|
+
_triggerWebcastStartedNotify: ({ body: { conference, type } }: TWebcastInfoNotify) => void;
|
|
285
|
+
_triggerWebcastStoppedNotify: ({ body: { conference, type } }: TWebcastInfoNotify) => void;
|
|
286
|
+
_triggerAccountChangedNotify: () => void;
|
|
287
|
+
_triggerAccountDeletedNotify: () => void;
|
|
288
|
+
_triggerConferenceParticipantTokenIssued: ({ body: { conference, participant, jwt }, }: TConferenceParticipantTokenIssued) => void;
|
|
289
|
+
_triggerChannelsNotify: (channelsInfo: TChannelsInfoNotify) => void;
|
|
290
|
+
_triggerParticipationAcceptingWordRequest: ({ body: { conference }, }: TAcceptingWordRequestInfoNotify) => void;
|
|
291
|
+
_triggerParticipationCancellingWordRequest: ({ body: { conference }, }: TCancellingWordRequestInfoNotify) => void;
|
|
292
|
+
_triggerParticipantMoveRequestToStream: ({ body: { conference }, }: TMoveRequestToStreamInfoNotify) => void;
|
|
293
|
+
_triggerEnterRoom: (request: IncomingRequest) => void;
|
|
294
|
+
_triggerShareState: (request: IncomingRequest) => void;
|
|
295
|
+
_maybeTriggerParticipantMoveRequest: (request: IncomingRequest) => void;
|
|
296
|
+
_triggerMainCamControl: (request: IncomingRequest) => void;
|
|
297
|
+
_triggerMicControl: (request: IncomingRequest) => void;
|
|
298
|
+
_triggerUseLicense: (request: IncomingRequest) => void;
|
|
299
|
+
_handleNewInfo: (info: IncomingInfoEvent | OutgoingInfoEvent) => void;
|
|
300
|
+
_handleSipEvent: ({ request }: {
|
|
287
301
|
request: IncomingRequest;
|
|
288
302
|
}) => void;
|
|
289
|
-
|
|
303
|
+
_maybeHandleNotify: (request: IncomingRequest) => void;
|
|
290
304
|
waitChannels(): Promise<TChannels>;
|
|
291
305
|
waitSyncMediaState(): Promise<{
|
|
292
306
|
isSyncForced: boolean;
|
|
293
307
|
}>;
|
|
294
308
|
sendChannels({ inputChannels, outputChannels }: TChannels): Promise<void>;
|
|
295
309
|
sendMediaState({ cam, mic }: TMediaState, options?: TOptionsInfoMediaState): Promise<void>;
|
|
296
|
-
|
|
310
|
+
_sendRefusalToTurnOn(type: 'cam' | 'mic', options?: TOptionsInfoMediaState): Promise<void>;
|
|
297
311
|
sendRefusalToTurnOnMic(options?: TOptionsInfoMediaState): Promise<void>;
|
|
298
312
|
sendRefusalToTurnOnCam(options?: TOptionsInfoMediaState): Promise<void>;
|
|
299
|
-
|
|
313
|
+
_handleEnded: (error: TCustomError) => void;
|
|
300
314
|
}
|
|
301
315
|
export {};
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import { AnswerOptions, ExtraHeaders, HoldOptions, MediaStreamTypes, NameAddrHeader, OnHoldResult, RTCPeerConnectionDeprecated, RTCSession, ReferOptions, RenegotiateOptions, SessionDirection, SessionStatus, TerminateOptions, URI, C as constants } from '@krivega/jssip';
|
|
2
2
|
import { default as Events } from 'events-constructor';
|
|
3
3
|
import { TEventSession, SESSION_EVENT_NAMES } from '../eventNames';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* BaseSession
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
5
8
|
declare class BaseSession implements RTCSession {
|
|
6
9
|
originator: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
_connection: RTCPeerConnectionDeprecated;
|
|
11
|
+
_events: Events<typeof SESSION_EVENT_NAMES>;
|
|
12
|
+
_remote_identity: NameAddrHeader;
|
|
13
|
+
_mutedOptions: {
|
|
11
14
|
audio: boolean;
|
|
12
15
|
video: boolean;
|
|
13
16
|
};
|
|
14
|
-
constructor({ originator, eventHandlers
|
|
15
|
-
originator?: string;
|
|
16
|
-
eventHandlers:
|
|
17
|
+
constructor({ originator, eventHandlers }: {
|
|
18
|
+
originator?: string | undefined;
|
|
19
|
+
eventHandlers: any;
|
|
17
20
|
});
|
|
18
21
|
get C(): SessionStatus;
|
|
19
22
|
get causes(): constants.causes;
|
|
20
23
|
get id(): string;
|
|
21
|
-
set data(_data:
|
|
22
|
-
get data():
|
|
24
|
+
set data(_data: any);
|
|
25
|
+
get data(): any;
|
|
26
|
+
get connection(): RTCPeerConnectionDeprecated;
|
|
23
27
|
get contact(): string;
|
|
24
28
|
get direction(): SessionDirection;
|
|
25
29
|
get local_identity(): NameAddrHeader;
|
|
30
|
+
get remote_identity(): NameAddrHeader;
|
|
26
31
|
get start_time(): Date;
|
|
27
32
|
get end_time(): Date;
|
|
28
33
|
get status(): SessionStatus;
|
|
@@ -45,23 +50,30 @@ declare class BaseSession implements RTCSession {
|
|
|
45
50
|
deleteExisting: boolean;
|
|
46
51
|
addMissing: boolean;
|
|
47
52
|
}): Promise<void>;
|
|
48
|
-
addListener(_event: string | symbol, _listener: (...arguments_:
|
|
49
|
-
once(_event: string | symbol, _listener: (...arguments_:
|
|
50
|
-
removeListener(_event: string | symbol, _listener: (...arguments_:
|
|
51
|
-
off(_event: string | symbol, _listener: (...arguments_:
|
|
53
|
+
addListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
|
|
54
|
+
once(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
|
|
55
|
+
removeListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
|
|
56
|
+
off(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
|
|
52
57
|
removeAllListeners(_event?: string | symbol): this;
|
|
53
58
|
setMaxListeners(_n: number): this;
|
|
54
59
|
getMaxListeners(): number;
|
|
55
60
|
listeners(_event: string | symbol): (() => void)[];
|
|
56
61
|
rawListeners(_event: string | symbol): (() => void)[];
|
|
57
|
-
emit(_event: string | symbol, ..._arguments_:
|
|
62
|
+
emit(_event: string | symbol, ..._arguments_: any[]): boolean;
|
|
58
63
|
listenerCount(_event: string | symbol): number;
|
|
59
|
-
prependListener(_event: string | symbol, _listener: (...arguments_:
|
|
60
|
-
prependOnceListener(_event: string | symbol, _listener: (...arguments_:
|
|
64
|
+
prependListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
|
|
65
|
+
prependOnceListener(_event: string | symbol, _listener: (...arguments_: any[]) => void): this;
|
|
61
66
|
eventNames(): (string | symbol)[];
|
|
62
|
-
|
|
67
|
+
/**
|
|
68
|
+
* initEvents
|
|
69
|
+
*
|
|
70
|
+
* @param {Array} [eventHandlers=[] - ] The event handlers
|
|
71
|
+
*
|
|
72
|
+
* @returns {undefined}
|
|
73
|
+
*/
|
|
74
|
+
initEvents(eventHandlers?: never[]): void;
|
|
63
75
|
on<T>(eventName: string, handler: (data: T) => void): this;
|
|
64
|
-
trigger(eventName: TEventSession, data?:
|
|
76
|
+
trigger(eventName: TEventSession, data?: any): void;
|
|
65
77
|
/**
|
|
66
78
|
* sendDTMF
|
|
67
79
|
*
|
|
@@ -2,8 +2,8 @@ import { RTCPeerConnectionDeprecated } from '@krivega/jssip';
|
|
|
2
2
|
import { MediaStreamTrackMock } from 'webrtc-mock';
|
|
3
3
|
import { default as RTCRtpSenderMock } from './RTCRtpSenderMock';
|
|
4
4
|
declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
_senders: RTCRtpSender[];
|
|
6
|
+
_receivers: any[];
|
|
7
7
|
constructor(_configuration?: RTCConfiguration, tracks: MediaStreamTrackMock[]);
|
|
8
8
|
canTrickleIceCandidates: boolean | null;
|
|
9
9
|
connectionState: RTCPeerConnectionState;
|
|
@@ -14,15 +14,15 @@ declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
|
|
|
14
14
|
idpErrorInfo: string | null;
|
|
15
15
|
idpLoginUrl: string | null;
|
|
16
16
|
localDescription: RTCSessionDescription | null;
|
|
17
|
-
onconnectionstatechange: ((this: RTCPeerConnection, event_: Event) =>
|
|
18
|
-
ondatachannel: ((this: RTCPeerConnection, event_: RTCDataChannelEvent) =>
|
|
19
|
-
onicecandidate: ((this: RTCPeerConnection, event_: RTCPeerConnectionIceEvent) =>
|
|
20
|
-
onicecandidateerror: ((this: RTCPeerConnection, event_: Event) =>
|
|
21
|
-
oniceconnectionstatechange: ((this: RTCPeerConnection, event_: Event) =>
|
|
22
|
-
onicegatheringstatechange: ((this: RTCPeerConnection, event_: Event) =>
|
|
23
|
-
onnegotiationneeded: ((this: RTCPeerConnection, event_: Event) =>
|
|
24
|
-
onsignalingstatechange: ((this: RTCPeerConnection, event_: Event) =>
|
|
25
|
-
ontrack: ((this: RTCPeerConnection, event_: RTCTrackEvent) =>
|
|
17
|
+
onconnectionstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
|
|
18
|
+
ondatachannel: ((this: RTCPeerConnection, event_: RTCDataChannelEvent) => any) | null;
|
|
19
|
+
onicecandidate: ((this: RTCPeerConnection, event_: RTCPeerConnectionIceEvent) => any) | null;
|
|
20
|
+
onicecandidateerror: ((this: RTCPeerConnection, event_: Event) => any) | null;
|
|
21
|
+
oniceconnectionstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
|
|
22
|
+
onicegatheringstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
|
|
23
|
+
onnegotiationneeded: ((this: RTCPeerConnection, event_: Event) => any) | null;
|
|
24
|
+
onsignalingstatechange: ((this: RTCPeerConnection, event_: Event) => any) | null;
|
|
25
|
+
ontrack: ((this: RTCPeerConnection, event_: RTCTrackEvent) => any) | null;
|
|
26
26
|
peerIdentity: undefined;
|
|
27
27
|
pendingLocalDescription: RTCSessionDescription | null;
|
|
28
28
|
pendingRemoteDescription: RTCSessionDescription | null;
|
|
@@ -47,12 +47,12 @@ declare class RTCPeerConnectionMock implements RTCPeerConnectionDeprecated {
|
|
|
47
47
|
setConfiguration(_configuration: RTCConfiguration): void;
|
|
48
48
|
setLocalDescription(_description: RTCSessionDescriptionInit): Promise<void>;
|
|
49
49
|
setRemoteDescription(_description: RTCSessionDescriptionInit): Promise<void>;
|
|
50
|
-
addEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) =>
|
|
50
|
+
addEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) => any, options?: AddEventListenerOptions | boolean): void;
|
|
51
51
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
|
|
52
|
-
removeEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) =>
|
|
52
|
+
removeEventListener<K extends keyof RTCPeerConnectionEventMap>(type: K, listener: (this: RTCPeerConnection, event_: RTCPeerConnectionEventMap[K]) => any, options?: EventListenerOptions | boolean): void;
|
|
53
53
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: EventListenerOptions | boolean): void;
|
|
54
54
|
dispatchEvent(_event: Event): boolean;
|
|
55
|
-
getReceivers: () =>
|
|
55
|
+
getReceivers: () => any[];
|
|
56
56
|
getSenders: () => RTCRtpSender[];
|
|
57
57
|
addTrack: (track: MediaStreamTrack) => RTCRtpSenderMock;
|
|
58
58
|
}
|
|
@@ -3,8 +3,8 @@ declare class RTCRtpSenderMock implements RTCRtpSender {
|
|
|
3
3
|
track: MediaStreamTrack | null;
|
|
4
4
|
transport: RTCDtlsTransport | null;
|
|
5
5
|
transform: RTCRtpTransform | null;
|
|
6
|
-
private
|
|
7
|
-
private
|
|
6
|
+
private _parameters;
|
|
7
|
+
private _parametersGets?;
|
|
8
8
|
constructor({ track }?: {
|
|
9
9
|
track?: MediaStreamTrack;
|
|
10
10
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { IncomingInfoEvent } from '@krivega/jssip';
|
|
2
|
-
import {
|
|
2
|
+
import { default as BaseSession } from './BaseSession.mock';
|
|
3
3
|
export declare const FAILED_CONFERENCE_NUMBER = "777";
|
|
4
4
|
export declare const createDeclineStartPresentationError: () => Error;
|
|
5
5
|
declare class RTCSessionMock extends BaseSession {
|
|
6
6
|
url: string;
|
|
7
7
|
status_code?: number;
|
|
8
|
-
private
|
|
8
|
+
private _isEnded;
|
|
9
9
|
private static startPresentationError?;
|
|
10
10
|
private static countStartPresentationError;
|
|
11
11
|
private static countStartsPresentation;
|
|
12
12
|
constructor({ url, mediaStream, eventHandlers, originator, }: {
|
|
13
13
|
url?: string;
|
|
14
|
-
mediaStream?:
|
|
15
|
-
eventHandlers
|
|
14
|
+
mediaStream?: any;
|
|
15
|
+
eventHandlers?: any;
|
|
16
16
|
originator: string;
|
|
17
17
|
});
|
|
18
18
|
static setStartPresentationError(startPresentationError: Error, { count }?: {
|
|
@@ -20,8 +20,8 @@ declare class RTCSessionMock extends BaseSession {
|
|
|
20
20
|
}): void;
|
|
21
21
|
static resetStartPresentationError(): void;
|
|
22
22
|
startPresentation(stream: MediaStream): Promise<MediaStream>;
|
|
23
|
-
initPeerconnection(mediaStream:
|
|
24
|
-
createPeerconnection(sendedStream:
|
|
23
|
+
initPeerconnection(mediaStream: any): boolean;
|
|
24
|
+
createPeerconnection(sendedStream: any): void;
|
|
25
25
|
connect(target: string): void;
|
|
26
26
|
/**
|
|
27
27
|
* answer
|
|
@@ -32,38 +32,42 @@ declare class RTCSessionMock extends BaseSession {
|
|
|
32
32
|
|
|
33
33
|
* @returns {undefined}
|
|
34
34
|
*/
|
|
35
|
-
answer: jest.Mock<void, [
|
|
36
|
-
|
|
37
|
-
}], any>;
|
|
38
|
-
terminate({ status_code, cause }?: {
|
|
35
|
+
answer: jest.Mock<void, [any], any>;
|
|
36
|
+
terminate({ status_code }?: {
|
|
39
37
|
status_code?: number;
|
|
40
|
-
cause?: string;
|
|
41
38
|
}): this;
|
|
42
|
-
terminateAsync({ status_code
|
|
39
|
+
terminateAsync({ status_code }?: {
|
|
43
40
|
status_code?: number;
|
|
44
|
-
cause?: string;
|
|
45
41
|
}): Promise<void>;
|
|
46
42
|
terminateRemote({ status_code }?: {
|
|
47
43
|
status_code?: number;
|
|
48
44
|
}): this;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
_addStream(stream: Record<string, () => any[]>, action?: string): void;
|
|
46
|
+
_forEachSenders(callback: {
|
|
47
|
+
({ track }: {
|
|
48
|
+
track: any;
|
|
49
|
+
}): void;
|
|
50
|
+
({ track }: {
|
|
51
|
+
track: any;
|
|
52
|
+
}): void;
|
|
53
|
+
(argument0: any): void;
|
|
54
|
+
}): RTCRtpSender[];
|
|
55
|
+
_toggleMuteAudio(mute: boolean): void;
|
|
56
|
+
_toggleMuteVideo(mute: boolean): void;
|
|
53
57
|
mute(options: {
|
|
54
|
-
audio:
|
|
55
|
-
video:
|
|
58
|
+
audio: any;
|
|
59
|
+
video: any;
|
|
56
60
|
}): void;
|
|
57
61
|
unmute(options: {
|
|
58
|
-
audio:
|
|
59
|
-
video:
|
|
62
|
+
audio: any;
|
|
63
|
+
video: any;
|
|
60
64
|
}): void;
|
|
61
65
|
isMuted(): {
|
|
62
66
|
audio: boolean;
|
|
63
67
|
video: boolean;
|
|
64
68
|
};
|
|
65
|
-
replaceMediaStream(
|
|
66
|
-
|
|
69
|
+
replaceMediaStream(mediaStream: any): Promise<any>;
|
|
70
|
+
_onmute({ audio, video }: {
|
|
67
71
|
audio: boolean;
|
|
68
72
|
video: boolean;
|
|
69
73
|
}): void;
|