sip-connector 14.1.2-6 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/@SipConnector-CZo7A8_q.cjs +1 -0
  2. package/dist/@SipConnector-DbvV1Leg.js +2247 -0
  3. package/dist/ApiManager/@ApiManager.d.ts +59 -0
  4. package/dist/ApiManager/constants.d.ts +71 -0
  5. package/dist/ApiManager/eventNames.d.ts +33 -0
  6. package/dist/ApiManager/index.d.ts +3 -0
  7. package/dist/ApiManager/types.d.ts +99 -0
  8. package/dist/CallManager/@CallManager.d.ts +26 -0
  9. package/dist/CallManager/AbstractCallStrategy.d.ts +47 -0
  10. package/dist/CallManager/MCUCallStrategy.d.ts +30 -0
  11. package/dist/CallManager/RemoteStreamsManager.d.ts +8 -0
  12. package/dist/CallManager/causes.d.ts +13 -0
  13. package/dist/CallManager/eventNames.d.ts +45 -0
  14. package/dist/CallManager/hasCanceledCallError.d.ts +2 -0
  15. package/dist/CallManager/index.d.ts +7 -0
  16. package/dist/CallManager/types.d.ts +59 -0
  17. package/dist/ConnectionManager/@ConnectionManager.d.ts +48 -0
  18. package/dist/ConnectionManager/ConfigurationManager.d.ts +60 -0
  19. package/dist/ConnectionManager/ConnectionFlow.d.ts +84 -0
  20. package/dist/ConnectionManager/ConnectionStateMachine.d.ts +61 -0
  21. package/dist/ConnectionManager/RegistrationManager.d.ts +17 -0
  22. package/dist/ConnectionManager/SipOperations.d.ts +32 -0
  23. package/dist/ConnectionManager/UAFactory.d.ts +50 -0
  24. package/dist/ConnectionManager/eventNames.d.ts +16 -0
  25. package/dist/ConnectionManager/index.d.ts +3 -0
  26. package/dist/IncomingCallManager/@IncomingCallManager.d.ts +37 -0
  27. package/dist/IncomingCallManager/eventNames.d.ts +13 -0
  28. package/dist/IncomingCallManager/index.d.ts +2 -0
  29. package/dist/PresentationManager/@PresentationManager.d.ts +47 -0
  30. package/dist/PresentationManager/constants.d.ts +1 -0
  31. package/dist/PresentationManager/eventNames.d.ts +11 -0
  32. package/dist/PresentationManager/index.d.ts +2 -0
  33. package/dist/PresentationManager/types.d.ts +2 -0
  34. package/dist/SipConnector/@SipConnector.d.ts +96 -0
  35. package/dist/SipConnector/eventNames.d.ts +4 -0
  36. package/dist/SipConnector/index.d.ts +2 -0
  37. package/dist/{src/SipConnectorFacade → SipConnectorFacade}/SipConnectorFacade.d.ts +7 -16
  38. package/dist/{src/__fixtures__ → __fixtures__}/BaseSession.mock.d.ts +9 -9
  39. package/dist/{src/__fixtures__ → __fixtures__}/RTCPeerConnectionMock.d.ts +6 -0
  40. package/dist/{src/__fixtures__ → __fixtures__}/RTCSessionMock.d.ts +13 -8
  41. package/dist/{src/__fixtures__ → __fixtures__}/UA.mock.d.ts +13 -15
  42. package/dist/{src → __fixtures__}/eventNames.d.ts +1 -1
  43. package/dist/{src/__fixtures__ → __fixtures__}/index.d.ts +4 -4
  44. package/dist/{src/__fixtures__ → __fixtures__}/jssip.mock.d.ts +3 -3
  45. package/dist/doMock.cjs +1 -1
  46. package/dist/{src/doMock.d.ts → doMock.d.ts} +2 -1
  47. package/dist/doMock.js +442 -341
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.ts +14 -0
  50. package/dist/index.js +721 -674
  51. package/dist/{src/setParametersToSender → setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +1 -1
  52. package/dist/{src/tools → tools}/__fixtures__/connectToServer.d.ts +2 -2
  53. package/dist/{src/tools → tools}/__fixtures__/processRequest.d.ts +1 -1
  54. package/dist/{src/tools → tools}/error/getLinkError.d.ts +1 -1
  55. package/dist/{src/tools → tools}/error/getTypeFromError.d.ts +1 -1
  56. package/dist/{src/tools → tools}/error/getValuesFromError.d.ts +1 -1
  57. package/dist/{src/tools → tools}/index.d.ts +1 -1
  58. package/dist/{src/tools → tools}/prepareMediaStream.d.ts +1 -1
  59. package/dist/{src/tools → tools}/setVideoTrackContentHints.d.ts +1 -1
  60. package/dist/{src/tools → tools}/syncMediaState/index.d.ts +1 -1
  61. package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
  62. package/dist/{src/tools → tools}/syncMediaState/resolveOnStartMic.d.ts +1 -1
  63. package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
  64. package/dist/{src/tools → tools}/syncMediaState/resolveOnStopMic.d.ts +1 -1
  65. package/dist/types.d.ts +23 -0
  66. package/dist/{src/videoSendingBalancer → videoSendingBalancer}/balance.d.ts +1 -1
  67. package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidth.d.ts +1 -0
  68. package/dist/{src/videoSendingBalancer → videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +1 -0
  69. package/dist/{src/videoSendingBalancer → videoSendingBalancer}/index.d.ts +1 -1
  70. package/dist/{src/videoSendingBalancer → videoSendingBalancer}/processSender.d.ts +1 -1
  71. package/package.json +35 -42
  72. package/dist/SipConnector-D9frFCEK.js +0 -1352
  73. package/dist/SipConnector-J07EhbbA.cjs +0 -1
  74. package/dist/src/SipConnector.d.ts +0 -235
  75. package/dist/src/causes.d.ts +0 -23
  76. package/dist/src/headers.d.ts +0 -37
  77. package/dist/src/index.d.ts +0 -11
  78. package/dist/src/types.d.ts +0 -69
  79. /package/dist/{src → ConnectionManager}/getExtraHeadersRemoteAddress.d.ts +0 -0
  80. /package/dist/{src/SipConnectorFacade → SipConnectorFacade}/index.d.ts +0 -0
  81. /package/dist/{src/__fixtures__ → __fixtures__}/RTCRtpSenderMock.d.ts +0 -0
  82. /package/dist/{src/__fixtures__ → __fixtures__}/Registrator.mock.d.ts +0 -0
  83. /package/dist/{src/__fixtures__ → __fixtures__}/Request.mock.d.ts +0 -0
  84. /package/dist/{src/__fixtures__ → __fixtures__}/WebSocketInterface.mock.d.ts +0 -0
  85. /package/dist/{src/__fixtures__ → __fixtures__}/accountNotify.d.ts +0 -0
  86. /package/dist/{src/__fixtures__ → __fixtures__}/channels.d.ts +0 -0
  87. /package/dist/{src/__fixtures__ → __fixtures__}/channelsNotify.d.ts +0 -0
  88. /package/dist/{src/__fixtures__ → __fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
  89. /package/dist/{src → __fixtures__}/constants.d.ts +0 -0
  90. /package/dist/{src/__fixtures__ → __fixtures__}/delayPromise.d.ts +0 -0
  91. /package/dist/{src/__fixtures__ → __fixtures__}/enterRoom.d.ts +0 -0
  92. /package/dist/{src/__fixtures__ → __fixtures__}/mediaState.d.ts +0 -0
  93. /package/dist/{src/__fixtures__ → __fixtures__}/participantMoveRequests.d.ts +0 -0
  94. /package/dist/{src/__fixtures__ → __fixtures__}/participantNotify.d.ts +0 -0
  95. /package/dist/{src/__fixtures__ → __fixtures__}/remoteCallerData.d.ts +0 -0
  96. /package/dist/{src/__fixtures__ → __fixtures__}/utils.d.ts +0 -0
  97. /package/dist/{src/__fixtures__ → __fixtures__}/webcastNotify.d.ts +0 -0
  98. /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
  99. /package/dist/{src/setParametersToSender → setParametersToSender}/configureDegradationPreference.d.ts +0 -0
  100. /package/dist/{src/setParametersToSender → setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
  101. /package/dist/{src/setParametersToSender → setParametersToSender}/configureEncodings.d.ts +0 -0
  102. /package/dist/{src/setParametersToSender → setParametersToSender}/configureMaxBitrate.d.ts +0 -0
  103. /package/dist/{src/setParametersToSender → setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
  104. /package/dist/{src/setParametersToSender → setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
  105. /package/dist/{src/setParametersToSender → setParametersToSender}/index.d.ts +0 -0
  106. /package/dist/{src/setParametersToSender → setParametersToSender}/setParametersToSender.d.ts +0 -0
  107. /package/dist/{src/tools → tools}/__fixtures__/call.d.ts +0 -0
  108. /package/dist/{src/tools → tools}/__fixtures__/hasValidUri.d.ts +0 -0
  109. /package/dist/{src/tools → tools}/__fixtures__/permissions.d.ts +0 -0
  110. /package/dist/{src/tools → tools}/__tests-utils__/parseObject.d.ts +0 -0
  111. /package/dist/{src/tools → tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
  112. /package/dist/{src/tools → tools}/error/index.d.ts +0 -0
  113. /package/dist/{src/tools → tools}/error/stringifyMessage.d.ts +0 -0
  114. /package/dist/{src/tools → tools}/generateSimulcastEncodings.d.ts +0 -0
  115. /package/dist/{src/tools → tools}/getExtraHeaders.d.ts +0 -0
  116. /package/dist/{src/tools → tools}/getUserAgent.d.ts +0 -0
  117. /package/dist/{src/tools → tools}/hasPurgatory.d.ts +0 -0
  118. /package/dist/{src/tools → tools}/resolveUpdateTransceiver.d.ts +0 -0
  119. /package/dist/{src/tools/sendDTMFAccumulated.d.ts → tools/sendDtmfFAccumulated.d.ts} +0 -0
  120. /package/dist/{src/utils → utils}/errors.d.ts +0 -0
  121. /package/dist/{src/utils → utils}/findSenderByStream.d.ts +0 -0
  122. /package/dist/{src/utils → utils}/findVideoSender.d.ts +0 -0
  123. /package/dist/{src/utils → utils}/findVideoTrack.d.ts +0 -0
  124. /package/dist/{src/utils → utils}/getCodecFromSender.d.ts +0 -0
  125. /package/dist/{src/utils → utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
  126. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
  127. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/hasIncludesString.d.ts +0 -0
  128. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrate.d.ts +0 -0
  129. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
  130. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
  131. /package/dist/{src/videoSendingBalancer → videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
@@ -1 +0,0 @@
1
- "use strict";var Ot=Object.defineProperty;var mt=(s,e,t)=>e in s?Ot(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 Mt=require("@krivega/cancelable-promise"),we=require("events-constructor"),G=require("repeated-calls"),J=require("debug"),Dt="Connection Error",ke="Request Timeout",pt="SIP Failure Code",vt="Internal Error",yt="Busy",X="Rejected",wt="Redirected",bt="Unavailable",Be="Not Found",Ut="Address Incomplete",Lt="Incompatible SDP",Ht="Missing SDP",Wt="Authentication Error",Fe="Terminated",kt="WebRTC Error",Q="Canceled",Bt="No Answer",Ft="Expires",xt="No ACK",Vt="Dialog Error",Yt="User Denied Media Access",xe="Bad Media Description",qt="RTP Timeout",$t=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_INCOMPLETE:Ut,AUTHENTICATION_ERROR:Wt,BAD_MEDIA_DESCRIPTION:xe,BUSY:yt,BYE:Fe,CANCELED:Q,CONNECTION_ERROR:Dt,DIALOG_ERROR:Vt,EXPIRES:Ft,INCOMPATIBLE_SDP:Lt,INTERNAL_ERROR:vt,MISSING_SDP:Ht,NOT_FOUND:Be,NO_ACK:xt,NO_ANSWER:Bt,REDIRECTED:wt,REJECTED:X,REQUEST_TIMEOUT:ke,RTP_TIMEOUT:qt,SIP_FAILURE_CODE:pt,UNAVAILABLE:bt,USER_DENIED_MEDIA_ACCESS:Yt,WEBRTC_ERROR:kt},Symbol.toStringTag,{value:"Module"})),z="incomingCall",j="declinedIncomingCall",K="failedIncomingCall",Z="terminatedIncomingCall",F="connecting",P="connected",C="disconnected",y="newRTCSession",O="registered",ee="unregistered",m="registrationFailed",Ve="newMessage",te="sipEvent",ne="availableSecondRemoteStream",se="notAvailableSecondRemoteStream",ie="mustStopPresentation",w="shareState",oe="enterRoom",re="useLicense",ae="peerconnection:confirmed",ce="peerconnection:ontrack",b="channels",Ee="channels:notify",de="ended:fromserver",he="main-cam-control",Se="admin-stop-main-cam",Te="admin-start-main-cam",le="admin-stop-mic",ue="admin-start-mic",U="admin-force-sync-media-state",ge="participant:added-to-list-moderators",Ce="participant:removed-from-list-moderators",_e="participant:move-request-to-stream",x="participant:move-request-to-spectators",V="participant:move-request-to-participants",Ne="participation:accepting-word-request",Ae="participation:cancelling-word-request",Re="webcast:started",fe="webcast:stopped",Ie="account:changed",Pe="account:deleted",Oe="conference:participant-token-issued",M="ended",Ye="sending",qe="reinvite",$e="replaces",Ge="refer",Je="progress",Xe="accepted",L="confirmed",H="peerconnection",A="failed",Qe="muted",ze="unmuted",me="newDTMF",Me="newInfo",je="hold",Ke="unhold",Ze="update",et="sdp",tt="icecandidate",nt="getusermediafailed",st="peerconnection:createofferfailed",it="peerconnection:createanswerfailed",ot="peerconnection:setlocaldescriptionfailed",rt="peerconnection:setremotedescriptionfailed",at="presentation:start",ct="presentation:started",Et="presentation:end",De="presentation:ended",W="presentation:failed",dt="SPECTATOR",ht="PARTICIPANT",St=1e6;var _=(s=>(s.LOCAL="local",s.REMOTE="remote",s.SYSTEM="system",s))(_||{});const Gt=Object.freeze(Object.defineProperty({__proto__:null,ACCEPTED:Xe,ACCOUNT_CHANGED:Ie,ACCOUNT_DELETED:Pe,ADMIN_FORCE_SYNC_MEDIA_STATE:U,ADMIN_START_MAIN_CAM:Te,ADMIN_START_MIC:ue,ADMIN_STOP_MAIN_CAM:Se,ADMIN_STOP_MIC:le,AVAILABLE_SECOND_REMOTE_STREAM_EVENT:ne,CHANNELS:b,CHANNELS_NOTIFY:Ee,CONFERENCE_PARTICIPANT_TOKEN_ISSUED:Oe,CONFIRMED:L,CONNECTED:P,CONNECTING:F,DECLINED_INCOMING_CALL:j,DISCONNECTED:C,ENDED:M,ENDED_FROM_SERVER:de,ENTER_ROOM:oe,FAILED:A,FAILED_INCOMING_CALL:K,GET_USER_MEDIA_FAILED:nt,HOLD:je,ICE_CANDIDATE:tt,INCOMING_CALL:z,MAIN_CAM_CONTROL:he,MUST_STOP_PRESENTATION_EVENT:ie,MUTED:Qe,NEW_DTMF:me,NEW_INFO:Me,NEW_MESSAGE:Ve,NEW_RTC_SESSION:y,NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:se,ONE_MEGABIT_IN_BITS:St,Originator:_,PARTICIPANT:ht,PARTICIPANT_ADDED_TO_LIST_MODERATORS:ge,PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS:V,PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:x,PARTICIPANT_MOVE_REQUEST_TO_STREAM:_e,PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:Ce,PARTICIPATION_ACCEPTING_WORD_REQUEST:Ne,PARTICIPATION_CANCELLING_WORD_REQUEST:Ae,PEER_CONNECTION:H,PEER_CONNECTION_CONFIRMED:ae,PEER_CONNECTION_CREATE_ANSWER_FAILED:it,PEER_CONNECTION_CREATE_OFFER_FAILED:st,PEER_CONNECTION_ONTRACK:ce,PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:ot,PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:rt,PRESENTATION_END:Et,PRESENTATION_ENDED:De,PRESENTATION_FAILED:W,PRESENTATION_START:at,PRESENTATION_STARTED:ct,PROGRESS:Je,REFER:Ge,REGISTERED:O,REGISTRATION_FAILED:m,REINVITE:qe,REPLACES:$e,SDP:et,SENDING:Ye,SHARE_STATE:w,SIP_EVENT:te,SPECTATOR:dt,TERMINATED_INCOMING_CALL:Z,UNHOLD:Ke,UNMUTED:ze,UNREGISTERED:ee,UPDATE:Ze,USE_LICENSE:re,WEBCAST_STARTED:Re,WEBCAST_STOPPED:fe},Symbol.toStringTag,{value:"Module"})),Tt=[z,j,Z,K,Ne,Ae,_e,Ee,Oe,Ie,Pe,Re,fe,ge,Ce],Y=[F,P,C,y,O,ee,m,Ve,te],lt=[ne,se,ie,w,oe,re,ae,ce,b,de,he,Te,Se,le,ue,U,x,V],pe=[M,F,Ye,qe,$e,Ge,Je,Xe,L,H,A,Qe,ze,me,Me,je,Ke,Ze,et,tt,nt,st,it,ot,rt,at,ct,Et,De,W],ut=[...Y,...Tt],ve=[...pe,...lt],Jt=Object.freeze(Object.defineProperty({__proto__:null,SESSION_EVENT_NAMES:ve,SESSION_JSSIP_EVENT_NAMES:pe,SESSION_SYNTHETICS_EVENT_NAMES:lt,UA_EVENT_NAMES:ut,UA_JSSIP_EVENT_NAMES:Y,UA_SYNTHETICS_EVENT_NAMES:Tt},Symbol.toStringTag,{value:"Module"})),ye="sip-connector",v=J(ye),Xt=()=>{J.enable(ye)},Qt=()=>{J.enable(`-${ye}`)},zt=(s,e)=>(s.degradationPreference=e.degradationPreference,s),jt=(s,e)=>{s.encodings??(s.encodings=[]);for(let t=s.encodings.length;t<e;t+=1)s.encodings.push({});return s},gt=s=>(e,t)=>t!==void 0&&e!==t||t===void 0&&e!==s,Kt=gt(),Zt=(s,e)=>{if(Kt(s,e))return s},en=(s,e)=>{const t=s.maxBitrate,n=Zt(e,t);return n!==void 0&&(s.maxBitrate=n),s},Ct=1,tn=gt(Ct),nn=(s,e)=>{const t=s===void 0?void 0:Math.max(s,Ct);if(t!==void 0&&tn(t,e))return t},sn=(s,e)=>{const t=s.scaleResolutionDownBy,n=nn(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 jt(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;en(i,c),sn(i,E)}),s},rn=(s,e)=>{var t,n,i,o,a,c,E,d,T,l,S,u;if(((t=s.codecs)==null?void 0:t.length)!==((n=e.codecs)==null?void 0:n.length))return!0;for(let h=0;h<(((i=s.codecs)==null?void 0:i.length)??0);h++)if(JSON.stringify(s.codecs[h])!==JSON.stringify(e.codecs[h]))return!0;if(((o=s.headerExtensions)==null?void 0:o.length)!==((a=e.headerExtensions)==null?void 0:a.length))return!0;for(let h=0;h<(((c=s.headerExtensions)==null?void 0:c.length)??0);h++)if(JSON.stringify(s.headerExtensions[h])!==JSON.stringify(e.headerExtensions[h]))return!0;if(((E=s.encodings)==null?void 0:E.length)!==((d=e.encodings)==null?void 0:d.length))return!0;for(let h=0;h<(s.encodings.length??0);h++)if(JSON.stringify(s.encodings[h])!==JSON.stringify(e.encodings[h]))return!0;return((T=s.rtcp)==null?void 0:T.cname)!==((l=e.rtcp)==null?void 0:l.cname)||((S=s.rtcp)==null?void 0:S.reducedSize)!==((u=e.rtcp)==null?void 0:u.reducedSize)||s.degradationPreference!==e.degradationPreference},_t=async(s,e)=>{const t=s.getParameters(),n=JSON.parse(JSON.stringify(t));on(t,e),zt(t,e);const i=rn(n,t);return i&&await s.setParameters(t),{parameters:t,isChanged:i}};var R=(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))(R||{}),k=(s=>(s.ADMIN_STOP_MIC="ADMINSTOPMIC",s.ADMIN_START_MIC="ADMINSTARTMIC",s))(k||{}),B=(s=>(s.ADMIN_SYNC_FORCED="1",s.ADMIN_SYNC_NOT_FORCED="0",s))(B||{}),Nt=(s=>(s.AUDIO="AUDIO",s.VIDEO="VIDEO",s.AUDIOPLUSPRESENTATION="AUDIOPLUSPRESENTATION",s))(Nt||{}),At=(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))(At||{});const Rt=async(s,e,t)=>{const{isChanged:n,parameters:i}=await _t(s,{encodings:[{scaleResolutionDownBy:e.scaleResolutionDownBy,maxBitrate:e.maxBitrate}]});return n&&t&&t(i),{isChanged:n,parameters:i}};function an(s){return e=>`sip:${e}@${s}`}const cn=(s,e)=>()=>Math.floor(Math.random()*(e-s))+s,be=s=>s.trim().replaceAll(" ","_"),En=cn(1e5,99999999),dn=s=>s.some(t=>{const{kind:n}=t;return n==="video"}),hn=s=>{const e=[];return s!==void 0&&s!==""&&e.push(`X-Vinteo-Remote: ${s}`),e},Sn="content-type",Tn="x-webrtc-enter-room",D="application/vinteo.webrtc.sharedesktop",ln="application/vinteo.webrtc.roomname",un="application/vinteo.webrtc.channels",gn="application/vinteo.webrtc.mediastate",Cn="application/vinteo.webrtc.refusal",Ue="application/vinteo.webrtc.maincam",_n="application/vinteo.webrtc.mic",Nn="application/vinteo.webrtc.uselic",An="X-WEBRTC-USE-LICENSE",Rn="X-WEBRTC-PARTICIPANT-NAME",Le="X-WEBRTC-INPUT-CHANNELS",He="X-WEBRTC-OUTPUT-CHANNELS",fn="X-WEBRTC-MAINCAM",In="X-WEBRTC-MIC",We="X-WEBRTC-SYNC",Pn="X-WEBRTC-MAINCAM-RESOLUTION",On="X-WEBRTC-MEDIA-STATE",mn="X-Vinteo-Media-Type",Mn="X-Vinteo-MainCam-State",Dn="X-Vinteo-Mic-State",pn="application/vinteo.webrtc.partstate",vn="X-WEBRTC-PARTSTATE",yn="application/vinteo.webrtc.notify",wn="X-VINTEO-NOTIFY",f="x-webrtc-share-state",bn=`${f}: LETMESTARTPRESENTATION`,Un=`${f}: STOPPRESENTATION`,ft="YOUCANRECEIVECONTENT",It="CONTENTEND",Pt="YOUMUSTSTOPSENDCONTENT",Ln=`${f}: ${Pt}`,Hn=`${f}: ${ft}`,Wn=`${f}: ${It}`,kn="X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE",Bn=`${kn}: LETMESTARTMAINCAM`,Fn=(s,e)=>{s.getVideoTracks().forEach(n=>{"contentHint"in n&&n.contentHint!==e&&(n.contentHint=e)})},p=(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"&&Fn(c,n),c},xn="Error decline with 603",Vn=1006,Yn=s=>typeof s=="object"&&s!==null&&"code"in s&&s.code===Vn,qn=s=>s.message===xn,$n=(s,e)=>s.find(t=>t.track&&e.getTracks().includes(t.track)),Gn=async(s,e,t)=>{const n=$n(s,e);if(n)return Rt(n,{maxBitrate:t})},Jn=486,Xn=487,Qn=3,zn=1,jn=s=>s instanceof Object&&("originator"in s||"cause"in s),Kn=s=>{if(Mt.isCanceledError(s))return!0;if(!jn(s))return!1;const{originator:e,cause:t}=s;return typeof t=="string"?t===ke||t===X||e===_.LOCAL&&(t===Q||t===Fe):!1},Zn=s=>G.hasCanceledError(s),es="channels",ts="WebcastStarted",ns="WebcastStopped",ss="accountChanged",is="accountDeleted",os="addedToListModerators",rs="removedFromListModerators",as="ParticipationRequestAccepted",cs="ParticipationRequestRejected",Es="ParticipantMovedToWebcast",ds="ConferenceParticipantTokenIssued";class hs{constructor({JsSIP:e}){r(this,"promisePendingStartPresentation");r(this,"promisePendingStopPresentation");r(this,"ua");r(this,"rtcSession");r(this,"incomingRTCSession");r(this,"streamPresentationCurrent");r(this,"socket");r(this,"isRegisterConfigInner",!1);r(this,"connectionConfiguration",{});r(this,"remoteStreams",{});r(this,"JsSIP");r(this,"sessionEvents");r(this,"uaEvents");r(this,"cancelableConnectWithRepeatedCalls");r(this,"cancelableSendPresentationWithRepeatedCalls");r(this,"isPendingConnect",!1);r(this,"isPendingInitUa",!1);r(this,"isPendingCall",!1);r(this,"isPendingAnswer",!1);r(this,"connect",async(e,t)=>(this.cancelRequests(),this.connectWithDuplicatedCalls(e,t)));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(F,void 0);try{await this.unregister()}catch(e){v("tryRegister",e)}return this.register()});r(this,"declineToIncomingCall",async({statusCode:e=Xn}={})=>new Promise((t,n)=>{try{const i=this.getIncomingRTCSession(),o=this.remoteCallerData;this.removeIncomingSession(),this.uaEvents.trigger(j,o),i.terminate({status_code:e}),t()}catch(i){n(i)}}));r(this,"busyIncomingCall",async()=>this.declineToIncomingCall({statusCode:Jn}));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",be(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(d=>{i(d)}):E?n(E):i(new Error("nothing changed"))}));r(this,"disconnect",async()=>{this.off(y,this.handleNewRTCSession);const e=new Promise(n=>{this.once(C,()=>{n()})}),{ua:t}=this;return t?(await this.hangUpWithoutCancelRequests(),t.stop()):this.uaEvents.trigger(C,void 0),e.finally(()=>{delete this.ua})});r(this,"call",async({number:e,mediaStream:t,extraHeaders:n=[],ontrack:i,iceServers:o,directionVideo:a,directionAudio:c,contentHint:E,offerToReceiveAudio:d=!0,offerToReceiveVideo:T=!0,sendEncodings:l,onAddedTransceiver:S})=>(this.isPendingCall=!0,new Promise((u,h)=>{const{ua:g}=this;if(!g){h(new Error("this.ua is not initialized"));return}this.connectionConfiguration.number=e,this.connectionConfiguration.answer=!1,this.handleCall({ontrack:i}).then(u).catch(N=>{h(N)}),this.rtcSession=g.call(this.getSipServerUrl(e),{extraHeaders:n,mediaStream:p(t,{directionVideo:a,directionAudio:c,contentHint:E}),eventHandlers:this.sessionEvents.triggers,directionVideo:a,directionAudio:c,pcConfig:{iceServers:o},rtcOfferConstraints:{offerToReceiveAudio:d,offerToReceiveVideo:T},sendEncodings:l,onAddedTransceiver:S})}).finally(()=>{this.isPendingCall=!1})));r(this,"answerToIncomingCall",async({mediaStream:e,ontrack:t,extraHeaders:n=[],iceServers:i,directionVideo:o,directionAudio:a,offerToReceiveAudio:c,offerToReceiveVideo:E,contentHint:d,sendEncodings:T,onAddedTransceiver:l})=>(this.isPendingAnswer=!0,new Promise((S,u)=>{try{const h=this.getIncomingRTCSession();this.rtcSession=h,this.removeIncomingSession(),this.sessionEvents.eachTriggers((N,q)=>{const I=pe.find($=>$===q);I&&h.on(I,N)}),this.connectionConfiguration.answer=!0,this.connectionConfiguration.number=h.remote_identity.uri.user,this.handleCall({ontrack:t}).then(S).catch(N=>{u(N)});const g=p(e,{directionVideo:o,directionAudio:a,contentHint:d});h.answer({extraHeaders:n,directionVideo:o,directionAudio:a,mediaStream:g,pcConfig:{iceServers:i},rtcOfferConstraints:{offerToReceiveAudio:c,offerToReceiveVideo:E},sendEncodings:T,onAddedTransceiver:l})}catch(h){u(h)}}).finally(()=>{this.isPendingAnswer=!1})));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===_.LOCAL&&t()}),i.sendDTMF(e,{duration:120,interToneGap:600})}));r(this,"removeIncomingSession",()=>{delete this.incomingRTCSession});r(this,"getSipServerUrl",e=>e);r(this,"connectWithDuplicatedCalls",async(e,{callLimit:t=Qn}={})=>{const n=async()=>this.connectInner(e),i=o=>{var d;const c=((d=this.ua)==null?void 0:d.isConnected())===!0&&this.hasEqualConnectionConfiguration(e),E=o!=null&&!Yn(o);return c||E};return this.isPendingConnect=!0,this.cancelableConnectWithRepeatedCalls=G.repeatedCallsAsync({targetFunction:n,isComplete:i,callLimit:t,isRejectAsValid:!0,isCheckBeforeCall:!1}),this.cancelableConnectWithRepeatedCalls.then(o=>{if(o instanceof this.JsSIP.UA)return o;throw o}).finally(()=>{this.isPendingConnect=!1})});r(this,"handleNewRTCSession",({originator:e,session:t})=>{if(e===_.REMOTE){this.incomingRTCSession=t;const n=this.remoteCallerData;t.on(A,i=>{this.removeIncomingSession(),i.originator===_.LOCAL?this.uaEvents.trigger(Z,n):this.uaEvents.trigger(K,n)}),this.uaEvents.trigger(z,n)}});r(this,"connectInner",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:d,userAgent:T,displayName:l="",register:S=!1,extraHeaders:u=[]})=>{if(!n)throw new Error("sipServerUrl is required");if(!i)throw new Error("sipWebSocketServerURL is required");if(S&&(e===void 0||e===""))throw new Error("user is required for authorized connection");if(S&&(t===void 0||t===""))throw new Error("password is required for authorized connection");this.isPendingInitUa=!0;try{this.connectionConfiguration={sipServerUrl:n,displayName:l,register:S,user:e,password:t};const{configuration:h,helpers:g}=this.createUaConfiguration({user:e,sipServerUrl:n,sipWebSocketServerURL:i,password:t,displayName:l,register:S,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:E,connectionRecoveryMaxInterval:d,userAgent:T});return this.getSipServerUrl=g.getSipServerUrl,this.socket=g.socket,this.ua&&await this.disconnect(),this.isRegisterConfigInner=!!S,this.ua=this.createUa({...h,remoteAddress:o,extraHeaders:u}),this.uaEvents.eachTriggers((N,q)=>{const I=Y.find($=>$===q);I&&this.ua&&this.ua.on(I,N)}),this.ua}finally{this.isPendingInitUa=!1}});r(this,"createUa",({remoteAddress:e,extraHeaders:t=[],...n})=>{const i=new this.JsSIP.UA(n),a=[...e!==void 0&&e!==""?hn(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(O,i),this.on(m,o)):this.on(P,i),this.on(C,o)},c=()=>{this.off(O,i),this.off(m,o),this.off(P,i),this.off(C,o)};a(),this.on(y,this.handleNewRTCSession),n.start()}));r(this,"handleCall",async({ontrack:e})=>new Promise((t,n)=>{const i=()=>{this.onSession(H,T),this.onSession(L,l)},o=()=>{this.offSession(H,T),this.offSession(L,l)},a=()=>{this.onSession(A,E),this.onSession(M,E)},c=()=>{this.offSession(A,E),this.offSession(M,E)},E=S=>{o(),c(),n(S)};let d;const T=({peerconnection:S})=>{d=S,d.ontrack=u=>{this.sessionEvents.trigger(ce,d),e&&e(u)}},l=()=>{d!==void 0&&this.sessionEvents.trigger(ae,d),o(),c(),t(d)};i(),a()}));r(this,"restoreSession",()=>{this.cancelRequestsAndResetPresentation(),delete this.connectionConfiguration.number,delete this.rtcSession,this.remoteStreams={}});r(this,"hangUpWithoutCancelRequests",async()=>{if(this.ua&&this.rtcSession){const{rtcSession:e}=this;if(this.streamPresentationCurrent)try{await this.stopPresentation()}catch(t){v("error stop presentation: ",t)}if(this.restoreSession(),!e.isEnded())return e.terminateAsync({cause:Q})}});r(this,"handleShareState",e=>{switch(e){case ft:{this.sessionEvents.trigger(ne,void 0);break}case It:{this.sessionEvents.trigger(se,void 0);break}case Pt:{this.sessionEvents.trigger(ie,void 0);break}}});r(this,"maybeTriggerChannels",e=>{const t=e.getHeader(Le),n=e.getHeader(He);if(t&&n){const i={inputChannels:t,outputChannels:n};this.sessionEvents.trigger(b,i)}});r(this,"handleNotify",e=>{switch(e.cmd){case es:{const t=e;this.triggerChannelsNotify(t);break}case ts:{const t=e;this.triggerWebcastStartedNotify(t);break}case ns:{const t=e;this.triggerWebcastStoppedNotify(t);break}case os:{const t=e;this.triggerAddedToListModeratorsNotify(t);break}case rs:{const t=e;this.triggerRemovedFromListModeratorsNotify(t);break}case as:{const t=e;this.triggerParticipationAcceptingWordRequest(t);break}case cs:{const t=e;this.triggerParticipationCancellingWordRequest(t);break}case Es:{const t=e;this.triggerParticipantMoveRequestToStream(t);break}case ss:{this.triggerAccountChangedNotify();break}case is:{this.triggerAccountDeletedNotify();break}case ds:{const t=e;this.triggerConferenceParticipantTokenIssued(t);break}default:v("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(ge,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(fe,n)});r(this,"triggerAccountChangedNotify",()=>{this.uaEvents.trigger(Ie,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(Ne,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(_e,t)});r(this,"triggerEnterRoom",e=>{const t=e.getHeader(Tn),n=e.getHeader(Rn);this.sessionEvents.trigger(oe,{room:t,participantName:n})});r(this,"triggerShareState",e=>{const t=e.getHeader(f);this.sessionEvents.trigger(w,t)});r(this,"maybeTriggerParticipantMoveRequest",e=>{const t=e.getHeader(vn);t===dt&&this.sessionEvents.trigger(x,void 0),t===ht&&this.sessionEvents.trigger(V,void 0)});r(this,"triggerMainCamControl",e=>{const t=e.getHeader(fn),n=e.getHeader(We),i=n===B.ADMIN_SYNC_FORCED;if(t===R.ADMIN_START_MAIN_CAM){this.sessionEvents.trigger(Te,{isSyncForced:i});return}if(t===R.ADMIN_STOP_MAIN_CAM){this.sessionEvents.trigger(Se,{isSyncForced:i});return}(t===R.RESUME_MAIN_CAM||t===R.PAUSE_MAIN_CAM)&&n!==void 0&&this.sessionEvents.trigger(U,{isSyncForced:i});const o=e.getHeader(Pn);this.sessionEvents.trigger(he,{mainCam:t,resolutionMainCam:o})});r(this,"triggerMicControl",e=>{const t=e.getHeader(In),i=e.getHeader(We)===B.ADMIN_SYNC_FORCED;t===k.ADMIN_START_MIC?this.sessionEvents.trigger(ue,{isSyncForced:i}):t===k.ADMIN_STOP_MIC&&this.sessionEvents.trigger(le,{isSyncForced:i})});r(this,"triggerUseLicense",e=>{const t=e.getHeader(An);this.sessionEvents.trigger(re,t)});r(this,"handleNewInfo",e=>{const{originator:t}=e;if(t!==_.REMOTE)return;const{request:n}=e,i=n.getHeader(Sn);if(i)switch(i){case ln:{this.triggerEnterRoom(n),this.maybeTriggerChannels(n);break}case yn:{this.maybeHandleNotify(n);break}case D:{this.triggerShareState(n);break}case Ue:{this.triggerMainCamControl(n);break}case _n:{this.triggerMicControl(n);break}case Nn:{this.triggerUseLicense(n);break}case pn:{this.maybeTriggerParticipantMoveRequest(n);break}}});r(this,"handleSipEvent",({request:e})=>{this.maybeHandleNotify(e)});r(this,"maybeHandleNotify",e=>{const t=e.getHeader(wn);if(t){const n=JSON.parse(t);this.handleNotify(n)}});r(this,"handleEnded",e=>{const{originator:t}=e;t===_.REMOTE&&this.sessionEvents.trigger(de,e),this.restoreSession()});this.JsSIP=e,this.sessionEvents=new we(ve),this.uaEvents=new we(ut),this.onSession(w,this.handleShareState),this.onSession(Me,this.handleNewInfo),this.on(te,this.handleSipEvent),this.onSession(A,this.handleEnded),this.onSession(M,this.handleEnded)}get connection(){var t;return(t=this.rtcSession)==null?void 0:t.connection}get remoteCallerData(){var e,t,n;return{displayName:(e=this.incomingRTCSession)==null?void 0:e.remote_identity.display_name,host:(t=this.incomingRTCSession)==null?void 0:t.remote_identity.uri.host,incomingNumber:(n=this.incomingRTCSession)==null?void 0:n.remote_identity.uri.user,rtcSession:this.incomingRTCSession}}get requested(){return this.isPendingInitUa||this.isPendingConnect||this.isPendingCall||this.isPendingAnswer}get establishedRTCSession(){var e;return((e=this.rtcSession)==null?void 0:e.isEstablished())===!0?this.rtcSession:void 0}get isRegistered(){return!!this.ua&&this.ua.isRegistered()}get isRegisterConfig(){return!!this.ua&&this.isRegisterConfigInner}get isCallActive(){return!!(this.ua&&this.rtcSession)}get isAvailableIncomingCall(){return!!this.incomingRTCSession}get isPendingPresentation(){return!!this.promisePendingStartPresentation||!!this.promisePendingStopPresentation}async register(){return new Promise((e,t)=>{this.isRegisterConfig&&this.ua?(this.ua.on(O,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:d}=this.createUaConfiguration({sipWebSocketServerURL:i,displayName:t,userAgent:e,sipServerUrl:n}),T=this.createUa({...d,remoteAddress:o,extraHeaders:a}),l=()=>{const u=new Error("Telephony is not available");E(u)};T.once(C,l);const S=()=>{T.removeAllListeners(),T.once(C,c),T.stop()};T.once(P,S),T.start()})}async replaceMediaStream(e,t){if(!this.rtcSession)throw new Error("No rtcSession established");const{contentHint:n}=t??{},i=p(e,{contentHint:n});if(i===void 0)throw new Error("No preparedMediaStream");return this.rtcSession.replaceMediaStream(i,t)}async askPermissionToEnableCam(e={}){if(!this.rtcSession)throw new Error("No rtcSession established");const t=[Bn];return this.rtcSession.sendInfo(Ue,void 0,{noTerminateWhenError:!0,...e,extraHeaders:t}).catch(n=>{if(qn(n))throw n})}async startPresentation(e,{isNeedReinvite:t,isP2P:n,maxBitrate:i,contentHint:o,sendEncodings:a,onAddedTransceiver:c}={},E){const d=this.establishedRTCSession;if(!d)throw new Error("No rtcSession established");if(this.streamPresentationCurrent)throw new Error("Presentation is already started");return n===!0&&await this.sendMustStopPresentation(),this.sendPresentationWithDuplicatedCalls({rtcSession:d,stream:e,presentationOptions:{isNeedReinvite:t,isP2P:n,maxBitrate:i,contentHint:o,sendEncodings:a,onAddedTransceiver:c},options:E})}async stopPresentation({isP2P:e=!1}={}){this.cancelSendPresentationWithRepeatedCalls();const t=this.streamPresentationCurrent;let n=this.promisePendingStartPresentation??Promise.resolve(void 0);const i=e?[Wn]:[Un],o=this.establishedRTCSession;return o&&t&&(n=n.then(async()=>o.sendInfo(D,void 0,{extraHeaders:i})).then(async()=>o.stopPresentation(t)).catch(a=>{throw this.sessionEvents.trigger(W,a),a})),!o&&t&&this.sessionEvents.trigger(De,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})}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 dn(t)?this.generateStreams(t):this.generateAudioStreams(t)}getIncomingRTCSession(){const{incomingRTCSession:e}=this;if(!e)throw new Error("No incomingRTCSession");return e}cancelSendPresentationWithRepeatedCalls(){var e;(e=this.cancelableSendPresentationWithRepeatedCalls)==null||e.cancel()}async waitChannels(){return this.waitSession(b)}async waitSyncMediaState(){return this.waitSession(U)}async sendChannels({inputChannels:e,outputChannels:t}){if(!this.rtcSession)throw new Error("No rtcSession established");const n=`${Le}: ${e}`,i=`${He}: ${t}`,o=[n,i];return this.rtcSession.sendInfo(un,void 0,{extraHeaders:o})}async sendMediaState({cam:e,mic:t},n={}){if(!this.rtcSession)throw new Error("No rtcSession established");const i=`${On}: currentstate`,o=`${Mn}: ${Number(e)}`,a=`${Dn}: ${Number(t)}`,c=[i,o,a];return this.rtcSession.sendInfo(gn,void 0,{noTerminateWhenError:!0,...n,extraHeaders:c})}async sendRefusalToTurnOn(e,t={}){if(!this.rtcSession)throw new Error("No rtcSession established");const c=[`${mn}: ${e==="mic"?0:1}`];return this.rtcSession.sendInfo(Cn,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})}async sendMustStopPresentation(){const e=this.establishedRTCSession;if(!e)throw new Error("No rtcSession established");await e.sendInfo(D,void 0,{extraHeaders:[Ln]})}async sendPresentationWithDuplicatedCalls({rtcSession:e,stream:t,presentationOptions:n,options:i={callLimit:zn}}){const o=async()=>this.sendPresentation(e,t,n),a=()=>!!this.streamPresentationCurrent;return this.cancelableSendPresentationWithRepeatedCalls=G.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.uri.toString()===t.uri&&n.display_name===t.display_name&&n.user_agent===t.user_agent&&n.sockets===t.sockets&&n.session_timers===t.session_timers&&n.register_expires===t.register_expires&&n.connection_recovery_min_interval===t.connection_recovery_min_interval&&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:d=2,connectionRecoveryMaxInterval:T=6,userAgent:l}){if(a&&(t===void 0||t===""))throw new Error("password is required for authorized connection");const S=a&&e!==void 0&&e.trim()!==""?e.trim():`${En()}`,u=an(o),h=u(S),g=new this.JsSIP.WebSocketInterface(n);return{configuration:{password:t,register:a,uri:h,display_name:be(i),user_agent:l,sdp_semantics:"unified-plan",sockets:[g],session_timers:c,register_expires:E,connection_recovery_min_interval:d,connection_recovery_max_interval:T},helpers:{socket:g,getSipServerUrl:u}}}async sendPresentation(e,t,{maxBitrate:n=St,isNeedReinvite:i=!0,isP2P:o=!1,contentHint:a="detail",sendEncodings:c,onAddedTransceiver:E}){const d=p(t,{contentHint:a});if(d===void 0)throw new Error("No streamPresentationCurrent");this.streamPresentationCurrent=d;const T=o?[Hn]:[bn],l=e.sendInfo(D,void 0,{extraHeaders:T}).then(async()=>e.startPresentation(d,i,{sendEncodings:c,onAddedTransceiver:E})).then(async()=>{const{connection:S}=this;if(!S)return;const u=S.getSenders();await Gn(u,t,n)}).then(()=>t).catch(S=>{throw this.removeStreamPresentationCurrent(),this.sessionEvents.trigger(W,S),S});return this.promisePendingStartPresentation=l,l.finally(()=>{this.promisePendingStartPresentation=void 0})}removeStreamPresentationCurrent(){delete this.streamPresentationCurrent}resetPresentation(){this.removeStreamPresentationCurrent(),this.promisePendingStartPresentation=void 0,this.promisePendingStopPresentation=void 0}cancelRequestsAndResetPresentation(){this.cancelSendPresentationWithRepeatedCalls(),this.resetPresentation()}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==null?void 0: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.cancelConnectWithRepeatedCalls()}cancelConnectWithRepeatedCalls(){var e;(e=this.cancelableConnectWithRepeatedCalls)==null||e.cancel()}}exports.BAD_MEDIA_DESCRIPTION=xe;exports.EEventsMainCAM=R;exports.EEventsMic=k;exports.EEventsSyncMediaState=B;exports.EMimeTypesVideoCodecs=At;exports.EUseLicense=Nt;exports.NOT_FOUND=Be;exports.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS=V;exports.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS=x;exports.REJECTED=X;exports.SESSION_EVENT_NAMES=ve;exports.SipConnector=hs;exports.UA_JSSIP_EVENT_NAMES=Y;exports.causes=$t;exports.constants=Gt;exports.disableDebug=Qt;exports.enableDebug=Xt;exports.eventNames=Jt;exports.hasCanceledCallError=Kn;exports.hasCanceledStartPresentationError=Zn;exports.logger=v;exports.setEncodingsToSender=Rt;exports.setParametersToSender=_t;
@@ -1,235 +0,0 @@
1
- import { RTCSession, RegisteredEvent, UA, URI, UnRegisteredEvent, WebSocketInterface } from '@krivega/jssip';
2
- import { TEventSession, TEventUA } from './eventNames';
3
- import { TContentHint, TJsSIP, TOnAddedTransceiver } from './types';
4
- export declare const hasCanceledCallError: (error: unknown) => boolean;
5
- export declare const hasCanceledStartPresentationError: (error: unknown) => error is import('node_modules/repeated-calls/dist/utils').TCanceledError<unknown>;
6
- type TChannels = {
7
- inputChannels: string;
8
- outputChannels: string;
9
- };
10
- type TMediaState = {
11
- cam: boolean;
12
- mic: boolean;
13
- };
14
- type TOptionsInfoMediaState = {
15
- noTerminateWhenError?: boolean;
16
- };
17
- type TOptionsExtraHeaders = {
18
- extraHeaders?: string[];
19
- };
20
- type TOntrack = (track: RTCTrackEvent) => void;
21
- type TParametersConnection = TOptionsExtraHeaders & {
22
- displayName?: string;
23
- user?: string;
24
- password?: string;
25
- register?: boolean;
26
- sipServerUrl: string;
27
- sipWebSocketServerURL: string;
28
- remoteAddress?: string;
29
- sessionTimers?: boolean;
30
- registerExpires?: number;
31
- connectionRecoveryMinInterval?: number;
32
- connectionRecoveryMaxInterval?: number;
33
- userAgent?: string;
34
- };
35
- type TParametersCheckTelephony = {
36
- displayName: string;
37
- sipServerUrl: string;
38
- sipWebSocketServerURL: string;
39
- userAgent?: string;
40
- remoteAddress?: string;
41
- extraHeaders?: string[];
42
- };
43
- type TConnect = (parameters: TParametersConnection, options?: {
44
- callLimit?: number;
45
- }) => Promise<UA>;
46
- type TSet = ({ displayName, password, }: {
47
- displayName?: string;
48
- password?: string;
49
- }) => Promise<boolean>;
50
- type TParametersAnswerToIncomingCall = {
51
- mediaStream: MediaStream;
52
- extraHeaders?: TOptionsExtraHeaders['extraHeaders'];
53
- ontrack?: TOntrack;
54
- iceServers?: RTCIceServer[];
55
- directionVideo?: RTCRtpTransceiverDirection;
56
- directionAudio?: RTCRtpTransceiverDirection;
57
- contentHint?: TContentHint;
58
- sendEncodings?: RTCRtpEncodingParameters[];
59
- offerToReceiveAudio?: boolean;
60
- offerToReceiveVideo?: boolean;
61
- onAddedTransceiver?: TOnAddedTransceiver;
62
- };
63
- type TParametersCall = TParametersAnswerToIncomingCall & {
64
- number: string;
65
- };
66
- type TCall = (parameters: TParametersCall) => Promise<RTCPeerConnection>;
67
- type TAnswerToIncomingCall = (parameters: TParametersAnswerToIncomingCall) => Promise<RTCPeerConnection>;
68
- type TSendDTMF = (tone: number | string) => Promise<void>;
69
- type THangUp = () => Promise<void>;
70
- export default class SipConnector {
71
- promisePendingStartPresentation?: Promise<MediaStream>;
72
- promisePendingStopPresentation?: Promise<MediaStream | undefined>;
73
- ua?: UA;
74
- rtcSession?: RTCSession;
75
- incomingRTCSession?: RTCSession;
76
- streamPresentationCurrent?: MediaStream;
77
- socket?: WebSocketInterface;
78
- private isRegisterConfigInner;
79
- private connectionConfiguration;
80
- private remoteStreams;
81
- private readonly JsSIP;
82
- private readonly sessionEvents;
83
- private readonly uaEvents;
84
- private cancelableConnectWithRepeatedCalls;
85
- private cancelableSendPresentationWithRepeatedCalls;
86
- private isPendingConnect;
87
- private isPendingInitUa;
88
- private isPendingCall;
89
- private isPendingAnswer;
90
- constructor({ JsSIP }: {
91
- JsSIP: TJsSIP;
92
- });
93
- get connection(): RTCPeerConnection | undefined;
94
- get remoteCallerData(): {
95
- displayName: string | undefined;
96
- host: string | undefined;
97
- incomingNumber: string | undefined;
98
- rtcSession: RTCSession | undefined;
99
- };
100
- get requested(): boolean;
101
- get establishedRTCSession(): RTCSession | undefined;
102
- get isRegistered(): boolean;
103
- get isRegisterConfig(): boolean;
104
- get isCallActive(): boolean;
105
- get isAvailableIncomingCall(): boolean;
106
- get isPendingPresentation(): boolean;
107
- connect: TConnect;
108
- hangUp: THangUp;
109
- register(): Promise<RegisteredEvent>;
110
- unregister(): Promise<UnRegisteredEvent>;
111
- readonly tryRegister: () => Promise<RegisteredEvent>;
112
- sendOptions(target: URI | string, body?: string, extraHeaders?: string[]): Promise<void>;
113
- ping(body?: string, extraHeaders?: string[]): Promise<void>;
114
- checkTelephony({ userAgent, displayName, sipServerUrl, sipWebSocketServerURL, remoteAddress, extraHeaders, }: TParametersCheckTelephony): Promise<void>;
115
- replaceMediaStream(mediaStream: MediaStream, options?: {
116
- deleteExisting?: boolean;
117
- addMissing?: boolean;
118
- forceRenegotiation?: boolean;
119
- contentHint?: TContentHint;
120
- sendEncodings?: RTCRtpEncodingParameters[];
121
- onAddedTransceiver?: TOnAddedTransceiver;
122
- }): Promise<void>;
123
- declineToIncomingCall: ({ statusCode, }?: {
124
- statusCode?: number;
125
- }) => Promise<void>;
126
- busyIncomingCall: () => Promise<void>;
127
- askPermissionToEnableCam(options?: TOptionsInfoMediaState): Promise<void>;
128
- startPresentation(stream: MediaStream, { isNeedReinvite, isP2P, maxBitrate, contentHint, sendEncodings, onAddedTransceiver, }?: {
129
- isNeedReinvite?: boolean;
130
- isP2P?: boolean;
131
- maxBitrate?: number;
132
- contentHint?: TContentHint;
133
- sendEncodings?: RTCRtpEncodingParameters[];
134
- onAddedTransceiver?: TOnAddedTransceiver;
135
- }, options?: {
136
- callLimit: number;
137
- }): Promise<MediaStream>;
138
- stopPresentation({ isP2P, }?: {
139
- isP2P?: boolean;
140
- }): Promise<MediaStream | undefined>;
141
- updatePresentation(stream: MediaStream, { isP2P, maxBitrate, contentHint, sendEncodings, onAddedTransceiver, }?: {
142
- isP2P?: boolean;
143
- maxBitrate?: number;
144
- contentHint?: TContentHint;
145
- sendEncodings?: RTCRtpEncodingParameters[];
146
- onAddedTransceiver?: TOnAddedTransceiver;
147
- }): Promise<MediaStream | undefined>;
148
- on<T>(eventName: TEventUA, handler: (data: T) => void): () => void;
149
- once<T>(eventName: TEventUA, handler: (data: T) => void): () => void;
150
- onceRace<T>(eventNames: TEventUA[], handler: (data: T, eventName: string) => void): () => void;
151
- wait<T>(eventName: TEventUA): Promise<T>;
152
- off<T>(eventName: TEventUA, handler: (data: T) => void): void;
153
- onSession<T>(eventName: TEventSession, handler: (data: T) => void): () => void;
154
- onceSession<T>(eventName: TEventSession, handler: (data: T) => void): () => void;
155
- onceRaceSession<T>(eventNames: TEventSession[], handler: (data: T, eventName: string) => void): () => void;
156
- waitSession<T>(eventName: TEventSession): Promise<T>;
157
- offSession<T>(eventName: TEventSession, handler: (data: T) => void): void;
158
- isConfigured(): boolean;
159
- getConnectionConfiguration(): {
160
- sipServerUrl?: string;
161
- displayName?: string;
162
- register?: boolean;
163
- user?: string;
164
- password?: string;
165
- number?: string;
166
- answer?: boolean;
167
- };
168
- getRemoteStreams(): MediaStream[] | undefined;
169
- getIncomingRTCSession(): RTCSession;
170
- set: TSet;
171
- disconnect: () => Promise<void>;
172
- call: TCall;
173
- answerToIncomingCall: TAnswerToIncomingCall;
174
- sendDTMF: TSendDTMF;
175
- cancelSendPresentationWithRepeatedCalls(): void;
176
- waitChannels(): Promise<TChannels>;
177
- waitSyncMediaState(): Promise<{
178
- isSyncForced: boolean;
179
- }>;
180
- sendChannels({ inputChannels, outputChannels }: TChannels): Promise<void>;
181
- sendMediaState({ cam, mic }: TMediaState, options?: TOptionsInfoMediaState): Promise<void>;
182
- sendRefusalToTurnOn(type: 'cam' | 'mic', options?: TOptionsInfoMediaState): Promise<void>;
183
- sendRefusalToTurnOnMic(options?: TOptionsInfoMediaState): Promise<void>;
184
- sendRefusalToTurnOnCam(options?: TOptionsInfoMediaState): Promise<void>;
185
- private readonly removeIncomingSession;
186
- private getSipServerUrl;
187
- private sendMustStopPresentation;
188
- private readonly connectWithDuplicatedCalls;
189
- private sendPresentationWithDuplicatedCalls;
190
- private hasEqualConnectionConfiguration;
191
- private createUaConfiguration;
192
- private sendPresentation;
193
- private removeStreamPresentationCurrent;
194
- private resetPresentation;
195
- private cancelRequestsAndResetPresentation;
196
- private readonly handleNewRTCSession;
197
- private readonly connectInner;
198
- private readonly initUa;
199
- private readonly createUa;
200
- private readonly start;
201
- private readonly handleCall;
202
- private readonly restoreSession;
203
- private generateStream;
204
- private generateAudioStream;
205
- private generateStreams;
206
- private generateAudioStreams;
207
- private readonly hangUpWithoutCancelRequests;
208
- private cancelRequests;
209
- private cancelConnectWithRepeatedCalls;
210
- private readonly handleShareState;
211
- private readonly maybeTriggerChannels;
212
- private readonly handleNotify;
213
- private readonly triggerRemovedFromListModeratorsNotify;
214
- private readonly triggerAddedToListModeratorsNotify;
215
- private readonly triggerWebcastStartedNotify;
216
- private readonly triggerWebcastStoppedNotify;
217
- private readonly triggerAccountChangedNotify;
218
- private readonly triggerAccountDeletedNotify;
219
- private readonly triggerConferenceParticipantTokenIssued;
220
- private readonly triggerChannelsNotify;
221
- private readonly triggerParticipationAcceptingWordRequest;
222
- private readonly triggerParticipationCancellingWordRequest;
223
- private readonly triggerParticipantMoveRequestToStream;
224
- private readonly triggerEnterRoom;
225
- private readonly triggerShareState;
226
- private readonly maybeTriggerParticipantMoveRequest;
227
- private readonly triggerMainCamControl;
228
- private readonly triggerMicControl;
229
- private readonly triggerUseLicense;
230
- private readonly handleNewInfo;
231
- private readonly handleSipEvent;
232
- private readonly maybeHandleNotify;
233
- private readonly handleEnded;
234
- }
235
- export {};
@@ -1,23 +0,0 @@
1
- export declare const CONNECTION_ERROR = "Connection Error";
2
- export declare const REQUEST_TIMEOUT = "Request Timeout";
3
- export declare const SIP_FAILURE_CODE = "SIP Failure Code";
4
- export declare const INTERNAL_ERROR = "Internal Error";
5
- export declare const BUSY = "Busy";
6
- export declare const REJECTED = "Rejected";
7
- export declare const REDIRECTED = "Redirected";
8
- export declare const UNAVAILABLE = "Unavailable";
9
- export declare const NOT_FOUND = "Not Found";
10
- export declare const ADDRESS_INCOMPLETE = "Address Incomplete";
11
- export declare const INCOMPATIBLE_SDP = "Incompatible SDP";
12
- export declare const MISSING_SDP = "Missing SDP";
13
- export declare const AUTHENTICATION_ERROR = "Authentication Error";
14
- export declare const BYE = "Terminated";
15
- export declare const WEBRTC_ERROR = "WebRTC Error";
16
- export declare const CANCELED = "Canceled";
17
- export declare const NO_ANSWER = "No Answer";
18
- export declare const EXPIRES = "Expires";
19
- export declare const NO_ACK = "No ACK";
20
- export declare const DIALOG_ERROR = "Dialog Error";
21
- export declare const USER_DENIED_MEDIA_ACCESS = "User Denied Media Access";
22
- export declare const BAD_MEDIA_DESCRIPTION = "Bad Media Description";
23
- export declare const RTP_TIMEOUT = "RTP Timeout";
@@ -1,37 +0,0 @@
1
- export declare const HEADER_CONTENT_TYPE_NAME = "content-type";
2
- export declare const HEADER_CONTENT_ENTER_ROOM = "x-webrtc-enter-room";
3
- export declare const CONTENT_TYPE_SHARE_STATE = "application/vinteo.webrtc.sharedesktop";
4
- export declare const CONTENT_TYPE_ENTER_ROOM = "application/vinteo.webrtc.roomname";
5
- export declare const CONTENT_TYPE_CHANNELS = "application/vinteo.webrtc.channels";
6
- export declare const CONTENT_TYPE_MEDIA_STATE = "application/vinteo.webrtc.mediastate";
7
- export declare const CONTENT_TYPE_REFUSAL = "application/vinteo.webrtc.refusal";
8
- export declare const CONTENT_TYPE_MAIN_CAM = "application/vinteo.webrtc.maincam";
9
- export declare const CONTENT_TYPE_MIC = "application/vinteo.webrtc.mic";
10
- export declare const CONTENT_TYPE_USE_LICENSE = "application/vinteo.webrtc.uselic";
11
- export declare const HEADER_CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE";
12
- export declare const HEADER_PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME";
13
- export declare const HEADER_INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS";
14
- export declare const HEADER_OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS";
15
- export declare const HEADER_MAIN_CAM = "X-WEBRTC-MAINCAM";
16
- export declare const HEADER_MIC = "X-WEBRTC-MIC";
17
- export declare const HEADER_MEDIA_SYNC = "X-WEBRTC-SYNC";
18
- export declare const HEADER_MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION";
19
- export declare const HEADER_MEDIA_STATE = "X-WEBRTC-MEDIA-STATE";
20
- export declare const HEADER_MEDIA_TYPE = "X-Vinteo-Media-Type";
21
- export declare const HEADER_MAIN_CAM_STATE = "X-Vinteo-MainCam-State";
22
- export declare const HEADER_MIC_STATE = "X-Vinteo-Mic-State";
23
- export declare const CONTENT_TYPE_PARTICIPANT_STATE = "application/vinteo.webrtc.partstate";
24
- export declare const HEADER_CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE";
25
- export declare const CONTENT_TYPE_NOTIFY = "application/vinteo.webrtc.notify";
26
- export declare const HEADER_NOTIFY = "X-VINTEO-NOTIFY";
27
- export declare const HEADER_CONTENT_SHARE_STATE = "x-webrtc-share-state";
28
- export declare const HEADER_START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION";
29
- export declare const HEADER_STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION";
30
- export declare const AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT";
31
- export declare const NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND";
32
- export declare const MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT";
33
- export declare const HEADER_MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT";
34
- export declare const HEADER_START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT";
35
- export declare const HEADER_STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND";
36
- export declare const HEADER_CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE";
37
- export declare const HEADER_ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM";
@@ -1,11 +0,0 @@
1
- export * as causes from './causes';
2
- export * as constants from './constants';
3
- export * as eventNames from './eventNames';
4
- export { debug, disableDebug, enableDebug } from './logger';
5
- export { default as setParametersToSender } from './setParametersToSender';
6
- export * as tools from './tools';
7
- export * from './types';
8
- export { default as getCodecFromSender } from './utils/getCodecFromSender';
9
- export { default as resolveVideoSendingBalancer } from './videoSendingBalancer';
10
- export { hasCanceledCallError, hasCanceledStartPresentationError, default as SipConnector, } from './SipConnector';
11
- export { SipConnectorFacade } from './SipConnectorFacade';
@@ -1,69 +0,0 @@
1
- import { UA, WebSocketInterface } from '@krivega/jssip';
2
- import { Originator } from './constants';
3
- export declare enum EEventsMainCAM {
4
- PAUSE_MAIN_CAM = "PAUSEMAINCAM",
5
- RESUME_MAIN_CAM = "RESUMEMAINCAM",
6
- MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION",
7
- ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM",
8
- ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM"
9
- }
10
- export declare enum EEventsMic {
11
- ADMIN_STOP_MIC = "ADMINSTOPMIC",
12
- ADMIN_START_MIC = "ADMINSTARTMIC"
13
- }
14
- export declare enum EEventsSyncMediaState {
15
- ADMIN_SYNC_FORCED = "1",
16
- ADMIN_SYNC_NOT_FORCED = "0"
17
- }
18
- export declare enum EUseLicense {
19
- AUDIO = "AUDIO",
20
- VIDEO = "VIDEO",
21
- AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION"
22
- }
23
- export type TCustomError = Error & {
24
- originator?: Originator;
25
- cause?: unknown;
26
- message: unknown;
27
- _ws?: unknown;
28
- socket?: unknown;
29
- url?: string;
30
- code?: string;
31
- };
32
- export type TJsSIP = {
33
- UA: typeof UA;
34
- WebSocketInterface: typeof WebSocketInterface;
35
- };
36
- export type TGetServerUrl = (id: string) => string;
37
- export type TParametersCreateUaConfiguration = {
38
- sipWebSocketServerURL: string;
39
- displayName?: string;
40
- sipServerUrl: string;
41
- user?: string;
42
- register?: boolean;
43
- password?: string;
44
- sessionTimers?: boolean;
45
- registerExpires?: number;
46
- connectionRecoveryMinInterval?: number;
47
- connectionRecoveryMaxInterval?: number;
48
- userAgent?: string;
49
- };
50
- export type TOnAddedTransceiver = (transceiver: RTCRtpTransceiver, track: MediaStreamTrack, stream: MediaStream) => Promise<void>;
51
- export type TContentHint = 'motion' | 'detail' | 'text' | 'none';
52
- export type TRtpSendParameters = Partial<Omit<RTCRtpSendParameters, 'transactionId'>>;
53
- export type TSize = {
54
- width: number;
55
- height: number;
56
- };
57
- export type TSimulcastEncoding = TSize & {
58
- rid?: string;
59
- scalabilityMode?: string;
60
- };
61
- export declare enum EMimeTypesVideoCodecs {
62
- VP8 = "video/VP8",
63
- VP9 = "video/VP9",
64
- H264 = "video/H264",
65
- AV1 = "video/AV1",
66
- rtx = "video/rtx",
67
- red = "video/red",
68
- flexfec03 = "video/flexfec-03"
69
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes