sip-connector 7.0.10 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SipConnector-3gRIidBJ.js → SipConnector-4t573yj1.js} +389 -394
- package/dist/SipConnector-zjYmhYTk.cjs +1 -0
- package/dist/SipConnector.d.ts +1 -3
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +33 -35
- package/dist/tools/__fixtures__/connectToServer.d.ts +0 -10
- package/dist/tools/connectToServer.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
- package/dist/SipConnector-3pnvrFP5.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var mt=Object.defineProperty;var ft=(r,e,t)=>e in r?mt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>ft(r,typeof e!="symbol"?e+"":e,t);const N=require("@krivega/cancelable-promise"),Me=require("events-constructor"),Ot=require("repeated-calls"),B=require("debug"),pt="Connection Error",He="Request Timeout",Dt="SIP Failure Code",Pt="Internal Error",Mt="Busy",V="Rejected",vt="Redirected",bt="Unavailable",qe="Not Found",yt="Address Incomplete",wt="Incompatible SDP",Ut="Missing SDP",Lt="Authentication Error",We="Terminated",Ht="WebRTC Error",ke="Canceled",qt="No Answer",Wt="Expires",kt="No ACK",Ft="Dialog Error",Bt="User Denied Media Access",Fe="Bad Media Description",Vt="RTP Timeout",Yt=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_INCOMPLETE:yt,AUTHENTICATION_ERROR:Lt,BAD_MEDIA_DESCRIPTION:Fe,BUSY:Mt,BYE:We,CANCELED:ke,CONNECTION_ERROR:pt,DIALOG_ERROR:Ft,EXPIRES:Wt,INCOMPATIBLE_SDP:wt,INTERNAL_ERROR:Pt,MISSING_SDP:Ut,NOT_FOUND:qe,NO_ACK:kt,NO_ANSWER:qt,REDIRECTED:vt,REJECTED:V,REQUEST_TIMEOUT:He,RTP_TIMEOUT:Vt,SIP_FAILURE_CODE:Dt,UNAVAILABLE:bt,USER_DENIED_MEDIA_ACCESS:Bt,WEBRTC_ERROR:Ht},Symbol.toStringTag,{value:"Module"})),Y="incomingCall",x="declinedIncomingCall",G="failedIncomingCall",$="terminatedIncomingCall",q="connecting",m="connected",u="disconnected",P="newRTCSession",f="registered",X="unregistered",O="registrationFailed",Be="newMessage",J="sipEvent",z="availableSecondRemoteStream",Q="notAvailableSecondRemoteStream",K="mustStopPresentation",M="shareState",j="enterRoom",Z="useLicense",ee="peerconnection:confirmed",te="peerconnection:ontrack",v="channels",ne="channels:notify",se="ended:fromserver",ie="main-cam-control",re="admin-stop-main-cam",oe="admin-start-main-cam",ae="admin-stop-mic",ce="admin-start-mic",b="admin-force-sync-media-state",Ee="participant:added-to-list-moderators",_e="participant:removed-from-list-moderators",he="participant:move-request-to-stream",le="participant:move-request-to-spectators",de="participation:accepting-word-request",Te="participation:cancelling-word-request",ue="webcast:started",Se="webcast:stopped",Ne="account:changed",Ce="account:deleted",ge="conference:participant-token-issued",p="ended",Ve="sending",Ye="reinvite",xe="replaces",Ge="refer",$e="progress",Xe="accepted",y="confirmed",w="peerconnection",A="failed",Je="muted",ze="unmuted",Ae="newDTMF",Re="newInfo",Qe="hold",Ke="unhold",je="update",Ze="sdp",et="icecandidate",tt="getusermediafailed",nt="peerconnection:createofferfailed",st="peerconnection:createanswerfailed",it="peerconnection:setlocaldescriptionfailed",rt="peerconnection:setremotedescriptionfailed",ot="presentation:start",at="presentation:started",ct="presentation:end",Ie="presentation:ended",U="presentation:failed",Et="SPECTATOR",xt=Object.freeze(Object.defineProperty({__proto__:null,ACCEPTED:Xe,ACCOUNT_CHANGED:Ne,ACCOUNT_DELETED:Ce,ADMIN_FORCE_SYNC_MEDIA_STATE:b,ADMIN_START_MAIN_CAM:oe,ADMIN_START_MIC:ce,ADMIN_STOP_MAIN_CAM:re,ADMIN_STOP_MIC:ae,AVAILABLE_SECOND_REMOTE_STREAM_EVENT:z,CHANNELS:v,CHANNELS_NOTIFY:ne,CONFERENCE_PARTICIPANT_TOKEN_ISSUED:ge,CONFIRMED:y,CONNECTED:m,CONNECTING:q,DECLINED_INCOMING_CALL:x,DISCONNECTED:u,ENDED:p,ENDED_FROM_SERVER:se,ENTER_ROOM:j,FAILED:A,FAILED_INCOMING_CALL:G,GET_USER_MEDIA_FAILED:tt,HOLD:Qe,ICE_CANDIDATE:et,INCOMING_CALL:Y,MAIN_CAM_CONTROL:ie,MUST_STOP_PRESENTATION_EVENT:K,MUTED:Je,NEW_DTMF:Ae,NEW_INFO:Re,NEW_MESSAGE:Be,NEW_RTC_SESSION:P,NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:Q,PARTICIPANT_ADDED_TO_LIST_MODERATORS:Ee,PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:le,PARTICIPANT_MOVE_REQUEST_TO_STREAM:he,PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:_e,PARTICIPATION_ACCEPTING_WORD_REQUEST:de,PARTICIPATION_CANCELLING_WORD_REQUEST:Te,PEER_CONNECTION:w,PEER_CONNECTION_CONFIRMED:ee,PEER_CONNECTION_CREATE_ANSWER_FAILED:st,PEER_CONNECTION_CREATE_OFFER_FAILED:nt,PEER_CONNECTION_ONTRACK:te,PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:it,PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:rt,PRESENTATION_END:ct,PRESENTATION_ENDED:Ie,PRESENTATION_FAILED:U,PRESENTATION_START:ot,PRESENTATION_STARTED:at,PROGRESS:$e,REFER:Ge,REGISTERED:f,REGISTRATION_FAILED:O,REINVITE:Ye,REPLACES:xe,SDP:Ze,SENDING:Ve,SHARE_STATE:M,SIP_EVENT:J,SPECTATOR:Et,TERMINATED_INCOMING_CALL:$,UNHOLD:Ke,UNMUTED:ze,UNREGISTERED:X,UPDATE:je,USE_LICENSE:Z,WEBCAST_STARTED:ue,WEBCAST_STOPPED:Se},Symbol.toStringTag,{value:"Module"})),_t=[Y,x,$,G,de,Te,he,ne,ge,Ne,Ce,ue,Se,Ee,_e],me=[q,m,u,P,f,X,O,Be,J],ht=[z,Q,K,M,j,Z,ee,te,v,se,ie,oe,re,ae,ce,b,le],fe=[p,q,Ve,Ye,xe,Ge,$e,Xe,y,w,A,Je,ze,Ae,Re,Qe,Ke,je,Ze,et,tt,nt,st,it,rt,ot,at,ct,Ie,U],Oe=[...me,..._t],pe=[...fe,...ht],Gt=Object.freeze(Object.defineProperty({__proto__:null,SESSION_EVENT_NAMES:pe,SESSION_JSSIP_EVENT_NAMES:fe,SESSION_SYNTHETICS_EVENT_NAMES:ht,UA_EVENT_NAMES:Oe,UA_JSSIP_EVENT_NAMES:me,UA_SYNTHETICS_EVENT_NAMES:_t},Symbol.toStringTag,{value:"Module"})),$t=r=>{const e=[];return r&&e.push(`X-Vinteo-Remote: ${r}`),e},Xt="content-type",Jt="x-webrtc-enter-room",D="application/vinteo.webrtc.sharedesktop",zt="application/vinteo.webrtc.roomname",Qt="application/vinteo.webrtc.channels",Kt="application/vinteo.webrtc.mediastate",jt="application/vinteo.webrtc.refusal",ve="application/vinteo.webrtc.maincam",Zt="application/vinteo.webrtc.mic",en="application/vinteo.webrtc.uselic",tn="X-WEBRTC-USE-LICENSE",nn="X-WEBRTC-PARTICIPANT-NAME",be="X-WEBRTC-INPUT-CHANNELS",ye="X-WEBRTC-OUTPUT-CHANNELS",sn="X-WEBRTC-MAINCAM",rn="X-WEBRTC-MIC",we="X-WEBRTC-SYNC",on="X-WEBRTC-MAINCAM-RESOLUTION",an="X-WEBRTC-MEDIA-STATE",cn="X-Vinteo-Media-Type",En="X-Vinteo-MainCam-State",_n="X-Vinteo-Mic-State",hn="application/vinteo.webrtc.partstate",ln="X-WEBRTC-PARTSTATE",dn="application/vinteo.webrtc.notify",Tn="X-VINTEO-NOTIFY",I="x-webrtc-share-state",un=`${I}: LETMESTARTPRESENTATION`,Sn=`${I}: STOPPRESENTATION`,lt="YOUCANRECEIVECONTENT",dt="CONTENTEND",Tt="YOUMUSTSTOPSENDCONTENT",Nn=`${I}: ${Tt}`,Cn=`${I}: ${lt}`,gn=`${I}: ${dt}`,An="X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE",Rn=`${An}: LETMESTARTMAINCAM`,De="sip-connector",k=B(De),In=()=>{B.enable(De)},mn=()=>{B.enable(`-${De}`)};var R=(r=>(r.PAUSE_MAIN_CAM="PAUSEMAINCAM",r.RESUME_MAIN_CAM="RESUMEMAINCAM",r.MAX_MAIN_CAM_RESOLUTION="MAXMAINCAMRESOLUTION",r.ADMIN_STOP_MAIN_CAM="ADMINSTOPMAINCAM",r.ADMIN_START_MAIN_CAM="ADMINSTARTMAINCAM",r))(R||{}),L=(r=>(r.ADMIN_STOP_MIC="ADMINSTOPMIC",r.ADMIN_START_MIC="ADMINSTARTMIC",r))(L||{}),H=(r=>(r.ADMIN_SYNC_FORCED="1",r.ADMIN_SYNC_NOT_FORCED="0",r))(H||{}),ut=(r=>(r.AUDIO="AUDIO",r.VIDEO="VIDEO",r.AUDIOPLUSPRESENTATION="AUDIOPLUSPRESENTATION",r))(ut||{});function fn(r){return e=>`sip:${e}@${r}`}const On=(r,e)=>()=>Math.floor(Math.random()*(e-r))+r,Ue=r=>r.trim().replaceAll(" ","_"),pn=On(1e5,99999999),W=(r,{videoMode:e,audioMode:t}={})=>{if(!r||e==="recvonly"&&t==="recvonly")return;const n=t==="recvonly"?[]:r.getAudioTracks(),s=e==="recvonly"?[]:r.getVideoTracks(),o=[...n,...s],a=new MediaStream(o);return a.getTracks=()=>[...a.getAudioTracks(),...a.getVideoTracks()],a},Dn=r=>r.some(t=>{const{kind:n}=t;return n==="video"}),Pn="Error decline with 603",Mn=1006,vn=r=>typeof r=="object"&&r!==null&&"code"in r&&r.code===Mn,bn=r=>r.message===Pn,yn=(r,e)=>r.find(t=>t.track&&e.getTracks().includes(t.track)),St=1,Nt=r=>(e,t)=>t!==void 0&&e!==t||t===void 0&&e!==r,wn=Nt(St),Un=(r,e)=>{const t=r===void 0?void 0:Math.max(r,St);if(t!==void 0&&wn(t,e))return t},Ln=Nt(),Hn=(r,e)=>{if(Ln(r,e))return r},Ct=async(r,e,t)=>{const n=r.getParameters();(n.encodings===void 0||n.encodings.length===0)&&(n.encodings=[{}]);const[s]=n.encodings,o=s.scaleResolutionDownBy,a=Un(e.scaleResolutionDownBy,o);let c=!1;a!==void 0&&(n.encodings[0].scaleResolutionDownBy=a,c=!0);const E=s.maxBitrate,_=Hn(e.maxBitrate,E);return _!==void 0&&(n.encodings[0].maxBitrate=_,c=!0),c?(t&&t(n),r.setParameters(n).then(()=>({parameters:n,isChanged:c}))):{parameters:n,isChanged:c}},qn=async(r,e,t)=>{const n=yn(r,e);if(n)return Ct(n,{maxBitrate:t})},Wn=486,kn=487,F="local",Le="remote",Fn=3,Bn=(r=new Error)=>{const{originator:e,cause:t}=r;return N.isCanceledError(r)?!0:typeof t=="string"?t===He||t===V||e===F&&(t===ke||t===We):!1},g="SipConnector",Vn="channels",Yn="WebcastStarted",xn="WebcastStopped",Gn="accountChanged",$n="accountDeleted",Xn="addedToListModerators",Jn="removedFromListModerators",zn="ParticipationRequestAccepted",Qn="ParticipationRequestRejected",Kn="ParticipantMovedToWebcast",jn="ConferenceParticipantTokenIssued";class Zn{constructor({JsSIP:e}){i(this,"_isRegisterConfig",!1);i(this,"_connectionConfiguration",{});i(this,"_remoteStreams",{});i(this,"JsSIP");i(this,"_sessionEvents");i(this,"_uaEvents");i(this,"_cancelableConnect");i(this,"_cancelableConnectWithRepeatedCalls");i(this,"_cancelableInitUa");i(this,"_cancelableDisconnect");i(this,"_cancelableSet");i(this,"_cancelableCall");i(this,"_cancelableAnswer");i(this,"_cancelableSendDTMF");i(this,"getSipServerUrl",e=>e);i(this,"promisePendingStartPresentation");i(this,"promisePendingStopPresentation");i(this,"ua");i(this,"session");i(this,"incomingSession");i(this,"_streamPresentationCurrent");i(this,"socket");i(this,"connect",async(e,t)=>(this._cancelRequests(),this._connectWithDuplicatedCalls(e,t)));i(this,"initUa",async e=>this._cancelableInitUa.request(e));i(this,"set",async e=>this._cancelableSet.request(e));i(this,"call",async e=>this._cancelableCall.request(e));i(this,"disconnect",async()=>(this._cancelRequests(),this._disconnectWithoutCancelRequests()));i(this,"answerToIncomingCall",async e=>this._cancelableAnswer.request(e));i(this,"sendDTMF",async e=>this._cancelableSendDTMF.request(e));i(this,"hangUp",async()=>(this._cancelRequests(),this._hangUpWithoutCancelRequests()));i(this,"tryRegister",async()=>{if(!this.isRegisterConfig)throw new Error("Config is not registered");this._uaEvents.trigger(q,void 0);try{await this.unregister()}catch(e){k("tryRegister",e)}return this.register()});i(this,"declineToIncomingCall",async({statusCode:e=kn}={})=>new Promise((t,n)=>{if(!this.isAvailableIncomingCall){n(new Error("no incomingSession"));return}const s=this.incomingSession,o=this.remoteCallerData;this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this.removeIncomingSession(),this._uaEvents.trigger(x,o),t(s.terminate({status_code:e}))}));i(this,"busyIncomingCall",async()=>this.declineToIncomingCall({statusCode:Wn}));i(this,"removeIncomingSession",()=>{delete this.incomingSession});i(this,"_connectWithDuplicatedCalls",async(e,{callLimit:t=Fn}={})=>{let n=!0;const s=async()=>(n=!1,this._cancelableConnect.request(e)),o=a=>{var h;const c=!!((h=this.ua)!=null&&h.isConnected()),E=!n&&c&&this.hasEqualConnectionConfiguration(e),_=!!a&&!vn(a);return E||_};return this._cancelableConnectWithRepeatedCalls=Ot.repeatedCallsAsync({targetFunction:s,isComplete:o,callLimit:t,isRejectAsValid:!0,onAfterCancel:()=>{this._cancelableConnect.cancelRequest()}}),this._cancelableConnectWithRepeatedCalls.then(a=>{if(a instanceof this.JsSIP.UA)return a;throw a})});i(this,"handleNewRTCSession",({originator:e,session:t})=>{if(e===Le){this.incomingSession=t;const n=this.remoteCallerData;t.on(A,s=>{this.removeIncomingSession(),s.originator===F?this._uaEvents.trigger($,n):this._uaEvents.trigger(G,n)}),this._uaEvents.trigger(Y,n)}});i(this,"_connect",async e=>this.initUa(e).then(async()=>this._start()));i(this,"_initUa",async({user:e,password:t,sipServerUrl:n,sipWebSocketServerURL:s,remoteAddress:o,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:E,connectionRecoveryMaxInterval:_,userAgent:h,displayName:d="",register:l=!1,extraHeaders:T=[]})=>{if(!n)throw new Error("sipServerUrl is required");if(!s)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:d,register:l,user:e,password:t};const{configuration:S,helpers:C}=this.createUaConfiguration({user:e,sipServerUrl:n,sipWebSocketServerURL:s,password:t,displayName:d,register:l,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:E,connectionRecoveryMaxInterval:_,userAgent:h});this.getSipServerUrl=C.getSipServerUrl,this.socket=C.socket,this.ua&&await this._disconnectWithoutCancelRequests(),this._isRegisterConfig=!!l,this.ua=this._createUa(S),this._uaEvents.eachTriggers((At,Rt)=>{const Pe=me.find(It=>It===Rt);Pe&&this.ua&&this.ua.on(Pe,At)});const gt=[...$t(o),...T];return this.ua.registrator().setExtraHeaders(gt),this.ua});i(this,"_createUa",e=>new this.JsSIP.UA(e));i(this,"_start",async()=>new Promise((e,t)=>{const{ua:n}=this;if(!n){t(new Error("this.ua is not initialized"));return}const s=()=>{c(),e(n)},o=E=>{c(),t(E)},a=()=>{this.isRegisterConfig?(this.on(f,s),this.on(O,o)):this.on(m,s),this.on(u,o)},c=()=>{this.off(f,s),this.off(O,o),this.off(m,s),this.off(u,o)};a(),this.on(P,this.handleNewRTCSession),n.start()}));i(this,"_set",async({displayName:e,password:t})=>new Promise((n,s)=>{const{ua:o}=this;if(!o){s(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",Ue(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(_=>{s(_)}):E?n(E):s(new Error("nothing changed"))}));i(this,"_disconnectWithoutCancelRequests",async()=>this._cancelableDisconnect.request());i(this,"_disconnect",async()=>{this.off(P,this.handleNewRTCSession);const e=new Promise(t=>{this.once(u,()=>{delete this.ua,t()})});return this.ua?(await this._hangUpWithoutCancelRequests(),this.ua?this.ua.stop():this._uaEvents.trigger(u,void 0)):this._uaEvents.trigger(u,void 0),e});i(this,"_call",async({number:e,mediaStream:t,extraHeaders:n=[],ontrack:s,iceServers:o,videoMode:a,audioMode:c,degradationPreference:E,offerToReceiveAudio:_=!0,offerToReceiveVideo:h=!0})=>new Promise((d,l)=>{const{ua:T}=this;if(!T){l(new Error("this.ua is not initialized"));return}this._connectionConfiguration.number=e,this._connectionConfiguration.answer=!1,this._handleCall({ontrack:s}).then(d).catch(S=>{l(S)}),this.session=T.call(this.getSipServerUrl(e),{extraHeaders:n,mediaStream:W(t,{videoMode:a,audioMode:c}),eventHandlers:this._sessionEvents.triggers,videoMode:a,audioMode:c,degradationPreference:E,pcConfig:{iceServers:o},rtcOfferConstraints:{offerToReceiveAudio:_,offerToReceiveVideo:h}})}));i(this,"_answer",async({mediaStream:e,ontrack:t,extraHeaders:n=[],iceServers:s,videoMode:o,audioMode:a,degradationPreference:c})=>new Promise((E,_)=>{if(!this.isAvailableIncomingCall){_(new Error("no incomingSession"));return}this.session=this.incomingSession,this.removeIncomingSession();const{session:h}=this;if(!h){_(new Error("No session established"));return}this._sessionEvents.eachTriggers((l,T)=>{const S=fe.find(C=>C===T);S&&h.on(S,l)}),this._connectionConfiguration.answer=!0,this._connectionConfiguration.number=h.remote_identity.uri.user,this._handleCall({ontrack:t}).then(E).catch(l=>{_(l)});const d=W(e,{videoMode:o,audioMode:a});h.answer({extraHeaders:n,videoMode:o,audioMode:a,degradationPreference:c,mediaStream:d,pcConfig:{iceServers:s}})}));i(this,"_handleCall",async({ontrack:e})=>new Promise((t,n)=>{const s=()=>{this.onSession(w,h),this.onSession(y,d)},o=()=>{this.offSession(w,h),this.offSession(y,d)},a=()=>{this.onSession(A,E),this.onSession(p,E)},c=()=>{this.offSession(A,E),this.offSession(p,E)},E=l=>{o(),c(),n(l)};let _;const h=({peerconnection:l})=>{_=l,_.ontrack=T=>{this._sessionEvents.trigger(te,_),e&&e(T)}},d=()=>{_&&this._sessionEvents.trigger(ee,_),o(),c(),t(_)};s(),a()}));i(this,"_restoreSession",()=>{this._resetPresentation(),delete this._connectionConfiguration.number,delete this.session,this._remoteStreams={}});i(this,"_sendDTMF",async e=>new Promise((t,n)=>{const{session:s}=this;if(!s){n(new Error("No session established"));return}this.onceSession(Ae,({originator:o})=>{o===F&&t()}),s.sendDTMF(e,{duration:120,interToneGap:600})}));i(this,"_hangUpWithoutCancelRequests",async()=>{if(this.ua&&this.session){const{session:e}=this;if(this._streamPresentationCurrent&&await this.stopPresentation(),this._restoreSession(),!e.isEnded())return e.terminateAsync()}});i(this,"_handleShareState",e=>{switch(e){case lt:{this._sessionEvents.trigger(z,void 0);break}case dt:{this._sessionEvents.trigger(Q,void 0);break}case Tt:{this._sessionEvents.trigger(K,void 0);break}}});i(this,"_maybeTriggerChannels",e=>{const t=e.getHeader(be),n=e.getHeader(ye);if(t&&n){const s={inputChannels:t,outputChannels:n};this._sessionEvents.trigger(v,s)}});i(this,"_handleNotify",e=>{switch(e.cmd){case Vn:{const t=e;this._triggerChannelsNotify(t);break}case Yn:{const t=e;this._triggerWebcastStartedNotify(t);break}case xn:{const t=e;this._triggerWebcastStoppedNotify(t);break}case Xn:{const t=e;this._triggerAddedToListModeratorsNotify(t);break}case Jn:{const t=e;this._triggerRemovedFromListModeratorsNotify(t);break}case zn:{const t=e;this._triggerParticipationAcceptingWordRequest(t);break}case Qn:{const t=e;this._triggerParticipationCancellingWordRequest(t);break}case Kn:{const t=e;this._triggerParticipantMoveRequestToStream(t);break}case Gn:{this._triggerAccountChangedNotify();break}case $n:{this._triggerAccountDeletedNotify();break}case jn:{const t=e;this._triggerConferenceParticipantTokenIssued(t);break}default:k("unknown cmd",e.cmd)}});i(this,"_triggerRemovedFromListModeratorsNotify",({conference:e})=>{const t={conference:e};this._uaEvents.trigger(_e,t)});i(this,"_triggerAddedToListModeratorsNotify",({conference:e})=>{const t={conference:e};this._uaEvents.trigger(Ee,t)});i(this,"_triggerWebcastStartedNotify",({body:{conference:e,type:t}})=>{const n={conference:e,type:t};this._uaEvents.trigger(ue,n)});i(this,"_triggerWebcastStoppedNotify",({body:{conference:e,type:t}})=>{const n={conference:e,type:t};this._uaEvents.trigger(Se,n)});i(this,"_triggerAccountChangedNotify",()=>{this._uaEvents.trigger(Ne,void 0)});i(this,"_triggerAccountDeletedNotify",()=>{this._uaEvents.trigger(Ce,void 0)});i(this,"_triggerConferenceParticipantTokenIssued",({body:{conference:e,participant:t,jwt:n}})=>{const s={conference:e,participant:t,jwt:n};this._uaEvents.trigger(ge,s)});i(this,"_triggerChannelsNotify",e=>{const t=e.input,n=e.output,s={inputChannels:t,outputChannels:n};this._uaEvents.trigger(ne,s)});i(this,"_triggerParticipationAcceptingWordRequest",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(de,t)});i(this,"_triggerParticipationCancellingWordRequest",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(Te,t)});i(this,"_triggerParticipantMoveRequestToStream",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(he,t)});i(this,"_triggerEnterRoom",e=>{const t=e.getHeader(Jt),n=e.getHeader(nn);this._sessionEvents.trigger(j,{room:t,participantName:n})});i(this,"_triggerShareState",e=>{const t=e.getHeader(I);this._sessionEvents.trigger(M,t)});i(this,"_maybeTriggerParticipantMoveRequestToSpectators",e=>{e.getHeader(ln)===Et&&this._sessionEvents.trigger(le,void 0)});i(this,"_triggerMainCamControl",e=>{const t=e.getHeader(sn),n=e.getHeader(we),s=n===H.ADMIN_SYNC_FORCED;if(t===R.ADMIN_START_MAIN_CAM){this._sessionEvents.trigger(oe,{isSyncForced:s});return}if(t===R.ADMIN_STOP_MAIN_CAM){this._sessionEvents.trigger(re,{isSyncForced:s});return}(t===R.RESUME_MAIN_CAM||t===R.PAUSE_MAIN_CAM)&&n&&this._sessionEvents.trigger(b,{isSyncForced:s});const o=e.getHeader(on);this._sessionEvents.trigger(ie,{mainCam:t,resolutionMainCam:o})});i(this,"_triggerMicControl",e=>{const t=e.getHeader(rn),s=e.getHeader(we)===H.ADMIN_SYNC_FORCED;t===L.ADMIN_START_MIC?this._sessionEvents.trigger(ce,{isSyncForced:s}):t===L.ADMIN_STOP_MIC&&this._sessionEvents.trigger(ae,{isSyncForced:s})});i(this,"_triggerUseLicense",e=>{const t=e.getHeader(tn);this._sessionEvents.trigger(Z,t)});i(this,"_handleNewInfo",e=>{const{originator:t}=e;if(t!=="remote")return;const{request:n}=e,s=n.getHeader(Xt);if(s)switch(s){case zt:{this._triggerEnterRoom(n),this._maybeTriggerChannels(n);break}case dn:{this._maybeHandleNotify(n);break}case D:{this._triggerShareState(n);break}case ve:{this._triggerMainCamControl(n);break}case Zt:{this._triggerMicControl(n);break}case en:{this._triggerUseLicense(n);break}case hn:{this._maybeTriggerParticipantMoveRequestToSpectators(n);break}}});i(this,"_handleSipEvent",({request:e})=>{this._maybeHandleNotify(e)});i(this,"_maybeHandleNotify",e=>{const t=e.getHeader(Tn);if(t){const n=JSON.parse(t);this._handleNotify(n)}});i(this,"_handleEnded",e=>{const{originator:t}=e;t===Le&&this._sessionEvents.trigger(se,e),this._restoreSession()});this.JsSIP=e,this._sessionEvents=new Me(pe),this._uaEvents=new Me(Oe),this._cancelableConnect=new N.CancelableRequest(this._connect,{moduleName:g,afterCancelRequest:()=>{this._cancelableInitUa.cancelRequest(),this._cancelableDisconnect.cancelRequest()}}),this._cancelableInitUa=new N.CancelableRequest(this._initUa,{moduleName:g}),this._cancelableDisconnect=new N.CancelableRequest(this._disconnect,{moduleName:g}),this._cancelableSet=new N.CancelableRequest(this._set,{moduleName:g}),this._cancelableCall=new N.CancelableRequest(this._call,{moduleName:g}),this._cancelableAnswer=new N.CancelableRequest(this._answer,{moduleName:g}),this._cancelableSendDTMF=new N.CancelableRequest(this._sendDTMF,{moduleName:g}),this.onSession(M,this._handleShareState),this.onSession(Re,this._handleNewInfo),this.on(J,this._handleSipEvent),this.onSession(A,this._handleEnded),this.onSession(p,this._handleEnded)}async register(){return new Promise((e,t)=>{this.isRegisterConfig&&this.ua?(this.ua.on(f,e),this.ua.on(O,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(X,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((s,o)=>{try{this.ua.sendOptions(e,t,{extraHeaders:n,eventHandlers:{succeeded:()=>{s()},failed:o}})}catch(a){o(a)}})}async ping(e,t){var s;if(!((s=this.ua)!=null&&s.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:s}){return new Promise((o,a)=>{const{configuration:c}=this.createUaConfiguration({sipWebSocketServerURL:s,displayName:t,userAgent:e,sipServerUrl:n}),E=this._createUa(c),_=()=>{const d=new Error("Telephony is not available");a(d)};E.once(u,_);const h=()=>{E.removeAllListeners(),E.once(u,o),E.stop()};E.once(m,h),E.start()})}async replaceMediaStream(e,t){if(!this.session)throw new Error("No session established");return this.session.replaceMediaStream(e,t)}async askPermissionToEnableCam(e={}){if(!this.session)throw new Error("No session established");const t=[Rn];return this.session.sendInfo(ve,void 0,{noTerminateWhenError:!0,...e,extraHeaders:t}).catch(n=>{if(bn(n))throw n})}get isPendingPresentation(){return!!this.promisePendingStartPresentation||!!this.promisePendingStopPresentation}hasEqualConnectionConfiguration(e){var s;const{configuration:t}=this.createUaConfiguration(e),n=(s=this.ua)==null?void 0:s.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:s="",sipServerUrl:o,register:a=!1,sessionTimers:c=!1,registerExpires:E=60*5,connectionRecoveryMinInterval:_=2,connectionRecoveryMaxInterval:h=6,userAgent:d}){if(a&&!t)throw new Error("password is required for authorized connection");const l=a&&e?e.trim():`${pn()}`,T=fn(o),S=T(l),C=new this.JsSIP.WebSocketInterface(n);return{configuration:{password:t,register:a,uri:S,display_name:Ue(s),user_agent:d,sdp_semantics:"unified-plan",sockets:[C],session_timers:c,register_expires:E,connection_recovery_min_interval:_,connection_recovery_max_interval:h},helpers:{socket:C,getSipServerUrl:T}}}async _sendPresentation(e,t,{maxBitrate:n,degradationPreference:s,isNeedReinvite:o=!0,isP2P:a=!1}){const c=W(t);this._streamPresentationCurrent=c;const E=a?[Cn]:[un],_=e.sendInfo(D,void 0,{extraHeaders:E}).then(async()=>e.startPresentation(c,o,s)).then(async()=>{const{connection:h}=this;if(!h||n===void 0)return;const d=h.getSenders();await qn(d,t,n)}).then(()=>t).catch(h=>{throw this._sessionEvents.trigger(U,h),h});return this.promisePendingStartPresentation=_,_.finally(()=>{this.promisePendingStartPresentation=void 0})}async startPresentation(e,{isNeedReinvite:t=!0,isP2P:n=!1,maxBitrate:s,degradationPreference:o}={}){const a=this.establishedSession;if(!a)throw new Error("No session established");if(this._streamPresentationCurrent)throw new Error("Presentation is already started");return n&&await this.sendMustStopPresentation(a),this._sendPresentation(a,e,{isNeedReinvite:t,isP2P:n,maxBitrate:s,degradationPreference:o})}async sendMustStopPresentation(e){await e.sendInfo(D,void 0,{extraHeaders:[Nn]})}async stopPresentation({isP2P:e=!1}={}){const t=this._streamPresentationCurrent;let n=this.promisePendingStartPresentation??Promise.resolve();const s=e?[gn]:[Sn],o=this.establishedSession;return o&&t&&(n=n.then(async()=>o.sendInfo(D,void 0,{extraHeaders:s})).then(async()=>o.stopPresentation(t)).catch(a=>{throw this._sessionEvents.trigger(U,a),a})),!o&&t&&this._sessionEvents.trigger(Ie,t),this.promisePendingStopPresentation=n,n.finally(()=>{this._resetPresentation()})}async updatePresentation(e,{isP2P:t=!1,maxBitrate:n,degradationPreference:s}={}){const o=this.establishedSession;if(!o)throw new Error("No session established");if(!this._streamPresentationCurrent)throw new Error("Presentation has not started yet");return this.promisePendingStartPresentation&&await this.promisePendingStartPresentation,this._sendPresentation(o,e,{isP2P:t,maxBitrate:n,degradationPreference:s,isNeedReinvite:!1})}_resetPresentation(){delete this._streamPresentationCurrent,this.promisePendingStartPresentation=void 0,this.promisePendingStopPresentation=void 0}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)}get connection(){var t;return(t=this.session)==null?void 0:t.connection}get remoteCallerData(){var e,t,n,s,o,a;return{displayName:(t=(e=this.incomingSession)==null?void 0:e.remote_identity)==null?void 0:t.display_name,host:(s=(n=this.incomingSession)==null?void 0:n.remote_identity)==null?void 0:s.uri.host,incomingNumber:(a=(o=this.incomingSession)==null?void 0:o.remote_identity)==null?void 0:a.uri.user,session:this.incomingSession}}get requested(){return this._cancelableConnect.requested||this._cancelableInitUa.requested||this._cancelableCall.requested||this._cancelableAnswer.requested}get establishedSession(){var e;return(e=this.session)!=null&&e.isEstablished()?this.session:void 0}get isRegistered(){return!!this.ua&&this.ua.isRegistered()}get isRegisterConfig(){return!!this.ua&&this._isRegisterConfig}get isCallActive(){return!!(this.ua&&this.session)}get isAvailableIncomingCall(){return!!this.incomingSession}_generateStream(e,t){const{id:n}=e,s=this._remoteStreams[n]||new MediaStream;return t&&s.addTrack(t),s.addTrack(e),this._remoteStreams[n]=s,s}_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,s)=>{if(n.kind==="audio")return;const o=n,a=e[s-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()}_cancelCallRequests(){this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest()}_cancelActionsRequests(){this._cancelableAnswer.cancelRequest(),this._cancelableSendDTMF.cancelRequest()}async waitChannels(){return this.waitSession(v)}async waitSyncMediaState(){return this.waitSession(b)}async sendChannels({inputChannels:e,outputChannels:t}){if(!this.session)throw new Error("No session established");const n=`${be}: ${e}`,s=`${ye}: ${t}`,o=[n,s];return this.session.sendInfo(Qt,void 0,{extraHeaders:o})}async sendMediaState({cam:e,mic:t},n={}){if(!this.session)throw new Error("No session established");const s=`${an}: currentstate`,o=`${En}: ${Number(e)}`,a=`${_n}: ${Number(t)}`,c=[s,o,a];return this.session.sendInfo(Kt,void 0,{noTerminateWhenError:!0,...n,extraHeaders:c})}async _sendRefusalToTurnOn(e,t={}){if(!this.session)throw new Error("No session established");const c=[`${cn}: ${e==="mic"?0:1}`];return this.session.sendInfo(jt,void 0,{noTerminateWhenError:!0,...t,extraHeaders:c})}async sendRefusalToTurnOnMic(e={}){if(!this.session)throw new Error("No session established");return this._sendRefusalToTurnOn("mic",{noTerminateWhenError:!0,...e})}async sendRefusalToTurnOnCam(e={}){if(!this.session)throw new Error("No session established");return this._sendRefusalToTurnOn("cam",{noTerminateWhenError:!0,...e})}}exports.BAD_MEDIA_DESCRIPTION=Fe;exports.EEventsMainCAM=R;exports.EEventsMic=L;exports.EEventsSyncMediaState=H;exports.EUseLicense=ut;exports.NOT_FOUND=qe;exports.REJECTED=V;exports.SESSION_EVENT_NAMES=pe;exports.SipConnector=Zn;exports.UA_EVENT_NAMES=Oe;exports.causes=Yt;exports.constants=xt;exports.disableDebug=mn;exports.enableDebug=In;exports.eventNames=Gt;exports.hasCanceledCallError=Bn;exports.logger=k;exports.setEncodingsToSender=Ct;
|
package/dist/SipConnector.d.ts
CHANGED
|
@@ -83,7 +83,6 @@ type TParametersConnection = TOptionsExtraHeaders & {
|
|
|
83
83
|
sipServerUrl: string;
|
|
84
84
|
sipWebSocketServerURL: string;
|
|
85
85
|
remoteAddress?: string;
|
|
86
|
-
sdpSemantics?: 'plan-b' | 'unified-plan';
|
|
87
86
|
sessionTimers?: boolean;
|
|
88
87
|
registerExpires?: number;
|
|
89
88
|
connectionRecoveryMinInterval?: number;
|
|
@@ -94,7 +93,6 @@ type TParametersCheckTelephony = {
|
|
|
94
93
|
displayName: string;
|
|
95
94
|
sipServerUrl: string;
|
|
96
95
|
sipWebSocketServerURL: string;
|
|
97
|
-
sdpSemantics?: 'plan-b' | 'unified-plan';
|
|
98
96
|
userAgent?: string;
|
|
99
97
|
};
|
|
100
98
|
type TConnect = (parameters: TParametersConnection, options?: {
|
|
@@ -172,7 +170,7 @@ export default class SipConnector {
|
|
|
172
170
|
tryRegister: () => Promise<RegisteredEvent>;
|
|
173
171
|
sendOptions(target: URI | string, body?: string, extraHeaders?: string[]): Promise<void>;
|
|
174
172
|
ping(body?: string, extraHeaders?: string[]): Promise<void>;
|
|
175
|
-
checkTelephony({ userAgent, displayName, sipServerUrl, sipWebSocketServerURL,
|
|
173
|
+
checkTelephony({ userAgent, displayName, sipServerUrl, sipWebSocketServerURL, }: TParametersCheckTelephony): Promise<void>;
|
|
176
174
|
replaceMediaStream(mediaStream: MediaStream, options?: {
|
|
177
175
|
deleteExisting: boolean;
|
|
178
176
|
addMissing: boolean;
|
package/dist/doMock.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var k=(o,t,e)=>t in o?b(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>k(o,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("./SipConnector-3pnvrFP5.cjs"),D=require("@krivega/jssip/lib/NameAddrHeader"),P=require("@krivega/jssip/lib/URI"),L=require("node:events"),F=require("@krivega/jssip/lib/SIPMessage"),T=require("webrtc-mock"),v=require("events-constructor"),M=require("@krivega/jssip");class C extends F.IncomingRequest{constructor(e){super();r(this,"headers");this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)||""}}class V{constructor({originator:t="local",eventHandlers:e}){r(this,"originator");r(this,"_connection");r(this,"_events");r(this,"_remote_identity");r(this,"_mutedOptions",{audio:!1,video:!1});this.originator=t,this._events=new v(m.SESSION_EVENT_NAMES),this.initEvents(e)}get C(){throw new Error("Method not implemented.")}get causes(){throw new Error("Method not implemented.")}get id(){throw new Error("Method not implemented.")}set data(t){throw new Error("Method not implemented.")}get data(){throw new Error("Method not implemented.")}get connection(){return this._connection}get contact(){throw new Error("Method not implemented.")}get direction(){throw new Error("Method not implemented.")}get local_identity(){throw new Error("Method not implemented.")}get remote_identity(){return this._remote_identity}get start_time(){throw new Error("Method not implemented.")}get end_time(){throw new Error("Method not implemented.")}get status(){throw new Error("Method not implemented.")}isInProgress(){throw new Error("Method not implemented.")}isEnded(){throw new Error("Method not implemented.")}isReadyToReOffer(){throw new Error("Method not implemented.")}answer(t){throw new Error("Method not implemented.")}terminate(t){throw new Error("Method not implemented.")}async sendInfo(t,e,n){throw new Error("Method not implemented.")}hold(t,e){throw new Error("Method not implemented.")}unhold(t,e){throw new Error("Method not implemented.")}async renegotiate(t,e){throw new Error("Method not implemented.")}isOnHold(){throw new Error("Method not implemented.")}mute(t){throw new Error("Method not implemented.")}unmute(t){throw new Error("Method not implemented.")}isMuted(){throw new Error("Method not implemented.")}refer(t,e){throw new Error("Method not implemented.")}resetLocalMedia(){throw new Error("Method not implemented.")}async replaceMediaStream(t,e){throw new Error("Method not implemented.")}addListener(t,e){throw new Error("Method not implemented.")}once(t,e){throw new Error("Method not implemented.")}removeListener(t,e){throw new Error("Method not implemented.")}off(t,e){throw new Error("Method not implemented.")}removeAllListeners(t){throw new Error("Method not implemented.")}setMaxListeners(t){throw new Error("Method not implemented.")}getMaxListeners(){throw new Error("Method not implemented.")}listeners(t){throw new Error("Method not implemented.")}rawListeners(t){throw new Error("Method not implemented.")}emit(t,...e){throw new Error("Method not implemented.")}listenerCount(t){throw new Error("Method not implemented.")}prependListener(t,e){throw new Error("Method not implemented.")}prependOnceListener(t,e){throw new Error("Method not implemented.")}eventNames(){throw new Error("Method not implemented.")}initEvents(t=[]){Object.entries(t).forEach(([e,n])=>this.on(e,n))}on(t,e){return this._events.on(t,e),this}trigger(t,e){this._events.trigger(t,e)}sendDTMF(){this.trigger("newDTMF",{originator:this.originator})}async startPresentation(t){return t}async updatePresentation(t){return t}async stopPresentation(t){return t}isEstablished(){return!0}}class z{constructor(t,e){r(this,"_senders",[]);r(this,"_receivers",[]);r(this,"canTrickleIceCandidates");r(this,"connectionState");r(this,"currentLocalDescription");r(this,"currentRemoteDescription");r(this,"iceConnectionState");r(this,"iceGatheringState");r(this,"idpErrorInfo");r(this,"idpLoginUrl");r(this,"localDescription");r(this,"onconnectionstatechange");r(this,"ondatachannel");r(this,"onicecandidate");r(this,"onicecandidateerror",null);r(this,"oniceconnectionstatechange");r(this,"onicegatheringstatechange");r(this,"onnegotiationneeded");r(this,"onsignalingstatechange");r(this,"ontrack");r(this,"peerIdentity");r(this,"pendingLocalDescription");r(this,"pendingRemoteDescription");r(this,"remoteDescription");r(this,"sctp",null);r(this,"signalingState");r(this,"getReceivers",()=>this._receivers);r(this,"getSenders",()=>this._senders);r(this,"addTrack",t=>{const e={track:t};return this._senders.push(e),e});this._receivers=e.map(n=>({track:n}))}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(t){throw new Error("Method not implemented.")}addTransceiver(t,e){throw new Error("Method not implemented.")}close(){throw new Error("Method not implemented.")}restartIce(){throw new Error("Method not implemented.")}async createAnswer(t,e){throw new Error("Method not implemented.")}createDataChannel(t,e){throw new Error("Method not implemented.")}async createOffer(t,e,n){throw new Error("Method not implemented.")}getConfiguration(){throw new Error("Method not implemented.")}async getIdentityAssertion(){throw new Error("Method not implemented.")}async getStats(t){throw new Error("Method not implemented.")}getTransceivers(){throw new Error("Method not implemented.")}removeTrack(t){throw new Error("Method not implemented.")}setConfiguration(t){throw new Error("Method not implemented.")}async setLocalDescription(t){throw new Error("Method not implemented.")}async setRemoteDescription(t){throw new Error("Method not implemented.")}addEventListener(t,e,n){throw new Error("Method not implemented.")}removeEventListener(t,e,n){throw new Error("Method not implemented.")}dispatchEvent(t){throw new Error("Method not implemented.")}}function U(o){const t=o.match(/(purgatory)|[\d.]+/g);if(!t)throw new Error("wrong sip url");return t[0]}const p=400,I="777",q=o=>o.getVideoTracks().length>0;class y extends V{constructor({url:e="",mediaStream:n,eventHandlers:i,originator:a}){super({originator:a,eventHandlers:i});r(this,"url");r(this,"status_code");r(this,"_isEnded",!1);r(this,"answer",jest.fn(({mediaStream:e})=>{if(this.originator!=="remote")throw new Error("answer available only for remote sessions");this.initPeerconnection(e),setTimeout(()=>{this.trigger("connecting"),setTimeout(()=>{this.trigger("accepted")},100),setTimeout(()=>{this.trigger("confirmed")},200)},p)}));this.url=e,this.initPeerconnection(n)}initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const n=T.createAudioMediaStreamTrackMock();n.id="mainaudio1";const i=[n];if(q(e)){const h=T.createVideoMediaStreamTrackMock();h.id="mainvideo1",i.push(h)}this._connection=new z(void 0,i),this._addStream(e),setTimeout(()=>{this.trigger("peerconnection",{peerconnection:this.connection})},p)}connect(e){const n=U(e);setTimeout(()=>{this.url.includes(I)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:m.REJECTED}):(this.trigger("connecting"),setTimeout(()=>{this.trigger("enterRoom",{room:n})},100),setTimeout(()=>{this.trigger("accepted")},200),setTimeout(()=>{this.trigger("confirmed")},300))},p)}terminate({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e}),this._isEnded=!1,this}async terminateAsync({status_code:e}={}){this.terminate({status_code:e})}terminateRemote({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e,originator:"remote"}),this}_addStream(e,n="getTracks"){e[n]().forEach(i=>this.connection.addTrack(i))}_forEachSenders(e){const n=this.connection.getSenders();for(const i of n)e(i);return n}_toggleMuteAudio(e){this._forEachSenders(({track:n})=>{n&&n.kind==="audio"&&(n.enabled=!e)})}_toggleMuteVideo(e){this._forEachSenders(({track:n})=>{n&&n.kind==="video"&&(n.enabled=!e)})}mute(e){e.audio&&(this._mutedOptions.audio=!0,this._toggleMuteAudio(this._mutedOptions.audio)),e.video&&(this._mutedOptions.video=!0,this._toggleMuteVideo(this._mutedOptions.video)),this._onmute(e)}unmute(e){e.audio&&(this._mutedOptions.audio=!1),e.video&&(this._mutedOptions.video=!1),this.trigger("unmuted",e)}isMuted(){return this._mutedOptions}async replaceMediaStream(e){return e}_onmute({audio:e,video:n}){this.trigger("muted",{audio:e,video:n})}async sendInfo(){}isEnded(){return this._isEnded}newInfo(e){this.trigger("newInfo",e)}}class x{constructor(){r(this,"extraHeaders")}setExtraHeaders(t){this.extraHeaders=t}setExtraContactParams(){}}const d="PASSWORD_CORRECT",w="PASSWORD_CORRECT_2",N="NAME_INCORRECT",u=400,s=class s{constructor(t){r(this,"_events");r(this,"_startedTimeout");r(this,"_stopedTimeout");r(this,"session");r(this,"_isRegistered");r(this,"_isConnected");r(this,"configuration");r(this,"_registrator");r(this,"call",jest.fn((t,e)=>{const{mediaStream:n,eventHandlers:i}=e;return this.session=new y({url:t,mediaStream:n,eventHandlers:i,originator:"local"}),this.session.connect(t),this.session}));this._events=new v(m.UA_EVENT_NAMES);const[e,n]=t.uri.split(":"),[i,a]=n.split("@"),h={...t,uri:new M.URI(e,i,a)};this.configuration=h,this._registrator=new x}static setStartError(t,{count:e=Number.POSITIVE_INFINITY}={}){this.startError=t,this.countStartError=e}static resetStartError(){this.startError=void 0,this.countStartError=Number.POSITIVE_INFINITY,this.countStarts=0}static setAvailableTelephony(){this.isAvailableTelephony=!0}static setNotAvailableTelephony(){this.isAvailableTelephony=!1}isConnected(){return!!this._isConnected}start(){if(s.countStarts+=1,s.startError&&s.countStarts<s.countStartError){this.trigger("disconnected",s.startError);return}this.register()}stop(){this._startedTimeout&&clearTimeout(this._startedTimeout),this._stopedTimeout&&clearTimeout(this._stopedTimeout),this.unregister(),this.isStarted()?this._stopedTimeout=setTimeout(()=>{this.trigger("disconnected",{error:new Error("stoped")})},u):this.trigger("disconnected",{error:new Error("stoped")})}on(t,e){return this._events.on(t,e),this}once(t,e){return this._events.once(t,e),this}off(t,e){return this._events.off(t,e),this}removeAllListeners(){return this._events.removeEventHandlers(),this}trigger(t,e){this._events.trigger(t,e)}terminateSessions(){this.session.terminate()}set(t,e){return this.configuration[t]=e,!0}register(){this._startedTimeout&&clearTimeout(this._startedTimeout);const{password:t,register:e,uri:n}=this.configuration;e&&n.user.includes(N)?(this._isRegistered=!1,this._isConnected=!1,this._startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:null,cause:"Request Timeout"})},u)):!this._isRegistered&&e&&(t===d||t===w)?(this._isRegistered=!0,this._startedTimeout=setTimeout(()=>{this.trigger("registered")},u)):e&&t!==d&&t!==w&&(this._isRegistered=!1,this._isConnected=!1,this._startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:null,cause:"Wrong credentials"})},u)),s.isAvailableTelephony?(this.trigger("connected"),this._isConnected=!0):this.stop()}unregister(){this._isRegistered=!1,this._isConnected=!1,this.trigger("unregistered")}isRegistered(){return!!this._isRegistered}isStarted(){return this.configuration&&(this.configuration.register&&!!this._isRegistered||!this.configuration.register&&!!this._isConnected)}registrator(){return this._registrator}newSipEvent(t){this.trigger("sipEvent",t)}};r(s,"isAvailableTelephony",!0),r(s,"startError"),r(s,"countStartError",Number.POSITIVE_INFINITY),r(s,"countStarts",0);let E=s;class H{constructor(t){r(this,"url");this.url=t}}class j extends L.EventEmitter{constructor(e,n){super();r(this,"contentType");r(this,"body");this.contentType=e,this.body=n}}const f="remote",B=(o,t)=>{const e=new C(t),n={originator:f,request:e,info:new j("","")};o.newInfo(n)},Y=(o,t)=>{const n={request:new C(t)};o.newSipEvent(n)},K=(o,{incomingNumber:t="1234",displayName:e,host:n})=>{const i=new y({originator:f}),a=new P("sip",t,n);i._remote_identity=new D(a,e),o.trigger("newRTCSession",{originator:f,session:i})},$=(o,t)=>{t?o.trigger("failed",t):o.trigger("failed",o)},A={triggerNewInfo:B,triggerNewSipEvent:Y,triggerIncomingSession:K,triggerFailIncomingSession:$,WebSocketInterface:H,UA:E,C:{INVITE:"INVITE"}},l="user",c="displayName",g="SIP_SERVER_URL",S="SIP_WEB_SOCKET_SERVER_URL",J=new A.WebSocketInterface(S),R={userAgent:"Chrome",sipServerUrl:g,sipWebSocketServerURL:S},G={...R},O={...R,user:l,password:d,register:!0},X={...O,displayName:c},Q={...R,displayName:c,register:!1},_={session_timers:!1,sockets:[J],user_agent:"Chrome",sdp_semantics:"plan-b",register_expires:300,connection_recovery_max_interval:6,connection_recovery_min_interval:2},Z={..._,password:d,uri:new M.URI("sip",l,g),display_name:"",register:!0},ee={..._,password:d,uri:new M.URI("sip",l,g),display_name:c,register:!0},te={..._,display_name:c,register:!1},re={..._,display_name:"",register:!1},W="10.10.10.10",ne=[`X-Vinteo-Remote: ${W}`],oe=()=>new m.SipConnector({JsSIP:A});exports.FAILED_CONFERENCE_NUMBER=I;exports.NAME_INCORRECT=N;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=w;exports.SIP_SERVER_URL=g;exports.SIP_WEB_SOCKET_SERVER_URL=S;exports.dataForConnectionWithAuthorization=O;exports.dataForConnectionWithAuthorizationWithDisplayName=X;exports.dataForConnectionWithoutAuthorization=Q;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=G;exports.default=oe;exports.displayName=c;exports.extraHeadersRemoteAddress=ne;exports.remoteAddress=W;exports.uaConfigurationWithAuthorization=Z;exports.uaConfigurationWithAuthorizationWithDisplayName=ee;exports.uaConfigurationWithoutAuthorization=te;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=re;exports.user=l;
|
|
1
|
+
"use strict";var k=Object.defineProperty;var D=(o,t,e)=>t in o?k(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>D(o,typeof t!="symbol"?t+"":t,e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("./SipConnector-zjYmhYTk.cjs"),b=require("@krivega/jssip/lib/NameAddrHeader"),P=require("@krivega/jssip/lib/URI"),L=require("node:events"),F=require("@krivega/jssip/lib/SIPMessage"),T=require("webrtc-mock"),v=require("events-constructor"),M=require("@krivega/jssip");class C extends F.IncomingRequest{constructor(e){super();r(this,"headers");this.headers=new Headers(e)}getHeader(e){return this.headers.get(e)||""}}class V{constructor({originator:t="local",eventHandlers:e}){r(this,"originator");r(this,"_connection");r(this,"_events");r(this,"_remote_identity");r(this,"_mutedOptions",{audio:!1,video:!1});this.originator=t,this._events=new v(m.SESSION_EVENT_NAMES),this.initEvents(e)}get C(){throw new Error("Method not implemented.")}get causes(){throw new Error("Method not implemented.")}get id(){throw new Error("Method not implemented.")}set data(t){throw new Error("Method not implemented.")}get data(){throw new Error("Method not implemented.")}get connection(){return this._connection}get contact(){throw new Error("Method not implemented.")}get direction(){throw new Error("Method not implemented.")}get local_identity(){throw new Error("Method not implemented.")}get remote_identity(){return this._remote_identity}get start_time(){throw new Error("Method not implemented.")}get end_time(){throw new Error("Method not implemented.")}get status(){throw new Error("Method not implemented.")}isInProgress(){throw new Error("Method not implemented.")}isEnded(){throw new Error("Method not implemented.")}isReadyToReOffer(){throw new Error("Method not implemented.")}answer(t){throw new Error("Method not implemented.")}terminate(t){throw new Error("Method not implemented.")}async sendInfo(t,e,n){throw new Error("Method not implemented.")}hold(t,e){throw new Error("Method not implemented.")}unhold(t,e){throw new Error("Method not implemented.")}async renegotiate(t,e){throw new Error("Method not implemented.")}isOnHold(){throw new Error("Method not implemented.")}mute(t){throw new Error("Method not implemented.")}unmute(t){throw new Error("Method not implemented.")}isMuted(){throw new Error("Method not implemented.")}refer(t,e){throw new Error("Method not implemented.")}resetLocalMedia(){throw new Error("Method not implemented.")}async replaceMediaStream(t,e){throw new Error("Method not implemented.")}addListener(t,e){throw new Error("Method not implemented.")}once(t,e){throw new Error("Method not implemented.")}removeListener(t,e){throw new Error("Method not implemented.")}off(t,e){throw new Error("Method not implemented.")}removeAllListeners(t){throw new Error("Method not implemented.")}setMaxListeners(t){throw new Error("Method not implemented.")}getMaxListeners(){throw new Error("Method not implemented.")}listeners(t){throw new Error("Method not implemented.")}rawListeners(t){throw new Error("Method not implemented.")}emit(t,...e){throw new Error("Method not implemented.")}listenerCount(t){throw new Error("Method not implemented.")}prependListener(t,e){throw new Error("Method not implemented.")}prependOnceListener(t,e){throw new Error("Method not implemented.")}eventNames(){throw new Error("Method not implemented.")}initEvents(t=[]){Object.entries(t).forEach(([e,n])=>this.on(e,n))}on(t,e){return this._events.on(t,e),this}trigger(t,e){this._events.trigger(t,e)}sendDTMF(){this.trigger("newDTMF",{originator:this.originator})}async startPresentation(t){return t}async updatePresentation(t){return t}async stopPresentation(t){return t}isEstablished(){return!0}}class z{constructor(t,e){r(this,"_senders",[]);r(this,"_receivers",[]);r(this,"canTrickleIceCandidates");r(this,"connectionState");r(this,"currentLocalDescription");r(this,"currentRemoteDescription");r(this,"iceConnectionState");r(this,"iceGatheringState");r(this,"idpErrorInfo");r(this,"idpLoginUrl");r(this,"localDescription");r(this,"onconnectionstatechange");r(this,"ondatachannel");r(this,"onicecandidate");r(this,"onicecandidateerror",null);r(this,"oniceconnectionstatechange");r(this,"onicegatheringstatechange");r(this,"onnegotiationneeded");r(this,"onsignalingstatechange");r(this,"ontrack");r(this,"peerIdentity");r(this,"pendingLocalDescription");r(this,"pendingRemoteDescription");r(this,"remoteDescription");r(this,"sctp",null);r(this,"signalingState");r(this,"getReceivers",()=>this._receivers);r(this,"getSenders",()=>this._senders);r(this,"addTrack",t=>{const e={track:t};return this._senders.push(e),e});this._receivers=e.map(n=>({track:n}))}getRemoteStreams(){throw new Error("Method not implemented.")}async addIceCandidate(t){throw new Error("Method not implemented.")}addTransceiver(t,e){throw new Error("Method not implemented.")}close(){throw new Error("Method not implemented.")}restartIce(){throw new Error("Method not implemented.")}async createAnswer(t,e){throw new Error("Method not implemented.")}createDataChannel(t,e){throw new Error("Method not implemented.")}async createOffer(t,e,n){throw new Error("Method not implemented.")}getConfiguration(){throw new Error("Method not implemented.")}async getIdentityAssertion(){throw new Error("Method not implemented.")}async getStats(t){throw new Error("Method not implemented.")}getTransceivers(){throw new Error("Method not implemented.")}removeTrack(t){throw new Error("Method not implemented.")}setConfiguration(t){throw new Error("Method not implemented.")}async setLocalDescription(t){throw new Error("Method not implemented.")}async setRemoteDescription(t){throw new Error("Method not implemented.")}addEventListener(t,e,n){throw new Error("Method not implemented.")}removeEventListener(t,e,n){throw new Error("Method not implemented.")}dispatchEvent(t){throw new Error("Method not implemented.")}}function U(o){const t=o.match(/(purgatory)|[\d.]+/g);if(!t)throw new Error("wrong sip url");return t[0]}const p=400,I="777",q=o=>o.getVideoTracks().length>0;class y extends V{constructor({url:e="",mediaStream:n,eventHandlers:i,originator:a}){super({originator:a,eventHandlers:i});r(this,"url");r(this,"status_code");r(this,"_isEnded",!1);r(this,"answer",jest.fn(({mediaStream:e})=>{if(this.originator!=="remote")throw new Error("answer available only for remote sessions");this.initPeerconnection(e),setTimeout(()=>{this.trigger("connecting"),setTimeout(()=>{this.trigger("accepted")},100),setTimeout(()=>{this.trigger("confirmed")},200)},p)}));this.url=e,this.initPeerconnection(n)}initPeerconnection(e){return e?(this.createPeerconnection(e),!0):!1}createPeerconnection(e){const n=T.createAudioMediaStreamTrackMock();n.id="mainaudio1";const i=[n];if(q(e)){const h=T.createVideoMediaStreamTrackMock();h.id="mainvideo1",i.push(h)}this._connection=new z(void 0,i),this._addStream(e),setTimeout(()=>{this.trigger("peerconnection",{peerconnection:this.connection})},p)}connect(e){const n=U(e);setTimeout(()=>{this.url.includes(I)?this.trigger("failed",{originator:"remote",message:"IncomingResponse",cause:m.REJECTED}):(this.trigger("connecting"),setTimeout(()=>{this.trigger("enterRoom",{room:n})},100),setTimeout(()=>{this.trigger("accepted")},200),setTimeout(()=>{this.trigger("confirmed")},300))},p)}terminate({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e}),this._isEnded=!1,this}async terminateAsync({status_code:e}={}){this.terminate({status_code:e})}terminateRemote({status_code:e}={}){return this.status_code=e,this.trigger("ended",{status_code:e,originator:"remote"}),this}_addStream(e,n="getTracks"){e[n]().forEach(i=>this.connection.addTrack(i))}_forEachSenders(e){const n=this.connection.getSenders();for(const i of n)e(i);return n}_toggleMuteAudio(e){this._forEachSenders(({track:n})=>{n&&n.kind==="audio"&&(n.enabled=!e)})}_toggleMuteVideo(e){this._forEachSenders(({track:n})=>{n&&n.kind==="video"&&(n.enabled=!e)})}mute(e){e.audio&&(this._mutedOptions.audio=!0,this._toggleMuteAudio(this._mutedOptions.audio)),e.video&&(this._mutedOptions.video=!0,this._toggleMuteVideo(this._mutedOptions.video)),this._onmute(e)}unmute(e){e.audio&&(this._mutedOptions.audio=!1),e.video&&(this._mutedOptions.video=!1),this.trigger("unmuted",e)}isMuted(){return this._mutedOptions}async replaceMediaStream(e){return e}_onmute({audio:e,video:n}){this.trigger("muted",{audio:e,video:n})}async sendInfo(){}isEnded(){return this._isEnded}newInfo(e){this.trigger("newInfo",e)}}class x{constructor(){r(this,"extraHeaders")}setExtraHeaders(t){this.extraHeaders=t}setExtraContactParams(){}}const d="PASSWORD_CORRECT",w="PASSWORD_CORRECT_2",N="NAME_INCORRECT",u=400,s=class s{constructor(t){r(this,"_events");r(this,"_startedTimeout");r(this,"_stopedTimeout");r(this,"session");r(this,"_isRegistered");r(this,"_isConnected");r(this,"configuration");r(this,"_registrator");r(this,"call",jest.fn((t,e)=>{const{mediaStream:n,eventHandlers:i}=e;return this.session=new y({url:t,mediaStream:n,eventHandlers:i,originator:"local"}),this.session.connect(t),this.session}));this._events=new v(m.UA_EVENT_NAMES);const[e,n]=t.uri.split(":"),[i,a]=n.split("@"),h={...t,uri:new M.URI(e,i,a)};this.configuration=h,this._registrator=new x}static setStartError(t,{count:e=Number.POSITIVE_INFINITY}={}){this.startError=t,this.countStartError=e}static resetStartError(){this.startError=void 0,this.countStartError=Number.POSITIVE_INFINITY,this.countStarts=0}static setAvailableTelephony(){this.isAvailableTelephony=!0}static setNotAvailableTelephony(){this.isAvailableTelephony=!1}isConnected(){return!!this._isConnected}start(){if(s.countStarts+=1,s.startError&&s.countStarts<s.countStartError){this.trigger("disconnected",s.startError);return}this.register()}stop(){this._startedTimeout&&clearTimeout(this._startedTimeout),this._stopedTimeout&&clearTimeout(this._stopedTimeout),this.unregister(),this.isStarted()?this._stopedTimeout=setTimeout(()=>{this.trigger("disconnected",{error:new Error("stoped")})},u):this.trigger("disconnected",{error:new Error("stoped")})}on(t,e){return this._events.on(t,e),this}once(t,e){return this._events.once(t,e),this}off(t,e){return this._events.off(t,e),this}removeAllListeners(){return this._events.removeEventHandlers(),this}trigger(t,e){this._events.trigger(t,e)}terminateSessions(){this.session.terminate()}set(t,e){return this.configuration[t]=e,!0}register(){this._startedTimeout&&clearTimeout(this._startedTimeout);const{password:t,register:e,uri:n}=this.configuration;e&&n.user.includes(N)?(this._isRegistered=!1,this._isConnected=!1,this._startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:null,cause:"Request Timeout"})},u)):!this._isRegistered&&e&&(t===d||t===w)?(this._isRegistered=!0,this._startedTimeout=setTimeout(()=>{this.trigger("registered")},u)):e&&t!==d&&t!==w&&(this._isRegistered=!1,this._isConnected=!1,this._startedTimeout=setTimeout(()=>{this.trigger("registrationFailed",{response:null,cause:"Wrong credentials"})},u)),s.isAvailableTelephony?(this.trigger("connected"),this._isConnected=!0):this.stop()}unregister(){this._isRegistered=!1,this._isConnected=!1,this.trigger("unregistered")}isRegistered(){return!!this._isRegistered}isStarted(){return this.configuration&&(this.configuration.register&&!!this._isRegistered||!this.configuration.register&&!!this._isConnected)}registrator(){return this._registrator}newSipEvent(t){this.trigger("sipEvent",t)}};r(s,"isAvailableTelephony",!0),r(s,"startError"),r(s,"countStartError",Number.POSITIVE_INFINITY),r(s,"countStarts",0);let E=s;class H{constructor(t){r(this,"url");this.url=t}}class j extends L.EventEmitter{constructor(e,n){super();r(this,"contentType");r(this,"body");this.contentType=e,this.body=n}}const f="remote",B=(o,t)=>{const e=new C(t),n={originator:f,request:e,info:new j("","")};o.newInfo(n)},Y=(o,t)=>{const n={request:new C(t)};o.newSipEvent(n)},K=(o,{incomingNumber:t="1234",displayName:e,host:n})=>{const i=new y({originator:f}),a=new P("sip",t,n);i._remote_identity=new b(a,e),o.trigger("newRTCSession",{originator:f,session:i})},$=(o,t)=>{t?o.trigger("failed",t):o.trigger("failed",o)},A={triggerNewInfo:B,triggerNewSipEvent:Y,triggerIncomingSession:K,triggerFailIncomingSession:$,WebSocketInterface:H,UA:E,C:{INVITE:"INVITE"}},l="user",c="displayName",g="SIP_SERVER_URL",S="SIP_WEB_SOCKET_SERVER_URL",J=new A.WebSocketInterface(S),R={userAgent:"Chrome",sipServerUrl:g,sipWebSocketServerURL:S},G={...R},O={...R,user:l,password:d,register:!0},X={...O,displayName:c},Q={...R,displayName:c,register:!1},_={session_timers:!1,sockets:[J],user_agent:"Chrome",sdp_semantics:"unified-plan",register_expires:300,connection_recovery_max_interval:6,connection_recovery_min_interval:2},Z={..._,password:d,uri:new M.URI("sip",l,g),display_name:"",register:!0},ee={..._,password:d,uri:new M.URI("sip",l,g),display_name:c,register:!0},te={..._,display_name:c,register:!1},re={..._,display_name:"",register:!1},W="10.10.10.10",ne=[`X-Vinteo-Remote: ${W}`],oe=()=>new m.SipConnector({JsSIP:A});exports.FAILED_CONFERENCE_NUMBER=I;exports.NAME_INCORRECT=N;exports.PASSWORD_CORRECT=d;exports.PASSWORD_CORRECT_2=w;exports.SIP_SERVER_URL=g;exports.SIP_WEB_SOCKET_SERVER_URL=S;exports.dataForConnectionWithAuthorization=O;exports.dataForConnectionWithAuthorizationWithDisplayName=X;exports.dataForConnectionWithoutAuthorization=Q;exports.dataForConnectionWithoutAuthorizationWithoutDisplayName=G;exports.default=oe;exports.displayName=c;exports.extraHeadersRemoteAddress=ne;exports.remoteAddress=W;exports.uaConfigurationWithAuthorization=Z;exports.uaConfigurationWithAuthorizationWithDisplayName=ee;exports.uaConfigurationWithoutAuthorization=te;exports.uaConfigurationWithoutAuthorizationWithoutDisplayName=re;exports.user=l;
|
package/dist/doMock.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var I = Object.defineProperty;
|
|
2
2
|
var y = (o, t, e) => t in o ? I(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
3
|
var r = (o, t, e) => y(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { j as N, R as O, U as A, S as k } from "./SipConnector-
|
|
4
|
+
import { j as N, R as O, U as A, S as k } from "./SipConnector-4t573yj1.js";
|
|
5
5
|
import b from "@krivega/jssip/lib/NameAddrHeader";
|
|
6
6
|
import D from "@krivega/jssip/lib/URI";
|
|
7
7
|
import { EventEmitter as L } from "node:events";
|
|
@@ -644,7 +644,7 @@ const _ = "remote", K = (o, t) => {
|
|
|
644
644
|
session_timers: !1,
|
|
645
645
|
sockets: [X],
|
|
646
646
|
user_agent: "Chrome",
|
|
647
|
-
sdp_semantics: "plan
|
|
647
|
+
sdp_semantics: "unified-plan",
|
|
648
648
|
register_expires: 300,
|
|
649
649
|
connection_recovery_max_interval: 6,
|
|
650
650
|
connection_recovery_min_interval: 2
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./SipConnector-3pnvrFP5.cjs"),K=require("ts-debounce"),H=require("@krivega/cancelable-promise"),Y=require("repeated-calls"),z=require("sequent-promises"),J=require("stack-promises"),Q=require("debug"),L="purgatory",p=e=>e===L,I=e=>()=>(r.logger("getRemoteStreams"),e.getRemoteStreams()),Z=({kind:e,readyState:t})=>e==="video"&&t==="live",V=e=>({track:t})=>{Z(t)&&e()},D=({getRemoteStreams:e,setRemoteStreams:t})=>K.debounce(()=>{const n=e();r.logger("remoteStreams",n),n&&t(n)},200),ee=e=>async n=>{const{mediaStream:s,extraHeaders:o,iceServers:c,degradationPreference:a,setRemoteStreams:u,onBeforeProgressCall:l,onSuccessProgressCall:d,onEnterPurgatory:m,onEnterConference:g,onFailProgressCall:C,onFinishProgressCall:S,onEndedCall:f}=n,M=D({setRemoteStreams:u,getRemoteStreams:I(e)}),y=V(M);r.logger("answerIncomingCall",n);const _=async()=>e.answerToIncomingCall({mediaStream:s,extraHeaders:o,iceServers:c,degradationPreference:a,ontrack:y}),h=()=>{const{remoteCallerData:i}=e;return i.incomingNumber};let R=!1,T;const b=(r.logger("subscribeEnterConference: onEnterConference",g),m??g?e.onSession("enterRoom",i=>{r.logger("enterRoom",{_room:i,isSuccessProgressCall:R}),T=i,p(T)?m&&m():g&&g({isSuccessProgressCall:R})}):()=>{}),v=i=>(r.logger("onSuccess"),R=!0,M(),d&&d({isPurgatory:p(T)}),e.onceRaceSession(["ended","failed"],()=>{b(),f&&f()}),i),O=i=>{throw r.logger("onFail"),C&&C(),b(),i},A=()=>{r.logger("onFinish"),S&&S()};if(r.logger("onBeforeProgressCall"),l){const i=h();l(i)}return _().then(v).catch(i=>O(i)).finally(A)},ne=e=>async n=>{const{conference:s,mediaStream:o,extraHeaders:c,iceServers:a,degradationPreference:u,setRemoteStreams:l,onBeforeProgressCall:d,onSuccessProgressCall:m,onEnterPurgatory:g,onEnterConference:C,onFailProgressCall:S,onFinishProgressCall:f,onEndedCall:M}=n,y=D({setRemoteStreams:l,getRemoteStreams:I(e)}),_=V(y);r.logger("callToServer",n);const h=async()=>(r.logger("startCall"),e.call({mediaStream:o,extraHeaders:c,iceServers:a,degradationPreference:u,number:s,ontrack:_}));let R=!1,T;const b=(r.logger("subscribeEnterConference: onEnterConference",C),g??C?e.onSession("enterRoom",({room:i})=>{r.logger("enterRoom",{_room:i,isSuccessProgressCall:R}),T=i,p(T)?g&&g():C&&C({isSuccessProgressCall:R})}):()=>{}),v=i=>(r.logger("onSuccess"),R=!0,y(),m&&m({isPurgatory:p(T)}),e.onceRaceSession(["ended","failed"],()=>{b(),M&&M()}),i),O=i=>{throw r.logger("onFail"),S&&S(),b(),i},A=()=>{r.logger("onFinish"),f&&f()};return r.logger("onBeforeProgressCall"),d&&d(s),h().then(v).catch(i=>O(i)).finally(A)},P=e=>{if(!H.isCanceledError(e)&&!Y.hasCanceledError(e))throw e;return{isSuccessful:!1}},te=e=>async n=>{const{userAgent:s,sipWebSocketServerURL:o,sipServerUrl:c,remoteAddress:a,displayName:u,name:l,password:d,isRegisteredUser:m,sdpSemantics:g,isDisconnectOnFail:C}=n;return r.logger("connectToServer",n),e.connect({userAgent:s,sdpSemantics:g,sipWebSocketServerURL:o,sipServerUrl:c,remoteAddress:a,displayName:u,password:d,user:l,register:m}).then(S=>(r.logger("connectToServer then"),{ua:S,isSuccessful:!0})).catch(async S=>(r.logger("connectToServer catch: error",S),C===!0?e.disconnect().then(()=>P(S)).catch(()=>P(S)):P(S)))},re=e=>async()=>(r.logger("disconnectFromServer"),e.disconnect().then(()=>(r.logger("disconnectFromServer: then"),{isSuccessful:!0})).catch(t=>(r.logger("disconnectFromServer: catch",t),{isSuccessful:!1}))),w=e=>{const{url:t,cause:n}=e;let s=t;return(n===r.BAD_MEDIA_DESCRIPTION||n===r.NOT_FOUND)&&(s=`${e.message.to.uri.user}@${e.message.to.uri.host}`),s};var $=(e=>(e.CONNECT_SERVER_FAILED="CONNECT_SERVER_FAILED",e.WRONG_USER_OR_PASSWORD="WRONG_USER_OR_PASSWORD",e.BAD_MEDIA_ERROR="BAD_MEDIA_ERROR",e.NOT_FOUND_ERROR="NOT_FOUND_ERROR",e.WS_CONNECTION_FAILED="WS_CONNECTION_FAILED",e.CONNECT_SERVER_FAILED_BY_LINK="CONNECT_SERVER_FAILED_BY_LINK",e))($||{});const se=(e=new Error)=>{var o;const{cause:t,socket:n}=e;let s="CONNECT_SERVER_FAILED";switch(t){case"Forbidden":{s="WRONG_USER_OR_PASSWORD";break}case r.BAD_MEDIA_DESCRIPTION:{s="BAD_MEDIA_ERROR";break}case r.NOT_FOUND:{s="NOT_FOUND_ERROR";break}default:n&&((o=n==null?void 0:n._ws)==null?void 0:o.readyState)===3?s="WS_CONNECTION_FAILED":w(e)&&(s="CONNECT_SERVER_FAILED_BY_LINK")}return s},oe=e=>{let t="";try{t=JSON.stringify(e)}catch(n){r.logger("failed to stringify message",n)}return t},ce=(e=new Error)=>{const{code:t,cause:n,message:s}=e,o=w(e),c={code:"",cause:"",message:""};return typeof s=="object"&&s!==null?c.message=oe(s):s&&(c.message=String(s)),o&&(c.link=o),t&&(c.code=t),n&&(c.cause=n),c},ae=Object.freeze(Object.defineProperty({__proto__:null,EErrorTypes:$,getLinkError:w,getTypeFromError:se,getValuesFromError:ce},Symbol.toStringTag,{value:"Module"})),ie=({sessionId:e,remoteAddress:t,isMutedAudio:n,isMutedVideo:s,isRegistered:o,isPresentationCall:c})=>{const a=[],u=n?"0":"1",l=s?"0":"1";return a.push(`X-Vinteo-Mic-State: ${u}`,`X-Vinteo-MainCam-State: ${l}`),o||a.push("X-Vinteo-Purgatory-Call: yes"),e&&a.push(`X-Vinteo-Session: ${e}`),c&&a.push("X-Vinteo-Presentation-Call: yes"),t&&a.push(`X-Vinteo-Remote: ${t}`),a},ue="[@*!|]",le="_",ge=e=>{let t=e;return t=t.replaceAll(new RegExp(ue,"g"),le),t},Se=({appName:e,appVersion:t,browserName:n,browserVersion:s})=>{const c=`${ge(e)} ${t}`;return`ChromeNew - ${n?`${n} ${s}, ${c}`:c}`},de=({isUnifiedSdpSemantic:e,appVersion:t,browserName:n,browserVersion:s,appName:o})=>e?Se({appVersion:t,browserName:n,browserVersion:s,appName:o}):"Chrome",me=e=>async()=>{if(e.isCallActive)return r.logger("askPermissionToEnableCam"),e.askPermissionToEnableCam()},fe=e=>n=>(r.logger("onMustStopPresentation"),e.onSession("mustStopPresentation",n)),Ce=e=>n=>(r.logger("onMoveToSpectators"),e.onSession("participant:move-request-to-spectators",n)),Ee=e=>n=>(r.logger("onUseLicense"),e.onSession("useLicense",n)),Me=e=>async({isEnabledCam:n,isEnabledMic:s})=>{if(e.isCallActive)return r.logger("sendMediaState"),e.sendMediaState({cam:n,mic:s})},Re=e=>async()=>{if(e.isCallActive)return r.logger("sendRefusalToTurnOnCam"),e.sendRefusalToTurnOnCam().catch(n=>{r.logger("sendRefusalToTurnOnCam: error",n)})},Te=e=>async()=>{if(e.isCallActive)return r.logger("sendRefusalToTurnOnMic"),e.sendRefusalToTurnOnMic().catch(n=>{r.logger("sendRefusalToTurnOnMic: error",n)})},ye=1e6,be=({maxBitrate:e=ye,sipConnector:t})=>async({mediaStream:s,isP2P:o=!1})=>(r.logger("startPresentation"),t.startPresentation(s,{isP2P:o,maxBitrate:e})),_e=({sipConnector:e})=>async({isP2P:n=!1}={})=>(r.logger("stopShareSipConnector"),e.stopPresentation({isP2P:n}).catch(s=>{r.logger(s)})),he=1e6,ve=({sipConnector:e,maxBitrate:t=he})=>async({mediaStream:s,isP2P:o=!1})=>(r.logger("updatePresentation"),e.updatePresentation(s,{isP2P:o,maxBitrate:t})),Oe=e=>t=>[...t].map(s=>async()=>e(s)),Ae=async({accumulatedKeys:e,sendKey:t,canRunTask:n})=>{const o=Oe(t)(e);return z.sequentPromises(o,n)},pe=e=>n=>(r.logger("onStartMainCam"),e.onSession("admin-start-main-cam",n)),Ne=e=>n=>(r.logger("onStartMic"),e.onSession("admin-start-mic",n)),Pe=e=>n=>(r.logger("onStopMainCam"),e.onSession("admin-stop-main-cam",n)),Be=e=>n=>(r.logger("onStopMic"),e.onSession("admin-stop-mic",n)),Ie=({sipConnector:e})=>{const t=(f,M)=>({isSyncForced:y=!1})=>{if(y){f();return}M()},n=pe(e),s=Pe(e),o=Ne(e),c=Be(e);let a=()=>{},u=()=>{},l=()=>{},d=()=>{};const m=({onStartMainCamForced:f,onStartMainCamNotForced:M,onStopMainCamForced:y,onStopMainCamNotForced:_,onStartMicForced:h,onStartMicNotForced:R,onStopMicForced:T,onStopMicNotForced:N})=>{const b=t(f,M);a=n(b);const v=t(y,_);u=s(v);const O=t(h,R);l=o(O);const A=t(T,N);d=c(A)},g=()=>{a(),u(),l(),d()};return{start:f=>{m(f)},stop:()=>{g()}}},De=Object.freeze(Object.defineProperty({__proto__:null,PURGATORY_CONFERENCE_NUMBER:L,createSyncMediaState:Ie,error:ae,getExtraHeaders:ie,getUserAgent:de,hasPurgatory:p,resolveAnswerIncomingCall:ee,resolveAskPermissionToEnableCam:me,resolveCallToServer:ne,resolveConnectToServer:te,resolveDisconnectFromServer:re,resolveGetRemoteStreams:I,resolveOnMoveToSpectators:Ce,resolveOnMustStopPresentation:fe,resolveOnUseLicense:Ee,resolveSendMediaState:Me,resolveSendRefusalToTurnOnCam:Re,resolveSendRefusalToTurnOnMic:Te,resolveStartPresentation:be,resolveStopShareSipConnector:_e,resolveUpdatePresentation:ve,resolveUpdateRemoteStreams:D,sendDTMFAccumulated:Ae},Symbol.toStringTag,{value:"Module"})),we=e=>[...e.keys()].map(t=>e.get(t)),Fe=(e,t)=>we(e).find(n=>n.type===t),x=async e=>e.getStats().then(t=>{const n=Fe(t,"codec");return n==null?void 0:n.mimeType}),ke=e=>e.find(t=>{var n;return((n=t==null?void 0:t.track)==null?void 0:n.kind)==="video"}),q=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase().includes(t.toLowerCase()),Ue=1e6,E=e=>e*Ue,G=E(.06),Le=E(4),Ve=e=>e<=64?G:e<=128?E(.12):e<=256?E(.25):e<=384?E(.32):e<=426?E(.38):e<=640?E(.5):e<=848?E(.7):e<=1280?E(1):e<=1920?E(2):Le,$e="av1",xe=e=>q(e,$e),qe=.6,X=(e,t)=>xe(t)?e*qe:e,Ge=e=>X(G,e),W=(e,t)=>{const n=Ve(e);return X(n,t)},j=J.createStackPromises(),Xe=async()=>j().catch(e=>{r.logger("videoSendingBalancer: error",e)}),We=async e=>(j.add(e),Xe()),F=async({sender:e,scaleResolutionDownBy:t,maxBitrate:n,onSetParameters:s})=>We(async()=>r.setEncodingsToSender(e,{scaleResolutionDownBy:t,maxBitrate:n},s)),je=async({sender:e,codec:t},n)=>{const o=Ge(t);return F({sender:e,maxBitrate:o,onSetParameters:n,scaleResolutionDownBy:200})},B=async({sender:e,track:t,codec:n},s)=>{const a=t.getSettings().width,u=W(a,n);return F({sender:e,maxBitrate:u,onSetParameters:s,scaleResolutionDownBy:1})},Ke=async({sender:e,track:t,resolution:n,codec:s},o)=>{const c=t.getSettings(),a=c.width,u=c.height,[l,d]=n.split("x"),m=a/Number(l),g=u/Number(d),S=Math.max(m,g,1),f=W(Number(l),s);return F({sender:e,maxBitrate:f,onSetParameters:o,scaleResolutionDownBy:S})},He=async({mainCam:e,resolutionMainCam:t,sender:n,track:s,codec:o},c)=>{switch(e){case r.EEventsMainCAM.PAUSE_MAIN_CAM:return je({sender:n,codec:o},c);case r.EEventsMainCAM.RESUME_MAIN_CAM:return B({sender:n,track:s,codec:o},c);case r.EEventsMainCAM.MAX_MAIN_CAM_RESOLUTION:return t!==void 0?Ke({sender:n,track:s,codec:o,resolution:t},c):B({sender:n,track:s,codec:o},c);default:return B({sender:n,track:s,codec:o},c)}},k={isChanged:!1,parameters:{encodings:[{}],transactionId:"0",codecs:[],headerExtensions:[],rtcp:{}}},U=async({mainCam:e,resolutionMainCam:t,connection:n,onSetParameters:s,ignoreForCodec:o})=>{const c=n.getSenders(),a=ke(c);if(!(a!=null&&a.track))return k;const u=await x(a);return q(u,o)?k:He({mainCam:e,resolutionMainCam:t,sender:a,codec:u,track:a.track},s)},Ye=(e,{ignoreForCodec:t,onSetParameters:n}={})=>{const s=async()=>{const{connection:l}=e;if(!l)throw new Error("connection is not exist");return U({connection:l,onSetParameters:n,ignoreForCodec:t})};let o=s;const c=async l=>(o=async()=>{const{mainCam:d,resolutionMainCam:m}=l,{connection:g}=e;if(!g)throw new Error("connection is not exist");return U({mainCam:d,resolutionMainCam:m,connection:g,onSetParameters:n,ignoreForCodec:t})},o());return{subscribe:()=>{e.onSession("main-cam-control",c)},unsubscribe:()=>{e.offSession("main-cam-control",c)},balanceByTrack:s,resetMainCamControl(){o=s},async reBalance(){return o()}}};exports.EEventsMainCAM=r.EEventsMainCAM;exports.EEventsMic=r.EEventsMic;exports.EEventsSyncMediaState=r.EEventsSyncMediaState;exports.EUseLicense=r.EUseLicense;exports.causes=r.causes;exports.constants=r.constants;exports.default=r.SipConnector;exports.disableDebug=r.disableDebug;exports.enableDebug=r.enableDebug;exports.eventNames=r.eventNames;exports.hasCanceledCallError=r.hasCanceledCallError;exports.debug=Q;exports.getCodecFromSender=x;exports.resolveVideoSendingBalancer=Ye;exports.tools=De;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./SipConnector-zjYmhYTk.cjs"),K=require("ts-debounce"),H=require("@krivega/cancelable-promise"),Y=require("repeated-calls"),z=require("sequent-promises"),J=require("stack-promises"),Q=require("debug"),L="purgatory",p=e=>e===L,I=e=>()=>(r.logger("getRemoteStreams"),e.getRemoteStreams()),Z=({kind:e,readyState:t})=>e==="video"&&t==="live",V=e=>({track:t})=>{Z(t)&&e()},D=({getRemoteStreams:e,setRemoteStreams:t})=>K.debounce(()=>{const n=e();r.logger("remoteStreams",n),n&&t(n)},200),ee=e=>async n=>{const{mediaStream:s,extraHeaders:o,iceServers:c,degradationPreference:a,setRemoteStreams:u,onBeforeProgressCall:l,onSuccessProgressCall:d,onEnterPurgatory:m,onEnterConference:g,onFailProgressCall:S,onFinishProgressCall:T,onEndedCall:f}=n,E=D({setRemoteStreams:u,getRemoteStreams:I(e)}),y=V(E);r.logger("answerIncomingCall",n);const _=async()=>e.answerToIncomingCall({mediaStream:s,extraHeaders:o,iceServers:c,degradationPreference:a,ontrack:y}),h=()=>{const{remoteCallerData:i}=e;return i.incomingNumber};let M=!1,R;const b=(r.logger("subscribeEnterConference: onEnterConference",g),m??g?e.onSession("enterRoom",i=>{r.logger("enterRoom",{_room:i,isSuccessProgressCall:M}),R=i,p(R)?m&&m():g&&g({isSuccessProgressCall:M})}):()=>{}),v=i=>(r.logger("onSuccess"),M=!0,E(),d&&d({isPurgatory:p(R)}),e.onceRaceSession(["ended","failed"],()=>{b(),f&&f()}),i),O=i=>{throw r.logger("onFail"),S&&S(),b(),i},A=()=>{r.logger("onFinish"),T&&T()};if(r.logger("onBeforeProgressCall"),l){const i=h();l(i)}return _().then(v).catch(i=>O(i)).finally(A)},ne=e=>async n=>{const{conference:s,mediaStream:o,extraHeaders:c,iceServers:a,degradationPreference:u,setRemoteStreams:l,onBeforeProgressCall:d,onSuccessProgressCall:m,onEnterPurgatory:g,onEnterConference:S,onFailProgressCall:T,onFinishProgressCall:f,onEndedCall:E}=n,y=D({setRemoteStreams:l,getRemoteStreams:I(e)}),_=V(y);r.logger("callToServer",n);const h=async()=>(r.logger("startCall"),e.call({mediaStream:o,extraHeaders:c,iceServers:a,degradationPreference:u,number:s,ontrack:_}));let M=!1,R;const b=(r.logger("subscribeEnterConference: onEnterConference",S),g??S?e.onSession("enterRoom",({room:i})=>{r.logger("enterRoom",{_room:i,isSuccessProgressCall:M}),R=i,p(R)?g&&g():S&&S({isSuccessProgressCall:M})}):()=>{}),v=i=>(r.logger("onSuccess"),M=!0,y(),m&&m({isPurgatory:p(R)}),e.onceRaceSession(["ended","failed"],()=>{b(),E&&E()}),i),O=i=>{throw r.logger("onFail"),T&&T(),b(),i},A=()=>{r.logger("onFinish"),f&&f()};return r.logger("onBeforeProgressCall"),d&&d(s),h().then(v).catch(i=>O(i)).finally(A)},P=e=>{if(!H.isCanceledError(e)&&!Y.hasCanceledError(e))throw e;return{isSuccessful:!1}},te=e=>async n=>{const{userAgent:s,sipWebSocketServerURL:o,sipServerUrl:c,remoteAddress:a,displayName:u,name:l,password:d,isRegisteredUser:m,isDisconnectOnFail:g}=n;return r.logger("connectToServer",n),e.connect({userAgent:s,sipWebSocketServerURL:o,sipServerUrl:c,remoteAddress:a,displayName:u,password:d,user:l,register:m}).then(S=>(r.logger("connectToServer then"),{ua:S,isSuccessful:!0})).catch(async S=>(r.logger("connectToServer catch: error",S),g===!0?e.disconnect().then(()=>P(S)).catch(()=>P(S)):P(S)))},re=e=>async()=>(r.logger("disconnectFromServer"),e.disconnect().then(()=>(r.logger("disconnectFromServer: then"),{isSuccessful:!0})).catch(t=>(r.logger("disconnectFromServer: catch",t),{isSuccessful:!1}))),w=e=>{const{url:t,cause:n}=e;let s=t;return(n===r.BAD_MEDIA_DESCRIPTION||n===r.NOT_FOUND)&&(s=`${e.message.to.uri.user}@${e.message.to.uri.host}`),s};var $=(e=>(e.CONNECT_SERVER_FAILED="CONNECT_SERVER_FAILED",e.WRONG_USER_OR_PASSWORD="WRONG_USER_OR_PASSWORD",e.BAD_MEDIA_ERROR="BAD_MEDIA_ERROR",e.NOT_FOUND_ERROR="NOT_FOUND_ERROR",e.WS_CONNECTION_FAILED="WS_CONNECTION_FAILED",e.CONNECT_SERVER_FAILED_BY_LINK="CONNECT_SERVER_FAILED_BY_LINK",e))($||{});const se=(e=new Error)=>{var o;const{cause:t,socket:n}=e;let s="CONNECT_SERVER_FAILED";switch(t){case"Forbidden":{s="WRONG_USER_OR_PASSWORD";break}case r.BAD_MEDIA_DESCRIPTION:{s="BAD_MEDIA_ERROR";break}case r.NOT_FOUND:{s="NOT_FOUND_ERROR";break}default:n&&((o=n==null?void 0:n._ws)==null?void 0:o.readyState)===3?s="WS_CONNECTION_FAILED":w(e)&&(s="CONNECT_SERVER_FAILED_BY_LINK")}return s},oe=e=>{let t="";try{t=JSON.stringify(e)}catch(n){r.logger("failed to stringify message",n)}return t},ce=(e=new Error)=>{const{code:t,cause:n,message:s}=e,o=w(e),c={code:"",cause:"",message:""};return typeof s=="object"&&s!==null?c.message=oe(s):s&&(c.message=String(s)),o&&(c.link=o),t&&(c.code=t),n&&(c.cause=n),c},ae=Object.freeze(Object.defineProperty({__proto__:null,EErrorTypes:$,getLinkError:w,getTypeFromError:se,getValuesFromError:ce},Symbol.toStringTag,{value:"Module"})),ie=({sessionId:e,remoteAddress:t,isMutedAudio:n,isMutedVideo:s,isRegistered:o,isPresentationCall:c})=>{const a=[],u=n?"0":"1",l=s?"0":"1";return a.push(`X-Vinteo-Mic-State: ${u}`,`X-Vinteo-MainCam-State: ${l}`),o||a.push("X-Vinteo-Purgatory-Call: yes"),e&&a.push(`X-Vinteo-Session: ${e}`),c&&a.push("X-Vinteo-Presentation-Call: yes"),t&&a.push(`X-Vinteo-Remote: ${t}`),a},ue="[@*!|]",le="_",ge=e=>{let t=e;return t=t.replaceAll(new RegExp(ue,"g"),le),t},Se=({appName:e,appVersion:t,browserName:n,browserVersion:s})=>{const c=`${ge(e)} ${t}`;return`ChromeNew - ${n?`${n} ${s}, ${c}`:c}`},de=({isUnifiedSdpSemantic:e,appVersion:t,browserName:n,browserVersion:s,appName:o})=>e?Se({appVersion:t,browserName:n,browserVersion:s,appName:o}):"Chrome",me=e=>async()=>{if(e.isCallActive)return r.logger("askPermissionToEnableCam"),e.askPermissionToEnableCam()},fe=e=>n=>(r.logger("onMustStopPresentation"),e.onSession("mustStopPresentation",n)),Ce=e=>n=>(r.logger("onMoveToSpectators"),e.onSession("participant:move-request-to-spectators",n)),Ee=e=>n=>(r.logger("onUseLicense"),e.onSession("useLicense",n)),Me=e=>async({isEnabledCam:n,isEnabledMic:s})=>{if(e.isCallActive)return r.logger("sendMediaState"),e.sendMediaState({cam:n,mic:s})},Re=e=>async()=>{if(e.isCallActive)return r.logger("sendRefusalToTurnOnCam"),e.sendRefusalToTurnOnCam().catch(n=>{r.logger("sendRefusalToTurnOnCam: error",n)})},Te=e=>async()=>{if(e.isCallActive)return r.logger("sendRefusalToTurnOnMic"),e.sendRefusalToTurnOnMic().catch(n=>{r.logger("sendRefusalToTurnOnMic: error",n)})},ye=1e6,be=({maxBitrate:e=ye,sipConnector:t})=>async({mediaStream:s,isP2P:o=!1})=>(r.logger("startPresentation"),t.startPresentation(s,{isP2P:o,maxBitrate:e})),_e=({sipConnector:e})=>async({isP2P:n=!1}={})=>(r.logger("stopShareSipConnector"),e.stopPresentation({isP2P:n}).catch(s=>{r.logger(s)})),he=1e6,ve=({sipConnector:e,maxBitrate:t=he})=>async({mediaStream:s,isP2P:o=!1})=>(r.logger("updatePresentation"),e.updatePresentation(s,{isP2P:o,maxBitrate:t})),Oe=e=>t=>[...t].map(s=>async()=>e(s)),Ae=async({accumulatedKeys:e,sendKey:t,canRunTask:n})=>{const o=Oe(t)(e);return z.sequentPromises(o,n)},pe=e=>n=>(r.logger("onStartMainCam"),e.onSession("admin-start-main-cam",n)),Ne=e=>n=>(r.logger("onStartMic"),e.onSession("admin-start-mic",n)),Pe=e=>n=>(r.logger("onStopMainCam"),e.onSession("admin-stop-main-cam",n)),Be=e=>n=>(r.logger("onStopMic"),e.onSession("admin-stop-mic",n)),Ie=({sipConnector:e})=>{const t=(f,E)=>({isSyncForced:y=!1})=>{if(y){f();return}E()},n=pe(e),s=Pe(e),o=Ne(e),c=Be(e);let a=()=>{},u=()=>{},l=()=>{},d=()=>{};const m=({onStartMainCamForced:f,onStartMainCamNotForced:E,onStopMainCamForced:y,onStopMainCamNotForced:_,onStartMicForced:h,onStartMicNotForced:M,onStopMicForced:R,onStopMicNotForced:N})=>{const b=t(f,E);a=n(b);const v=t(y,_);u=s(v);const O=t(h,M);l=o(O);const A=t(R,N);d=c(A)},g=()=>{a(),u(),l(),d()};return{start:f=>{m(f)},stop:()=>{g()}}},De=Object.freeze(Object.defineProperty({__proto__:null,PURGATORY_CONFERENCE_NUMBER:L,createSyncMediaState:Ie,error:ae,getExtraHeaders:ie,getUserAgent:de,hasPurgatory:p,resolveAnswerIncomingCall:ee,resolveAskPermissionToEnableCam:me,resolveCallToServer:ne,resolveConnectToServer:te,resolveDisconnectFromServer:re,resolveGetRemoteStreams:I,resolveOnMoveToSpectators:Ce,resolveOnMustStopPresentation:fe,resolveOnUseLicense:Ee,resolveSendMediaState:Me,resolveSendRefusalToTurnOnCam:Re,resolveSendRefusalToTurnOnMic:Te,resolveStartPresentation:be,resolveStopShareSipConnector:_e,resolveUpdatePresentation:ve,resolveUpdateRemoteStreams:D,sendDTMFAccumulated:Ae},Symbol.toStringTag,{value:"Module"})),we=e=>[...e.keys()].map(t=>e.get(t)),Fe=(e,t)=>we(e).find(n=>n.type===t),x=async e=>e.getStats().then(t=>{const n=Fe(t,"codec");return n==null?void 0:n.mimeType}),ke=e=>e.find(t=>{var n;return((n=t==null?void 0:t.track)==null?void 0:n.kind)==="video"}),q=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase().includes(t.toLowerCase()),Ue=1e6,C=e=>e*Ue,G=C(.06),Le=C(4),Ve=e=>e<=64?G:e<=128?C(.12):e<=256?C(.25):e<=384?C(.32):e<=426?C(.38):e<=640?C(.5):e<=848?C(.7):e<=1280?C(1):e<=1920?C(2):Le,$e="av1",xe=e=>q(e,$e),qe=.6,X=(e,t)=>xe(t)?e*qe:e,Ge=e=>X(G,e),W=(e,t)=>{const n=Ve(e);return X(n,t)},j=J.createStackPromises(),Xe=async()=>j().catch(e=>{r.logger("videoSendingBalancer: error",e)}),We=async e=>(j.add(e),Xe()),F=async({sender:e,scaleResolutionDownBy:t,maxBitrate:n,onSetParameters:s})=>We(async()=>r.setEncodingsToSender(e,{scaleResolutionDownBy:t,maxBitrate:n},s)),je=async({sender:e,codec:t},n)=>{const o=Ge(t);return F({sender:e,maxBitrate:o,onSetParameters:n,scaleResolutionDownBy:200})},B=async({sender:e,track:t,codec:n},s)=>{const a=t.getSettings().width,u=W(a,n);return F({sender:e,maxBitrate:u,onSetParameters:s,scaleResolutionDownBy:1})},Ke=async({sender:e,track:t,resolution:n,codec:s},o)=>{const c=t.getSettings(),a=c.width,u=c.height,[l,d]=n.split("x"),m=a/Number(l),g=u/Number(d),T=Math.max(m,g,1),f=W(Number(l),s);return F({sender:e,maxBitrate:f,onSetParameters:o,scaleResolutionDownBy:T})},He=async({mainCam:e,resolutionMainCam:t,sender:n,track:s,codec:o},c)=>{switch(e){case r.EEventsMainCAM.PAUSE_MAIN_CAM:return je({sender:n,codec:o},c);case r.EEventsMainCAM.RESUME_MAIN_CAM:return B({sender:n,track:s,codec:o},c);case r.EEventsMainCAM.MAX_MAIN_CAM_RESOLUTION:return t!==void 0?Ke({sender:n,track:s,codec:o,resolution:t},c):B({sender:n,track:s,codec:o},c);default:return B({sender:n,track:s,codec:o},c)}},k={isChanged:!1,parameters:{encodings:[{}],transactionId:"0",codecs:[],headerExtensions:[],rtcp:{}}},U=async({mainCam:e,resolutionMainCam:t,connection:n,onSetParameters:s,ignoreForCodec:o})=>{const c=n.getSenders(),a=ke(c);if(!(a!=null&&a.track))return k;const u=await x(a);return q(u,o)?k:He({mainCam:e,resolutionMainCam:t,sender:a,codec:u,track:a.track},s)},Ye=(e,{ignoreForCodec:t,onSetParameters:n}={})=>{const s=async()=>{const{connection:l}=e;if(!l)throw new Error("connection is not exist");return U({connection:l,onSetParameters:n,ignoreForCodec:t})};let o=s;const c=async l=>(o=async()=>{const{mainCam:d,resolutionMainCam:m}=l,{connection:g}=e;if(!g)throw new Error("connection is not exist");return U({mainCam:d,resolutionMainCam:m,connection:g,onSetParameters:n,ignoreForCodec:t})},o());return{subscribe:()=>{e.onSession("main-cam-control",c)},unsubscribe:()=>{e.offSession("main-cam-control",c)},balanceByTrack:s,resetMainCamControl(){o=s},async reBalance(){return o()}}};exports.EEventsMainCAM=r.EEventsMainCAM;exports.EEventsMic=r.EEventsMic;exports.EEventsSyncMediaState=r.EEventsSyncMediaState;exports.EUseLicense=r.EUseLicense;exports.causes=r.causes;exports.constants=r.constants;exports.default=r.SipConnector;exports.disableDebug=r.disableDebug;exports.enableDebug=r.enableDebug;exports.eventNames=r.eventNames;exports.hasCanceledCallError=r.hasCanceledCallError;exports.debug=Q;exports.getCodecFromSender=x;exports.resolveVideoSendingBalancer=Ye;exports.tools=De;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as o, B as V, N as x, E as B, s as q, S as Qe } from "./SipConnector-
|
|
2
|
-
import { f as un, g as ln, i as Sn, c as mn, a as dn, d as fn, b as Cn, e as gn, h as Rn } from "./SipConnector-
|
|
1
|
+
import { l as o, B as V, N as x, E as B, s as q, S as Qe } from "./SipConnector-4t573yj1.js";
|
|
2
|
+
import { f as un, g as ln, i as Sn, c as mn, a as dn, d as fn, b as Cn, e as gn, h as Rn } from "./SipConnector-4t573yj1.js";
|
|
3
3
|
import { debounce as z } from "ts-debounce";
|
|
4
4
|
import { isCanceledError as J } from "@krivega/cancelable-promise";
|
|
5
5
|
import { hasCanceledError as Q } from "repeated-calls";
|
|
@@ -25,13 +25,13 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
25
25
|
onSuccessProgressCall: d,
|
|
26
26
|
onEnterPurgatory: f,
|
|
27
27
|
onEnterConference: S,
|
|
28
|
-
onFailProgressCall:
|
|
29
|
-
onFinishProgressCall:
|
|
28
|
+
onFailProgressCall: m,
|
|
29
|
+
onFinishProgressCall: M,
|
|
30
30
|
onEndedCall: C
|
|
31
|
-
} = n,
|
|
31
|
+
} = n, R = D({
|
|
32
32
|
setRemoteStreams: u,
|
|
33
33
|
getRemoteStreams: w(e)
|
|
34
|
-
}), y = G(
|
|
34
|
+
}), y = G(R);
|
|
35
35
|
o("answerIncomingCall", n);
|
|
36
36
|
const h = async () => e.answerToIncomingCall({
|
|
37
37
|
mediaStream: r,
|
|
@@ -43,16 +43,16 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
43
43
|
const { remoteCallerData: i } = e;
|
|
44
44
|
return i.incomingNumber;
|
|
45
45
|
};
|
|
46
|
-
let
|
|
46
|
+
let E = !1, T;
|
|
47
47
|
const _ = (o("subscribeEnterConference: onEnterConference", S), f ?? S ? e.onSession("enterRoom", (i) => {
|
|
48
|
-
o("enterRoom", { _room: i, isSuccessProgressCall:
|
|
48
|
+
o("enterRoom", { _room: i, isSuccessProgressCall: E }), T = i, N(T) ? f && f() : S && S({ isSuccessProgressCall: E });
|
|
49
49
|
}) : () => {
|
|
50
|
-
}), p = (i) => (o("onSuccess"),
|
|
50
|
+
}), p = (i) => (o("onSuccess"), E = !0, R(), d && d({ isPurgatory: N(T) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
51
51
|
_(), C && C();
|
|
52
52
|
}), i), O = (i) => {
|
|
53
|
-
throw o("onFail"),
|
|
53
|
+
throw o("onFail"), m && m(), _(), i;
|
|
54
54
|
}, v = () => {
|
|
55
|
-
o("onFinish"),
|
|
55
|
+
o("onFinish"), M && M();
|
|
56
56
|
};
|
|
57
57
|
if (o("onBeforeProgressCall"), l) {
|
|
58
58
|
const i = b();
|
|
@@ -70,10 +70,10 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
70
70
|
onBeforeProgressCall: d,
|
|
71
71
|
onSuccessProgressCall: f,
|
|
72
72
|
onEnterPurgatory: S,
|
|
73
|
-
onEnterConference:
|
|
74
|
-
onFailProgressCall:
|
|
73
|
+
onEnterConference: m,
|
|
74
|
+
onFailProgressCall: M,
|
|
75
75
|
onFinishProgressCall: C,
|
|
76
|
-
onEndedCall:
|
|
76
|
+
onEndedCall: R
|
|
77
77
|
} = n, y = D({
|
|
78
78
|
setRemoteStreams: l,
|
|
79
79
|
getRemoteStreams: w(e)
|
|
@@ -87,14 +87,14 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
87
87
|
number: r,
|
|
88
88
|
ontrack: h
|
|
89
89
|
}));
|
|
90
|
-
let
|
|
91
|
-
const _ = (o("subscribeEnterConference: onEnterConference",
|
|
92
|
-
o("enterRoom", { _room: i, isSuccessProgressCall:
|
|
90
|
+
let E = !1, T;
|
|
91
|
+
const _ = (o("subscribeEnterConference: onEnterConference", m), S ?? m ? e.onSession("enterRoom", ({ room: i }) => {
|
|
92
|
+
o("enterRoom", { _room: i, isSuccessProgressCall: E }), T = i, N(T) ? S && S() : m && m({ isSuccessProgressCall: E });
|
|
93
93
|
}) : () => {
|
|
94
|
-
}), p = (i) => (o("onSuccess"),
|
|
95
|
-
_(),
|
|
94
|
+
}), p = (i) => (o("onSuccess"), E = !0, y(), f && f({ isPurgatory: N(T) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
95
|
+
_(), R && R();
|
|
96
96
|
}), i), O = (i) => {
|
|
97
|
-
throw o("onFail"),
|
|
97
|
+
throw o("onFail"), M && M(), _(), i;
|
|
98
98
|
}, v = () => {
|
|
99
99
|
o("onFinish"), C && C();
|
|
100
100
|
};
|
|
@@ -113,12 +113,10 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
113
113
|
name: l,
|
|
114
114
|
password: d,
|
|
115
115
|
isRegisteredUser: f,
|
|
116
|
-
|
|
117
|
-
isDisconnectOnFail: g
|
|
116
|
+
isDisconnectOnFail: S
|
|
118
117
|
} = n;
|
|
119
118
|
return o("connectToServer", n), e.connect({
|
|
120
119
|
userAgent: r,
|
|
121
|
-
sdpSemantics: S,
|
|
122
120
|
sipWebSocketServerURL: s,
|
|
123
121
|
sipServerUrl: a,
|
|
124
122
|
remoteAddress: c,
|
|
@@ -126,7 +124,7 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
126
124
|
password: d,
|
|
127
125
|
user: l,
|
|
128
126
|
register: f
|
|
129
|
-
}).then((m) => (o("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (o("connectToServer catch: error", m),
|
|
127
|
+
}).then((m) => (o("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (o("connectToServer catch: error", m), S === !0 ? e.disconnect().then(() => I(m)).catch(() => I(m)) : I(m)));
|
|
130
128
|
}, oe = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), F = (e) => {
|
|
131
129
|
const { url: t, cause: n } = e;
|
|
132
130
|
let r = t;
|
|
@@ -247,12 +245,12 @@ const ae = (e = new Error()) => {
|
|
|
247
245
|
const s = Ne(t)(e);
|
|
248
246
|
return Z(s, n);
|
|
249
247
|
}, Be = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Ie = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), Pe = (e) => (n) => (o("onStopMainCam"), e.onSession("admin-stop-main-cam", n)), we = (e) => (n) => (o("onStopMic"), e.onSession("admin-stop-mic", n)), De = ({ sipConnector: e }) => {
|
|
250
|
-
const t = (C,
|
|
248
|
+
const t = (C, R) => ({ isSyncForced: y = !1 }) => {
|
|
251
249
|
if (y) {
|
|
252
250
|
C();
|
|
253
251
|
return;
|
|
254
252
|
}
|
|
255
|
-
|
|
253
|
+
R();
|
|
256
254
|
}, n = Be(e), r = Pe(e), s = Ie(e), a = we(e);
|
|
257
255
|
let c = () => {
|
|
258
256
|
}, u = () => {
|
|
@@ -261,17 +259,17 @@ const ae = (e = new Error()) => {
|
|
|
261
259
|
};
|
|
262
260
|
const f = ({
|
|
263
261
|
onStartMainCamForced: C,
|
|
264
|
-
onStartMainCamNotForced:
|
|
262
|
+
onStartMainCamNotForced: R,
|
|
265
263
|
onStopMainCamForced: y,
|
|
266
264
|
onStopMainCamNotForced: h,
|
|
267
265
|
onStartMicForced: b,
|
|
268
|
-
onStartMicNotForced:
|
|
269
|
-
onStopMicForced:
|
|
266
|
+
onStartMicNotForced: E,
|
|
267
|
+
onStopMicForced: T,
|
|
270
268
|
onStopMicNotForced: A
|
|
271
269
|
}) => {
|
|
272
270
|
const _ = t(
|
|
273
271
|
C,
|
|
274
|
-
|
|
272
|
+
R
|
|
275
273
|
);
|
|
276
274
|
c = n(_);
|
|
277
275
|
const p = t(
|
|
@@ -279,9 +277,9 @@ const ae = (e = new Error()) => {
|
|
|
279
277
|
h
|
|
280
278
|
);
|
|
281
279
|
u = r(p);
|
|
282
|
-
const O = t(b,
|
|
280
|
+
const O = t(b, E);
|
|
283
281
|
l = s(O);
|
|
284
|
-
const v = t(
|
|
282
|
+
const v = t(T, A);
|
|
285
283
|
d = a(v);
|
|
286
284
|
}, S = () => {
|
|
287
285
|
c(), u(), l(), d();
|
|
@@ -325,7 +323,7 @@ const ae = (e = new Error()) => {
|
|
|
325
323
|
}), Le = (e) => e.find((t) => {
|
|
326
324
|
var n;
|
|
327
325
|
return ((n = t == null ? void 0 : t.track) == null ? void 0 : n.kind) === "video";
|
|
328
|
-
}), W = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Ve = 1e6,
|
|
326
|
+
}), W = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Ve = 1e6, g = (e) => e * Ve, K = g(0.06), xe = g(4), $e = (e) => e <= 64 ? K : e <= 128 ? g(0.12) : e <= 256 ? g(0.25) : e <= 384 ? g(0.32) : e <= 426 ? g(0.38) : e <= 640 ? g(0.5) : e <= 848 ? g(0.7) : e <= 1280 ? g(1) : e <= 1920 ? g(2) : xe, Ge = "av1", Xe = (e) => W(e, Ge), We = 0.6, j = (e, t) => Xe(t) ? e * We : e, Ke = (e) => j(K, e), H = (e, t) => {
|
|
329
327
|
const n = $e(e);
|
|
330
328
|
return j(n, t);
|
|
331
329
|
}, Y = ee(), je = async () => Y().catch((e) => {
|
|
@@ -357,12 +355,12 @@ const ae = (e = new Error()) => {
|
|
|
357
355
|
resolution: n,
|
|
358
356
|
codec: r
|
|
359
357
|
}, s) => {
|
|
360
|
-
const a = t.getSettings(), c = a.width, u = a.height, [l, d] = n.split("x"), f = c / Number(l), S = u / Number(d),
|
|
358
|
+
const a = t.getSettings(), c = a.width, u = a.height, [l, d] = n.split("x"), f = c / Number(l), S = u / Number(d), M = Math.max(f, S, 1), C = H(Number(l), r);
|
|
361
359
|
return k({
|
|
362
360
|
sender: e,
|
|
363
361
|
maxBitrate: C,
|
|
364
362
|
onSetParameters: s,
|
|
365
|
-
scaleResolutionDownBy:
|
|
363
|
+
scaleResolutionDownBy: M
|
|
366
364
|
});
|
|
367
365
|
}, ze = async ({
|
|
368
366
|
mainCam: e,
|
|
@@ -8,7 +8,6 @@ export declare const dataForConnectionWithAuthorization: {
|
|
|
8
8
|
remoteAddress: string;
|
|
9
9
|
sipServerUrl: string;
|
|
10
10
|
sipWebSocketServerURL: string;
|
|
11
|
-
sdpSemantics: "plan-b";
|
|
12
11
|
userAgent: string;
|
|
13
12
|
};
|
|
14
13
|
export declare const dataForConnectionWithAuthorizationWithDisplayName: {
|
|
@@ -16,7 +15,6 @@ export declare const dataForConnectionWithAuthorizationWithDisplayName: {
|
|
|
16
15
|
remoteAddress: string;
|
|
17
16
|
sipServerUrl: string;
|
|
18
17
|
sipWebSocketServerURL: string;
|
|
19
|
-
sdpSemantics: "plan-b";
|
|
20
18
|
userAgent: string;
|
|
21
19
|
};
|
|
22
20
|
export declare const dataForConnectionWithoutAuthorization: {
|
|
@@ -25,7 +23,6 @@ export declare const dataForConnectionWithoutAuthorization: {
|
|
|
25
23
|
remoteAddress: string;
|
|
26
24
|
sipServerUrl: string;
|
|
27
25
|
sipWebSocketServerURL: string;
|
|
28
|
-
sdpSemantics: "plan-b";
|
|
29
26
|
userAgent: string;
|
|
30
27
|
};
|
|
31
28
|
export declare const dataForConnectionWithoutAuthorizationWithoutDisplayName: {
|
|
@@ -34,7 +31,6 @@ export declare const dataForConnectionWithoutAuthorizationWithoutDisplayName: {
|
|
|
34
31
|
remoteAddress: string;
|
|
35
32
|
sipServerUrl: string;
|
|
36
33
|
sipWebSocketServerURL: string;
|
|
37
|
-
sdpSemantics: "plan-b";
|
|
38
34
|
userAgent: string;
|
|
39
35
|
};
|
|
40
36
|
export declare const dataForConnectionWithoutAuthorizationWithSipServerUrlChanged: {
|
|
@@ -43,7 +39,6 @@ export declare const dataForConnectionWithoutAuthorizationWithSipServerUrlChange
|
|
|
43
39
|
isRegisteredUser: boolean;
|
|
44
40
|
remoteAddress: string;
|
|
45
41
|
sipWebSocketServerURL: string;
|
|
46
|
-
sdpSemantics: "plan-b";
|
|
47
42
|
userAgent: string;
|
|
48
43
|
};
|
|
49
44
|
export declare const dataForConnectionWithoutAuthorizationWithSipWebSocketServerUrlChanged: {
|
|
@@ -53,7 +48,6 @@ export declare const dataForConnectionWithoutAuthorizationWithSipWebSocketServer
|
|
|
53
48
|
isRegisteredUser: boolean;
|
|
54
49
|
remoteAddress: string;
|
|
55
50
|
sipServerUrl: string;
|
|
56
|
-
sdpSemantics: "plan-b";
|
|
57
51
|
userAgent: string;
|
|
58
52
|
};
|
|
59
53
|
export declare const dataForConnectionWithAuthorizationIncorrectUser: {
|
|
@@ -63,7 +57,6 @@ export declare const dataForConnectionWithAuthorizationIncorrectUser: {
|
|
|
63
57
|
remoteAddress: string;
|
|
64
58
|
sipServerUrl: string;
|
|
65
59
|
sipWebSocketServerURL: string;
|
|
66
|
-
sdpSemantics: "plan-b";
|
|
67
60
|
userAgent: string;
|
|
68
61
|
};
|
|
69
62
|
export declare const dataForConnectionWithAuthorizationIncorrectPassword: {
|
|
@@ -73,7 +66,6 @@ export declare const dataForConnectionWithAuthorizationIncorrectPassword: {
|
|
|
73
66
|
remoteAddress: string;
|
|
74
67
|
sipServerUrl: string;
|
|
75
68
|
sipWebSocketServerURL: string;
|
|
76
|
-
sdpSemantics: "plan-b";
|
|
77
69
|
userAgent: string;
|
|
78
70
|
};
|
|
79
71
|
export declare const withNameChanged: {
|
|
@@ -84,7 +76,6 @@ export declare const withNameChanged: {
|
|
|
84
76
|
remoteAddress: string;
|
|
85
77
|
sipServerUrl: string;
|
|
86
78
|
sipWebSocketServerURL: string;
|
|
87
|
-
sdpSemantics: "plan-b";
|
|
88
79
|
userAgent: string;
|
|
89
80
|
};
|
|
90
81
|
export declare const dataForConnectionWithAuthorizationPasswordChanged: {
|
|
@@ -95,7 +86,6 @@ export declare const dataForConnectionWithAuthorizationPasswordChanged: {
|
|
|
95
86
|
remoteAddress: string;
|
|
96
87
|
sipServerUrl: string;
|
|
97
88
|
sipWebSocketServerURL: string;
|
|
98
|
-
sdpSemantics: "plan-b";
|
|
99
89
|
userAgent: string;
|
|
100
90
|
};
|
|
101
91
|
export declare const uaConfigurationWithAuthorization: {
|
|
@@ -11,7 +11,6 @@ declare const resolveConnectToServer: (sipConnector: SipConnector) => (parameter
|
|
|
11
11
|
password?: string;
|
|
12
12
|
isRegisteredUser?: boolean;
|
|
13
13
|
isDisconnectOnFail?: boolean;
|
|
14
|
-
sdpSemantics: "plan-b" | "unified-plan";
|
|
15
14
|
}) => Promise<{
|
|
16
15
|
ua?: UA;
|
|
17
16
|
isSuccessful: boolean;
|
package/dist/types.d.ts
CHANGED