sip-connector 11.1.0 → 11.3.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.
@@ -6,6 +6,7 @@ declare const resolveAnswerIncomingCall: (sipConnector: SipConnector) => (parame
6
6
  iceServers?: RTCIceServer[];
7
7
  contentHint?: TContentHint;
8
8
  simulcastEncodings?: TSimulcastEncodings;
9
+ degradationPreference?: RTCDegradationPreference;
9
10
  sendEncodings?: RTCRtpEncodingParameters[];
10
11
  setRemoteStreams: (streams: MediaStream[]) => void;
11
12
  onBeforeProgressCall?: (conference?: string) => void;
@@ -7,6 +7,7 @@ declare const resolveCallToServer: (sipConnector: SipConnector) => (parameters:
7
7
  iceServers?: RTCIceServer[];
8
8
  contentHint?: TContentHint;
9
9
  simulcastEncodings?: TSimulcastEncodings;
10
+ degradationPreference?: RTCDegradationPreference;
10
11
  sendEncodings?: RTCRtpEncodingParameters[];
11
12
  setRemoteStreams: (streams: MediaStream[]) => void;
12
13
  onBeforeProgressCall?: (conference: string) => void;
@@ -10,6 +10,7 @@ export { default as resolveAskPermissionToEnableCam } from './resolveAskPermissi
10
10
  export { default as resolveGetRemoteStreams } from './resolveGetRemoteStreams';
11
11
  export { default as resolveOnMustStopPresentation } from './resolveOnMustStopPresentation';
12
12
  export { default as resolveOnMoveToSpectators } from './resolveOnMoveToSpectators';
13
+ export { default as resolveOnMoveToParticipants } from './resolveOnMoveToParticipants';
13
14
  export { default as resolveOnUseLicense } from './resolveOnUseLicense';
14
15
  export { default as resolveSendMediaState } from './resolveSendMediaState';
15
16
  export { default as resolveSendRefusalToTurnOnCam } from './resolveSendRefusalToTurnOnCam';
@@ -0,0 +1,3 @@
1
+ import { default as SipConnector } from '../SipConnector';
2
+ declare const resolveOnMoveToParticipants: (sipConnector: SipConnector) => (handler: () => void) => (() => void);
3
+ export default resolveOnMoveToParticipants;
@@ -1,11 +1,12 @@
1
1
  import { default as SipConnector } from '../SipConnector';
2
2
  import { TContentHint, TSimulcastEncodings } from '../types';
3
- declare const resolveStartPresentation: (sipConnector: SipConnector) => ({ mediaStream, isP2P, maxBitrate, contentHint, simulcastEncodings, sendEncodings, }: {
3
+ declare const resolveStartPresentation: (sipConnector: SipConnector) => ({ mediaStream, isP2P, maxBitrate, contentHint, simulcastEncodings, degradationPreference, sendEncodings, }: {
4
4
  mediaStream: MediaStream;
5
5
  isP2P: boolean;
6
6
  maxBitrate?: number;
7
7
  contentHint?: TContentHint;
8
8
  simulcastEncodings?: TSimulcastEncodings;
9
+ degradationPreference?: RTCDegradationPreference;
9
10
  sendEncodings?: RTCRtpEncodingParameters[];
10
11
  }, options?: {
11
12
  callLimit: number;
@@ -1,11 +1,12 @@
1
1
  import { default as SipConnector } from '../SipConnector';
2
2
  import { TContentHint, TSimulcastEncodings } from '../types';
3
- declare const resolveUpdatePresentation: (sipConnector: SipConnector) => ({ mediaStream, isP2P, maxBitrate, contentHint, simulcastEncodings, sendEncodings, }: {
3
+ declare const resolveUpdatePresentation: (sipConnector: SipConnector) => ({ mediaStream, isP2P, maxBitrate, contentHint, simulcastEncodings, degradationPreference, sendEncodings, }: {
4
4
  mediaStream: MediaStream;
5
5
  isP2P: boolean;
6
6
  maxBitrate?: number;
7
7
  contentHint?: TContentHint;
8
8
  simulcastEncodings?: TSimulcastEncodings;
9
+ degradationPreference?: RTCDegradationPreference;
9
10
  sendEncodings?: RTCRtpEncodingParameters[];
10
11
  }) => Promise<MediaStream | void>;
11
12
  export default resolveUpdatePresentation;
@@ -0,0 +1,3 @@
1
+ import { TRtpSendParameters } from '../types';
2
+ declare const resolveUpdateSenderInTransceiver: (parametersTarget: TRtpSendParameters) => (transceiver: RTCRtpTransceiver) => Promise<void>;
3
+ export default resolveUpdateSenderInTransceiver;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sip-connector",
3
- "version": "11.1.0",
3
+ "version": "11.3.0",
4
4
  "description": "Module for connect to Vinteo server",
5
5
  "keywords": [
6
6
  "webrtc",
@@ -65,7 +65,7 @@
65
65
  "@krivega/cancelable-promise": "^1.1.3",
66
66
  "@krivega/jssip": "^5.0.0",
67
67
  "debug": "^4.3.7",
68
- "events-constructor": "^1.2.3",
68
+ "events-constructor": "^1.3.0",
69
69
  "repeated-calls": "^2.3.0",
70
70
  "sequent-promises": "^2.0.1",
71
71
  "stack-promises": "^2.0.2",
@@ -90,7 +90,7 @@
90
90
  "eslint-import-resolver-typescript": "^3.6.3",
91
91
  "eslint-plugin-flowtype": "^8.0.3",
92
92
  "eslint-plugin-import": "^2.31.0",
93
- "eslint-plugin-jest": "^28.8.3",
93
+ "eslint-plugin-jest": "^28.9.0",
94
94
  "eslint-plugin-prettier": "^5.2.1",
95
95
  "eslint-plugin-unicorn": "^56.0.0",
96
96
  "husky": "^9.1.6",
@@ -107,13 +107,13 @@
107
107
  "typescript": "^5.6.3",
108
108
  "vite": "^5.4.10",
109
109
  "vite-plugin-dts": "^4.3.0",
110
- "vite-tsconfig-paths": "^5.0.1"
110
+ "vite-tsconfig-paths": "^5.1.0"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "@krivega/cancelable-promise": "^1.1.3",
114
114
  "@krivega/jssip": "^5.0.0",
115
115
  "debug": "^4.3.7",
116
- "events-constructor": "^1.2.3",
116
+ "events-constructor": "^1.3.0",
117
117
  "repeated-calls": "^2.2.1",
118
118
  "sequent-promises": "^2.0.1",
119
119
  "stack-promises": "^2.0.2",
@@ -1 +0,0 @@
1
- "use strict";var Pt=Object.defineProperty;var Ot=(s,e,t)=>e in s?Pt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>Ot(s,typeof e!="symbol"?e+"":e,t);const C=require("@krivega/cancelable-promise"),ye=require("events-constructor"),be=require("repeated-calls"),x=require("debug"),Dt="Connection Error",ke="Request Timeout",Mt="SIP Failure Code",pt="Internal Error",vt="Busy",Y="Rejected",yt="Redirected",bt="Unavailable",Be="Not Found",wt="Address Incomplete",Ut="Incompatible SDP",Lt="Missing SDP",Ht="Authentication Error",Fe="Terminated",Wt="WebRTC Error",Ve="Canceled",qt="No Answer",kt="Expires",Bt="No ACK",Ft="Dialog Error",Vt="User Denied Media Access",xe="Bad Media Description",xt="RTP Timeout",Yt=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_INCOMPLETE:wt,AUTHENTICATION_ERROR:Ht,BAD_MEDIA_DESCRIPTION:xe,BUSY:vt,BYE:Fe,CANCELED:Ve,CONNECTION_ERROR:Dt,DIALOG_ERROR:Ft,EXPIRES:kt,INCOMPATIBLE_SDP:Ut,INTERNAL_ERROR:pt,MISSING_SDP:Lt,NOT_FOUND:Be,NO_ACK:Bt,NO_ANSWER:qt,REDIRECTED:yt,REJECTED:Y,REQUEST_TIMEOUT:ke,RTP_TIMEOUT:xt,SIP_FAILURE_CODE:Mt,UNAVAILABLE:bt,USER_DENIED_MEDIA_ACCESS:Vt,WEBRTC_ERROR:Wt},Symbol.toStringTag,{value:"Module"})),G="incomingCall",$="declinedIncomingCall",J="failedIncomingCall",X="terminatedIncomingCall",B="connecting",m="connected",N="disconnected",y="newRTCSession",P="registered",z="unregistered",O="registrationFailed",Ye="newMessage",Q="sipEvent",j="availableSecondRemoteStream",K="notAvailableSecondRemoteStream",Z="mustStopPresentation",b="shareState",ee="enterRoom",te="useLicense",ne="peerconnection:confirmed",se="peerconnection:ontrack",w="channels",ie="channels:notify",oe="ended:fromserver",re="main-cam-control",ae="admin-stop-main-cam",ce="admin-start-main-cam",Ee="admin-stop-mic",_e="admin-start-mic",U="admin-force-sync-media-state",le="participant:added-to-list-moderators",de="participant:removed-from-list-moderators",he="participant:move-request-to-stream",ue="participant:move-request-to-spectators",Te="participation:accepting-word-request",Se="participation:cancelling-word-request",Ne="webcast:started",Ce="webcast:stopped",ge="account:changed",Ae="account:deleted",Re="conference:participant-token-issued",D="ended",Ge="sending",$e="reinvite",Je="replaces",Xe="refer",ze="progress",Qe="accepted",L="confirmed",H="peerconnection",R="failed",je="muted",Ke="unmuted",Ie="newDTMF",fe="newInfo",Ze="hold",et="unhold",tt="update",nt="sdp",st="icecandidate",it="getusermediafailed",ot="peerconnection:createofferfailed",rt="peerconnection:createanswerfailed",at="peerconnection:setlocaldescriptionfailed",ct="peerconnection:setremotedescriptionfailed",Et="presentation:start",_t="presentation:started",lt="presentation:end",me="presentation:ended",W="presentation:failed",dt="SPECTATOR",ht=1e6,Gt=Object.freeze(Object.defineProperty({__proto__:null,ACCEPTED:Qe,ACCOUNT_CHANGED:ge,ACCOUNT_DELETED:Ae,ADMIN_FORCE_SYNC_MEDIA_STATE:U,ADMIN_START_MAIN_CAM:ce,ADMIN_START_MIC:_e,ADMIN_STOP_MAIN_CAM:ae,ADMIN_STOP_MIC:Ee,AVAILABLE_SECOND_REMOTE_STREAM_EVENT:j,CHANNELS:w,CHANNELS_NOTIFY:ie,CONFERENCE_PARTICIPANT_TOKEN_ISSUED:Re,CONFIRMED:L,CONNECTED:m,CONNECTING:B,DECLINED_INCOMING_CALL:$,DISCONNECTED:N,ENDED:D,ENDED_FROM_SERVER:oe,ENTER_ROOM:ee,FAILED:R,FAILED_INCOMING_CALL:J,GET_USER_MEDIA_FAILED:it,HOLD:Ze,ICE_CANDIDATE:st,INCOMING_CALL:G,MAIN_CAM_CONTROL:re,MUST_STOP_PRESENTATION_EVENT:Z,MUTED:je,NEW_DTMF:Ie,NEW_INFO:fe,NEW_MESSAGE:Ye,NEW_RTC_SESSION:y,NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT:K,ONE_MEGABIT_IN_BITS:ht,PARTICIPANT_ADDED_TO_LIST_MODERATORS:le,PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS:ue,PARTICIPANT_MOVE_REQUEST_TO_STREAM:he,PARTICIPANT_REMOVED_FROM_LIST_MODERATORS:de,PARTICIPATION_ACCEPTING_WORD_REQUEST:Te,PARTICIPATION_CANCELLING_WORD_REQUEST:Se,PEER_CONNECTION:H,PEER_CONNECTION_CONFIRMED:ne,PEER_CONNECTION_CREATE_ANSWER_FAILED:rt,PEER_CONNECTION_CREATE_OFFER_FAILED:ot,PEER_CONNECTION_ONTRACK:se,PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED:at,PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED:ct,PRESENTATION_END:lt,PRESENTATION_ENDED:me,PRESENTATION_FAILED:W,PRESENTATION_START:Et,PRESENTATION_STARTED:_t,PROGRESS:ze,REFER:Xe,REGISTERED:P,REGISTRATION_FAILED:O,REINVITE:$e,REPLACES:Je,SDP:nt,SENDING:Ge,SHARE_STATE:b,SIP_EVENT:Q,SPECTATOR:dt,TERMINATED_INCOMING_CALL:X,UNHOLD:et,UNMUTED:Ke,UNREGISTERED:z,UPDATE:tt,USE_LICENSE:te,WEBCAST_STARTED:Ne,WEBCAST_STOPPED:Ce},Symbol.toStringTag,{value:"Module"})),ut=[G,$,X,J,Te,Se,he,ie,Re,ge,Ae,Ne,Ce,le,de],Pe=[B,m,N,y,P,z,O,Ye,Q],Tt=[j,K,Z,b,ee,te,ne,se,w,oe,re,ce,ae,Ee,_e,U,ue],Oe=[D,B,Ge,$e,Je,Xe,ze,Qe,L,H,R,je,Ke,Ie,fe,Ze,et,tt,nt,st,it,ot,rt,at,ct,Et,_t,lt,me,W],De=[...Pe,...ut],Me=[...Oe,...Tt],$t=Object.freeze(Object.defineProperty({__proto__:null,SESSION_EVENT_NAMES:Me,SESSION_JSSIP_EVENT_NAMES:Oe,SESSION_SYNTHETICS_EVENT_NAMES:Tt,UA_EVENT_NAMES:De,UA_JSSIP_EVENT_NAMES:Pe,UA_SYNTHETICS_EVENT_NAMES:ut},Symbol.toStringTag,{value:"Module"})),Jt=s=>{const e=[];return s&&e.push(`X-Vinteo-Remote: ${s}`),e},Xt="content-type",zt="x-webrtc-enter-room",M="application/vinteo.webrtc.sharedesktop",Qt="application/vinteo.webrtc.roomname",jt="application/vinteo.webrtc.channels",Kt="application/vinteo.webrtc.mediastate",Zt="application/vinteo.webrtc.refusal",we="application/vinteo.webrtc.maincam",en="application/vinteo.webrtc.mic",tn="application/vinteo.webrtc.uselic",nn="X-WEBRTC-USE-LICENSE",sn="X-WEBRTC-PARTICIPANT-NAME",Ue="X-WEBRTC-INPUT-CHANNELS",Le="X-WEBRTC-OUTPUT-CHANNELS",on="X-WEBRTC-MAINCAM",rn="X-WEBRTC-MIC",He="X-WEBRTC-SYNC",an="X-WEBRTC-MAINCAM-RESOLUTION",cn="X-WEBRTC-MEDIA-STATE",En="X-Vinteo-Media-Type",_n="X-Vinteo-MainCam-State",ln="X-Vinteo-Mic-State",dn="application/vinteo.webrtc.partstate",hn="X-WEBRTC-PARTSTATE",un="application/vinteo.webrtc.notify",Tn="X-VINTEO-NOTIFY",f="x-webrtc-share-state",Sn=`${f}: LETMESTARTPRESENTATION`,Nn=`${f}: STOPPRESENTATION`,St="YOUCANRECEIVECONTENT",Nt="CONTENTEND",Ct="YOUMUSTSTOPSENDCONTENT",Cn=`${f}: ${Ct}`,gn=`${f}: ${St}`,An=`${f}: ${Nt}`,Rn="X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE",In=`${Rn}: LETMESTARTMAINCAM`,pe="sip-connector",v=x(pe),fn=()=>{x.enable(pe)},mn=()=>{x.enable(`-${pe}`)},Pn=(s,e)=>{s.getVideoTracks().forEach(n=>{"contentHint"in n&&n.contentHint!==e&&(n.contentHint=e)})},p=(s,{videoMode:e,audioMode:t,contentHint:n}={})=>{if(!s||e==="recvonly"&&t==="recvonly")return;const i=t==="recvonly"?[]:s.getAudioTracks(),r=e==="recvonly"?[]:s.getVideoTracks(),a=[...i,...r],c=new MediaStream(a);return c.getTracks=()=>[...c.getAudioTracks(),...c.getVideoTracks()],n&&n!=="none"&&Pn(c,n),c};var I=(s=>(s.PAUSE_MAIN_CAM="PAUSEMAINCAM",s.RESUME_MAIN_CAM="RESUMEMAINCAM",s.MAX_MAIN_CAM_RESOLUTION="MAXMAINCAMRESOLUTION",s.ADMIN_STOP_MAIN_CAM="ADMINSTOPMAINCAM",s.ADMIN_START_MAIN_CAM="ADMINSTARTMAINCAM",s))(I||{}),q=(s=>(s.ADMIN_STOP_MIC="ADMINSTOPMIC",s.ADMIN_START_MIC="ADMINSTARTMIC",s))(q||{}),k=(s=>(s.ADMIN_SYNC_FORCED="1",s.ADMIN_SYNC_NOT_FORCED="0",s))(k||{}),gt=(s=>(s.AUDIO="AUDIO",s.VIDEO="VIDEO",s.AUDIOPLUSPRESENTATION="AUDIOPLUSPRESENTATION",s))(gt||{});function On(s){return e=>`sip:${e}@${s}`}const Dn=(s,e)=>()=>Math.floor(Math.random()*(e-s))+s,We=s=>s.trim().replaceAll(" ","_"),Mn=Dn(1e5,99999999),pn=s=>s.some(t=>{const{kind:n}=t;return n==="video"}),vn="Error decline with 603",yn=1006,bn=s=>typeof s=="object"&&s!==null&&"code"in s&&s.code===yn,wn=s=>s.message===vn,Un=(s,e)=>s.find(t=>t.track&&e.getTracks().includes(t.track)),Ln=(s,e)=>(s.degradationPreference=e.degradationPreference,s),Hn=(s,e)=>{s.encodings===void 0&&(s.encodings=[]);for(let t=s.encodings.length;t<e;t+=1)s.encodings.push({});return s},At=s=>(e,t)=>t!==void 0&&e!==t||t===void 0&&e!==s,Wn=At(),qn=(s,e)=>{if(Wn(s,e))return s},kn=(s,e)=>{const t=s.maxBitrate,n=qn(e,t);return n!==void 0&&(s.maxBitrate=n),s},Rt=1,Bn=At(Rt),Fn=(s,e)=>{const t=s===void 0?void 0:Math.max(s,Rt);if(t!==void 0&&Bn(t,e))return t},Vn=(s,e)=>{const t=s.scaleResolutionDownBy,n=Fn(e,t);return n!==void 0&&(s.scaleResolutionDownBy=n),s},xn=(s,e)=>{var n;const t=((n=e.encodings)==null?void 0:n.length)??0;return Hn(s,t),s.encodings.forEach((i,r)=>{const a=((e==null?void 0:e.encodings)??[])[r],c=a==null?void 0:a.maxBitrate,_=a==null?void 0:a.scaleResolutionDownBy;kn(i,c),Vn(i,_)}),s},Yn=(s,e)=>{var t,n,i,r,a,c,_,l;if(((t=s.codecs)==null?void 0:t.length)!==((n=e.codecs)==null?void 0:n.length))return!0;for(let E=0;E<(((i=s.codecs)==null?void 0:i.length)??0);E++)if(JSON.stringify(s.codecs[E])!==JSON.stringify(e.codecs[E]))return!0;if(((r=s.headerExtensions)==null?void 0:r.length)!==((a=e.headerExtensions)==null?void 0:a.length))return!0;for(let E=0;E<(((c=s.headerExtensions)==null?void 0:c.length)??0);E++)if(JSON.stringify(s.headerExtensions[E])!==JSON.stringify(e.headerExtensions[E]))return!0;if(((_=s.encodings)==null?void 0:_.length)!==((l=e.encodings)==null?void 0:l.length))return!0;for(let E=0;E<(s.encodings.length??0);E++)if(JSON.stringify(s.encodings[E])!==JSON.stringify(e.encodings[E]))return!0;return s.rtcp.cname!==e.rtcp.cname||s.rtcp.reducedSize!==e.rtcp.reducedSize||s.degradationPreference!==e.degradationPreference},It=async(s,e)=>{const t=s.getParameters(),n=JSON.parse(JSON.stringify(t));xn(t,e),Ln(t,e);const i=Yn(n,t);return i&&await s.setParameters(t),{parameters:t,isChanged:i}},ft=async(s,e,t)=>{const{isChanged:n,parameters:i}=await It(s,{encodings:[{scaleResolutionDownBy:e.scaleResolutionDownBy,maxBitrate:e.maxBitrate}]});return n&&t&&t(i),{isChanged:n,parameters:i}},Gn=async(s,e,t)=>{const n=Un(s,e);if(n)return ft(n,{maxBitrate:t})},$n=486,Jn=487,V="local",qe="remote",Xn=3,zn=1,Qn=(s=new Error)=>{const{originator:e,cause:t}=s;return C.isCanceledError(s)?!0:typeof t=="string"?t===ke||t===Y||e===V&&(t===Ve||t===Fe):!1},g="SipConnector",jn="channels",Kn="WebcastStarted",Zn="WebcastStopped",es="accountChanged",ts="accountDeleted",ns="addedToListModerators",ss="removedFromListModerators",is="ParticipationRequestAccepted",os="ParticipationRequestRejected",rs="ParticipantMovedToWebcast",as="ConferenceParticipantTokenIssued";class cs{constructor({JsSIP:e}){o(this,"_isRegisterConfig",!1);o(this,"_connectionConfiguration",{});o(this,"_remoteStreams",{});o(this,"JsSIP");o(this,"_sessionEvents");o(this,"_uaEvents");o(this,"_cancelableConnect");o(this,"_cancelableConnectWithRepeatedCalls");o(this,"_cancelableSendPresentationWithRepeatedCalls");o(this,"_cancelableInitUa");o(this,"_cancelableDisconnect");o(this,"_cancelableSet");o(this,"_cancelableCall");o(this,"_cancelableAnswer");o(this,"_cancelableSendDTMF");o(this,"getSipServerUrl",e=>e);o(this,"promisePendingStartPresentation");o(this,"promisePendingStopPresentation");o(this,"ua");o(this,"session");o(this,"incomingSession");o(this,"_streamPresentationCurrent");o(this,"socket");o(this,"connect",async(e,t)=>(this._cancelRequests(),this._connectWithDuplicatedCalls(e,t)));o(this,"initUa",async e=>this._cancelableInitUa.request(e));o(this,"set",async e=>this._cancelableSet.request(e));o(this,"call",async e=>this._cancelableCall.request(e));o(this,"disconnect",async()=>(this._cancelRequests(),this._disconnectWithoutCancelRequests()));o(this,"answerToIncomingCall",async e=>this._cancelableAnswer.request(e));o(this,"sendDTMF",async e=>this._cancelableSendDTMF.request(e));o(this,"hangUp",async()=>(this._cancelRequests(),this._hangUpWithoutCancelRequests()));o(this,"tryRegister",async()=>{if(!this.isRegisterConfig)throw new Error("Config is not registered");this._uaEvents.trigger(B,void 0);try{await this.unregister()}catch(e){v("tryRegister",e)}return this.register()});o(this,"declineToIncomingCall",async({statusCode:e=Jn}={})=>new Promise((t,n)=>{if(!this.isAvailableIncomingCall){n(new Error("no incomingSession"));return}const i=this.incomingSession,r=this.remoteCallerData;this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest(),this.removeIncomingSession(),this._uaEvents.trigger($,r),t(i.terminate({status_code:e}))}));o(this,"busyIncomingCall",async()=>this.declineToIncomingCall({statusCode:$n}));o(this,"removeIncomingSession",()=>{delete this.incomingSession});o(this,"_connectWithDuplicatedCalls",async(e,{callLimit:t=Xn}={})=>{const n=async()=>this._cancelableConnect.request(e),i=r=>{var l;const c=!!((l=this.ua)!=null&&l.isConnected())&&this.hasEqualConnectionConfiguration(e),_=!!r&&!bn(r);return c||_};return this._cancelableConnectWithRepeatedCalls=be.repeatedCallsAsync({targetFunction:n,isComplete:i,callLimit:t,isRejectAsValid:!0,isCheckBeforeCall:!1,onAfterCancel:()=>{this._cancelableConnect.cancelRequest()}}),this._cancelableConnectWithRepeatedCalls.then(r=>{if(r instanceof this.JsSIP.UA)return r;throw r})});o(this,"handleNewRTCSession",({originator:e,session:t})=>{if(e===qe){this.incomingSession=t;const n=this.remoteCallerData;t.on(R,i=>{this.removeIncomingSession(),i.originator===V?this._uaEvents.trigger(X,n):this._uaEvents.trigger(J,n)}),this._uaEvents.trigger(G,n)}});o(this,"_connect",async e=>this.initUa(e).then(async()=>this._start()));o(this,"_initUa",async({user:e,password:t,sipServerUrl:n,sipWebSocketServerURL:i,remoteAddress:r,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:_,connectionRecoveryMaxInterval:l,userAgent:E,displayName:h="",register:d=!1,extraHeaders:u=[]})=>{if(!n)throw new Error("sipServerUrl is required");if(!i)throw new Error("sipWebSocketServerURL is required");if(d&&!e)throw new Error("user is required for authorized connection");if(d&&!t)throw new Error("password is required for authorized connection");this._connectionConfiguration={sipServerUrl:n,displayName:h,register:d,user:e,password:t};const{configuration:T,helpers:S}=this.createUaConfiguration({user:e,sipServerUrl:n,sipWebSocketServerURL:i,password:t,displayName:h,register:d,sessionTimers:a,registerExpires:c,connectionRecoveryMinInterval:_,connectionRecoveryMaxInterval:l,userAgent:E});return this.getSipServerUrl=S.getSipServerUrl,this.socket=S.socket,this.ua&&await this._disconnectWithoutCancelRequests(),this._isRegisterConfig=!!d,this.ua=this._createUa({...T,remoteAddress:r,extraHeaders:u}),this._uaEvents.eachTriggers((A,F)=>{const ve=Pe.find(mt=>mt===F);ve&&this.ua&&this.ua.on(ve,A)}),this.ua});o(this,"_createUa",({remoteAddress:e,extraHeaders:t=[],...n})=>{const i=new this.JsSIP.UA(n),a=[...e?Jt(e):[],...t];return a.length>0&&i.registrator().setExtraHeaders(a),i});o(this,"_start",async()=>new Promise((e,t)=>{const{ua:n}=this;if(!n){t(new Error("this.ua is not initialized"));return}const i=()=>{c(),e(n)},r=_=>{c(),t(_)},a=()=>{this.isRegisterConfig?(this.on(P,i),this.on(O,r)):this.on(m,i),this.on(N,r)},c=()=>{this.off(P,i),this.off(O,r),this.off(m,i),this.off(N,r)};a(),this.on(y,this.handleNewRTCSession),n.start()}));o(this,"_set",async({displayName:e,password:t})=>new Promise((n,i)=>{const{ua:r}=this;if(!r){i(new Error("this.ua is not initialized"));return}let a=!1,c=!1;e!==void 0&&e!==this._connectionConfiguration.displayName&&(a=r.set("display_name",We(e)),this._connectionConfiguration.displayName=e),t!==void 0&&t!==this._connectionConfiguration.password&&(c=r.set("password",t),this._connectionConfiguration.password=t);const _=a||c;c&&this.isRegisterConfig?this.register().then(()=>{n(_)}).catch(l=>{i(l)}):_?n(_):i(new Error("nothing changed"))}));o(this,"_disconnectWithoutCancelRequests",async()=>this._cancelableDisconnect.request());o(this,"_disconnect",async()=>{this.off(y,this.handleNewRTCSession);const e=new Promise(t=>{this.once(N,()=>{delete this.ua,t()})});return this.ua?(await this._hangUpWithoutCancelRequests(),this.ua?this.ua.stop():this._uaEvents.trigger(N,void 0)):this._uaEvents.trigger(N,void 0),e});o(this,"_call",async({number:e,mediaStream:t,extraHeaders:n=[],ontrack:i,iceServers:r,videoMode:a,audioMode:c,contentHint:_,offerToReceiveAudio:l=!0,offerToReceiveVideo:E=!0,sendEncodings:h,onAddedTransceiver:d})=>new Promise((u,T)=>{const{ua:S}=this;if(!S){T(new Error("this.ua is not initialized"));return}this._connectionConfiguration.number=e,this._connectionConfiguration.answer=!1,this._handleCall({ontrack:i}).then(u).catch(A=>{T(A)}),this.session=S.call(this.getSipServerUrl(e),{extraHeaders:n,mediaStream:p(t,{videoMode:a,audioMode:c,contentHint:_}),eventHandlers:this._sessionEvents.triggers,videoMode:a,audioMode:c,pcConfig:{iceServers:r},rtcOfferConstraints:{offerToReceiveAudio:l,offerToReceiveVideo:E},sendEncodings:h,onAddedTransceiver:d})}));o(this,"_answer",async({mediaStream:e,ontrack:t,extraHeaders:n=[],iceServers:i,videoMode:r,audioMode:a,contentHint:c,sendEncodings:_,onAddedTransceiver:l})=>new Promise((E,h)=>{if(!this.isAvailableIncomingCall){h(new Error("no incomingSession"));return}this.session=this.incomingSession,this.removeIncomingSession();const{session:d}=this;if(!d){h(new Error("No session established"));return}this._sessionEvents.eachTriggers((T,S)=>{const A=Oe.find(F=>F===S);A&&d.on(A,T)}),this._connectionConfiguration.answer=!0,this._connectionConfiguration.number=d.remote_identity.uri.user,this._handleCall({ontrack:t}).then(E).catch(T=>{h(T)});const u=p(e,{videoMode:r,audioMode:a,contentHint:c});d.answer({extraHeaders:n,videoMode:r,audioMode:a,mediaStream:u,pcConfig:{iceServers:i},sendEncodings:_,onAddedTransceiver:l})}));o(this,"_handleCall",async({ontrack:e})=>new Promise((t,n)=>{const i=()=>{this.onSession(H,E),this.onSession(L,h)},r=()=>{this.offSession(H,E),this.offSession(L,h)},a=()=>{this.onSession(R,_),this.onSession(D,_)},c=()=>{this.offSession(R,_),this.offSession(D,_)},_=d=>{r(),c(),n(d)};let l;const E=({peerconnection:d})=>{l=d,l.ontrack=u=>{this._sessionEvents.trigger(se,l),e&&e(u)}},h=()=>{l&&this._sessionEvents.trigger(ne,l),r(),c(),t(l)};i(),a()}));o(this,"_restoreSession",()=>{this._cancelRequestsAndResetPresentation(),delete this._connectionConfiguration.number,delete this.session,this._remoteStreams={}});o(this,"_sendDTMF",async e=>new Promise((t,n)=>{const{session:i}=this;if(!i){n(new Error("No session established"));return}this.onceSession(Ie,({originator:r})=>{r===V&&t()}),i.sendDTMF(e,{duration:120,interToneGap:600})}));o(this,"_hangUpWithoutCancelRequests",async()=>{if(this.ua&&this.session){const{session:e}=this;if(this._streamPresentationCurrent)try{await this.stopPresentation()}catch(t){v("error stop presentation: ",t)}if(this._restoreSession(),!e.isEnded())return e.terminateAsync()}});o(this,"_handleShareState",e=>{switch(e){case St:{this._sessionEvents.trigger(j,void 0);break}case Nt:{this._sessionEvents.trigger(K,void 0);break}case Ct:{this._sessionEvents.trigger(Z,void 0);break}}});o(this,"_maybeTriggerChannels",e=>{const t=e.getHeader(Ue),n=e.getHeader(Le);if(t&&n){const i={inputChannels:t,outputChannels:n};this._sessionEvents.trigger(w,i)}});o(this,"_handleNotify",e=>{switch(e.cmd){case jn:{const t=e;this._triggerChannelsNotify(t);break}case Kn:{const t=e;this._triggerWebcastStartedNotify(t);break}case Zn:{const t=e;this._triggerWebcastStoppedNotify(t);break}case ns:{const t=e;this._triggerAddedToListModeratorsNotify(t);break}case ss:{const t=e;this._triggerRemovedFromListModeratorsNotify(t);break}case is:{const t=e;this._triggerParticipationAcceptingWordRequest(t);break}case os:{const t=e;this._triggerParticipationCancellingWordRequest(t);break}case rs:{const t=e;this._triggerParticipantMoveRequestToStream(t);break}case es:{this._triggerAccountChangedNotify();break}case ts:{this._triggerAccountDeletedNotify();break}case as:{const t=e;this._triggerConferenceParticipantTokenIssued(t);break}default:v("unknown cmd",e.cmd)}});o(this,"_triggerRemovedFromListModeratorsNotify",({conference:e})=>{const t={conference:e};this._uaEvents.trigger(de,t)});o(this,"_triggerAddedToListModeratorsNotify",({conference:e})=>{const t={conference:e};this._uaEvents.trigger(le,t)});o(this,"_triggerWebcastStartedNotify",({body:{conference:e,type:t}})=>{const n={conference:e,type:t};this._uaEvents.trigger(Ne,n)});o(this,"_triggerWebcastStoppedNotify",({body:{conference:e,type:t}})=>{const n={conference:e,type:t};this._uaEvents.trigger(Ce,n)});o(this,"_triggerAccountChangedNotify",()=>{this._uaEvents.trigger(ge,void 0)});o(this,"_triggerAccountDeletedNotify",()=>{this._uaEvents.trigger(Ae,void 0)});o(this,"_triggerConferenceParticipantTokenIssued",({body:{conference:e,participant:t,jwt:n}})=>{const i={conference:e,participant:t,jwt:n};this._uaEvents.trigger(Re,i)});o(this,"_triggerChannelsNotify",e=>{const t=e.input,n=e.output,i={inputChannels:t,outputChannels:n};this._uaEvents.trigger(ie,i)});o(this,"_triggerParticipationAcceptingWordRequest",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(Te,t)});o(this,"_triggerParticipationCancellingWordRequest",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(Se,t)});o(this,"_triggerParticipantMoveRequestToStream",({body:{conference:e}})=>{const t={conference:e};this._uaEvents.trigger(he,t)});o(this,"_triggerEnterRoom",e=>{const t=e.getHeader(zt),n=e.getHeader(sn);this._sessionEvents.trigger(ee,{room:t,participantName:n})});o(this,"_triggerShareState",e=>{const t=e.getHeader(f);this._sessionEvents.trigger(b,t)});o(this,"_maybeTriggerParticipantMoveRequestToSpectators",e=>{e.getHeader(hn)===dt&&this._sessionEvents.trigger(ue,void 0)});o(this,"_triggerMainCamControl",e=>{const t=e.getHeader(on),n=e.getHeader(He),i=n===k.ADMIN_SYNC_FORCED;if(t===I.ADMIN_START_MAIN_CAM){this._sessionEvents.trigger(ce,{isSyncForced:i});return}if(t===I.ADMIN_STOP_MAIN_CAM){this._sessionEvents.trigger(ae,{isSyncForced:i});return}(t===I.RESUME_MAIN_CAM||t===I.PAUSE_MAIN_CAM)&&n&&this._sessionEvents.trigger(U,{isSyncForced:i});const r=e.getHeader(an);this._sessionEvents.trigger(re,{mainCam:t,resolutionMainCam:r})});o(this,"_triggerMicControl",e=>{const t=e.getHeader(rn),i=e.getHeader(He)===k.ADMIN_SYNC_FORCED;t===q.ADMIN_START_MIC?this._sessionEvents.trigger(_e,{isSyncForced:i}):t===q.ADMIN_STOP_MIC&&this._sessionEvents.trigger(Ee,{isSyncForced:i})});o(this,"_triggerUseLicense",e=>{const t=e.getHeader(nn);this._sessionEvents.trigger(te,t)});o(this,"_handleNewInfo",e=>{const{originator:t}=e;if(t!=="remote")return;const{request:n}=e,i=n.getHeader(Xt);if(i)switch(i){case Qt:{this._triggerEnterRoom(n),this._maybeTriggerChannels(n);break}case un:{this._maybeHandleNotify(n);break}case M:{this._triggerShareState(n);break}case we:{this._triggerMainCamControl(n);break}case en:{this._triggerMicControl(n);break}case tn:{this._triggerUseLicense(n);break}case dn:{this._maybeTriggerParticipantMoveRequestToSpectators(n);break}}});o(this,"_handleSipEvent",({request:e})=>{this._maybeHandleNotify(e)});o(this,"_maybeHandleNotify",e=>{const t=e.getHeader(Tn);if(t){const n=JSON.parse(t);this._handleNotify(n)}});o(this,"_handleEnded",e=>{const{originator:t}=e;t===qe&&this._sessionEvents.trigger(oe,e),this._restoreSession()});this.JsSIP=e,this._sessionEvents=new ye(Me),this._uaEvents=new ye(De),this._cancelableConnect=new C.CancelableRequest(this._connect,{moduleName:g,afterCancelRequest:()=>{this._cancelableInitUa.cancelRequest(),this._cancelableDisconnect.cancelRequest()}}),this._cancelableInitUa=new C.CancelableRequest(this._initUa,{moduleName:g}),this._cancelableDisconnect=new C.CancelableRequest(this._disconnect,{moduleName:g}),this._cancelableSet=new C.CancelableRequest(this._set,{moduleName:g}),this._cancelableCall=new C.CancelableRequest(this._call,{moduleName:g}),this._cancelableAnswer=new C.CancelableRequest(this._answer,{moduleName:g}),this._cancelableSendDTMF=new C.CancelableRequest(this._sendDTMF,{moduleName:g}),this.onSession(b,this._handleShareState),this.onSession(fe,this._handleNewInfo),this.on(Q,this._handleSipEvent),this.onSession(R,this._handleEnded),this.onSession(D,this._handleEnded)}async register(){return new Promise((e,t)=>{this.isRegisterConfig&&this.ua?(this.ua.on(P,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(z,e),this.ua.unregister()):t(new Error("ua is not registered"))})}async sendOptions(e,t,n){if(!this.ua)throw new Error("is not connected");return new Promise((i,r)=>{try{this.ua.sendOptions(e,t,{extraHeaders:n,eventHandlers:{succeeded:()=>{i()},failed:r}})}catch(a){r(a)}})}async ping(e,t){var i;if(!((i=this.ua)!=null&&i.configuration.uri))throw new Error("is not connected");const n=this.ua.configuration.uri;return this.sendOptions(n,e,t)}async checkTelephony({userAgent:e,displayName:t,sipServerUrl:n,sipWebSocketServerURL:i,remoteAddress:r,extraHeaders:a}){return new Promise((c,_)=>{const{configuration:l}=this.createUaConfiguration({sipWebSocketServerURL:i,displayName:t,userAgent:e,sipServerUrl:n}),E=this._createUa({...l,remoteAddress:r,extraHeaders:a}),h=()=>{const u=new Error("Telephony is not available");_(u)};E.once(N,h);const d=()=>{E.removeAllListeners(),E.once(N,c),E.stop()};E.once(m,d),E.start()})}async replaceMediaStream(e,t){if(!this.session)throw new Error("No session established");const{contentHint:n}=t||{},i=p(e,{contentHint:n});return this.session.replaceMediaStream(i,t)}async askPermissionToEnableCam(e={}){if(!this.session)throw new Error("No session established");const t=[In];return this.session.sendInfo(we,void 0,{noTerminateWhenError:!0,...e,extraHeaders:t}).catch(n=>{if(wn(n))throw n})}get isPendingPresentation(){return!!this.promisePendingStartPresentation||!!this.promisePendingStopPresentation}async _sendPresentationWithDuplicatedCalls({session:e,stream:t,presentationOptions:n,options:i={callLimit:zn}}){const r=async()=>this._sendPresentation(e,t,n),a=()=>!!this._streamPresentationCurrent;return this._cancelableSendPresentationWithRepeatedCalls=be.repeatedCallsAsync({targetFunction:r,isComplete:a,isRejectAsValid:!0,...i}),this._cancelableSendPresentationWithRepeatedCalls.then(c=>c)}hasEqualConnectionConfiguration(e){var i;const{configuration:t}=this.createUaConfiguration(e),n=(i=this.ua)==null?void 0:i.configuration;return(n==null?void 0:n.password)===t.password&&(n==null?void 0:n.register)===t.register&&(n==null?void 0:n.uri.toString())===t.uri&&(n==null?void 0:n.display_name)===t.display_name&&(n==null?void 0:n.user_agent)===t.user_agent&&(n==null?void 0:n.sockets)===t.sockets&&(n==null?void 0:n.session_timers)===t.session_timers&&(n==null?void 0:n.register_expires)===t.register_expires&&(n==null?void 0:n.connection_recovery_min_interval)===t.connection_recovery_min_interval&&(n==null?void 0:n.connection_recovery_max_interval)===t.connection_recovery_max_interval}createUaConfiguration({user:e,password:t,sipWebSocketServerURL:n,displayName:i="",sipServerUrl:r,register:a=!1,sessionTimers:c=!1,registerExpires:_=60*5,connectionRecoveryMinInterval:l=2,connectionRecoveryMaxInterval:E=6,userAgent:h}){if(a&&!t)throw new Error("password is required for authorized connection");const d=a&&e?e.trim():`${Mn()}`,u=On(r),T=u(d),S=new this.JsSIP.WebSocketInterface(n);return{configuration:{password:t,register:a,uri:T,display_name:We(i),user_agent:h,sdp_semantics:"unified-plan",sockets:[S],session_timers:c,register_expires:_,connection_recovery_min_interval:l,connection_recovery_max_interval:E},helpers:{socket:S,getSipServerUrl:u}}}async _sendPresentation(e,t,{maxBitrate:n=ht,isNeedReinvite:i=!0,isP2P:r=!1,contentHint:a="detail",sendEncodings:c,onAddedTransceiver:_}){const l=p(t,{contentHint:a});this._streamPresentationCurrent=l;const E=r?[gn]:[Sn],h=e.sendInfo(M,void 0,{extraHeaders:E}).then(async()=>e.startPresentation(l,i,{sendEncodings:c,onAddedTransceiver:_})).then(async()=>{const{connection:d}=this;if(!d||n===void 0)return;const u=d.getSenders();await Gn(u,t,n)}).then(()=>t).catch(d=>{throw this._removeStreamPresentationCurrent(),this._sessionEvents.trigger(W,d),d});return this.promisePendingStartPresentation=h,h.finally(()=>{this.promisePendingStartPresentation=void 0})}async startPresentation(e,{isNeedReinvite:t,isP2P:n,maxBitrate:i,contentHint:r,sendEncodings:a,onAddedTransceiver:c}={},_){const l=this.establishedSession;if(!l)throw new Error("No session established");if(this._streamPresentationCurrent)throw new Error("Presentation is already started");return n&&await this.sendMustStopPresentation(l),this._sendPresentationWithDuplicatedCalls({session:l,stream:e,presentationOptions:{isNeedReinvite:t,isP2P:n,maxBitrate:i,contentHint:r,sendEncodings:a,onAddedTransceiver:c},options:_})}async sendMustStopPresentation(e){await e.sendInfo(M,void 0,{extraHeaders:[Cn]})}async stopPresentation({isP2P:e=!1}={}){this._cancelSendPresentationWithRepeatedCalls();const t=this._streamPresentationCurrent;let n=this.promisePendingStartPresentation??Promise.resolve();const i=e?[An]:[Nn],r=this.establishedSession;return r&&t&&(n=n.then(async()=>r.sendInfo(M,void 0,{extraHeaders:i})).then(async()=>r.stopPresentation(t)).catch(a=>{throw this._sessionEvents.trigger(W,a),a})),!r&&t&&this._sessionEvents.trigger(me,t),this.promisePendingStopPresentation=n,n.finally(()=>{this._resetPresentation()})}async updatePresentation(e,{isP2P:t,maxBitrate:n,contentHint:i,sendEncodings:r,onAddedTransceiver:a}={}){const c=this.establishedSession;if(!c)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(c,e,{isP2P:t,maxBitrate:n,contentHint:i,isNeedReinvite:!1,sendEncodings:r,onAddedTransceiver:a})}_removeStreamPresentationCurrent(){delete this._streamPresentationCurrent}_resetPresentation(){this._removeStreamPresentationCurrent(),this.promisePendingStartPresentation=void 0,this.promisePendingStopPresentation=void 0}_cancelRequestsAndResetPresentation(){this._cancelSendPresentationWithRepeatedCalls(),this._resetPresentation()}on(e,t){return this._uaEvents.on(e,t)}once(e,t){return this._uaEvents.once(e,t)}onceRace(e,t){return this._uaEvents.onceRace(e,t)}async wait(e){return this._uaEvents.wait(e)}off(e,t){this._uaEvents.off(e,t)}onSession(e,t){return this._sessionEvents.on(e,t)}onceSession(e,t){return this._sessionEvents.once(e,t)}onceRaceSession(e,t){return this._sessionEvents.onceRace(e,t)}async waitSession(e){return this._sessionEvents.wait(e)}offSession(e,t){this._sessionEvents.off(e,t)}isConfigured(){return!!this.ua}getConnectionConfiguration(){return{...this._connectionConfiguration}}getRemoteStreams(){if(!this.connection)return;const t=this.connection.getReceivers().map(({track:n})=>n);return pn(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,i,r,a;return{displayName:(t=(e=this.incomingSession)==null?void 0:e.remote_identity)==null?void 0:t.display_name,host:(i=(n=this.incomingSession)==null?void 0:n.remote_identity)==null?void 0:i.uri.host,incomingNumber:(a=(r=this.incomingSession)==null?void 0:r.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,i=this._remoteStreams[n]||new MediaStream;return t&&i.addTrack(t),i.addTrack(e),this._remoteStreams[n]=i,i}_generateAudioStream(e){const{id:t}=e,n=this._remoteStreams[t]||new MediaStream;return n.addTrack(e),this._remoteStreams[t]=n,n}_generateStreams(e){const t=[];return e.forEach((n,i)=>{if(n.kind==="audio")return;const r=n,a=e[i-1];let c;a&&a.kind==="audio"&&(c=a);const _=this._generateStream(r,c);t.push(_)}),t}_generateAudioStreams(e){return e.map(n=>this._generateAudioStream(n))}_cancelRequests(){this._cancelActionsRequests(),this._cancelCallRequests(),this._cancelConnectWithRepeatedCalls()}_cancelConnectWithRepeatedCalls(){var e;(e=this._cancelableConnectWithRepeatedCalls)==null||e.cancel()}_cancelSendPresentationWithRepeatedCalls(){var e;(e=this._cancelableSendPresentationWithRepeatedCalls)==null||e.cancel()}_cancelCallRequests(){this._cancelableCall.cancelRequest(),this._cancelableAnswer.cancelRequest()}_cancelActionsRequests(){this._cancelableAnswer.cancelRequest(),this._cancelableSendDTMF.cancelRequest()}async waitChannels(){return this.waitSession(w)}async waitSyncMediaState(){return this.waitSession(U)}async sendChannels({inputChannels:e,outputChannels:t}){if(!this.session)throw new Error("No session established");const n=`${Ue}: ${e}`,i=`${Le}: ${t}`,r=[n,i];return this.session.sendInfo(jt,void 0,{extraHeaders:r})}async sendMediaState({cam:e,mic:t},n={}){if(!this.session)throw new Error("No session established");const i=`${cn}: currentstate`,r=`${_n}: ${Number(e)}`,a=`${ln}: ${Number(t)}`,c=[i,r,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=[`${En}: ${e==="mic"?0:1}`];return this.session.sendInfo(Zt,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=xe;exports.EEventsMainCAM=I;exports.EEventsMic=q;exports.EEventsSyncMediaState=k;exports.EUseLicense=gt;exports.NOT_FOUND=Be;exports.REJECTED=Y;exports.SESSION_EVENT_NAMES=Me;exports.SipConnector=cs;exports.UA_EVENT_NAMES=De;exports.causes=Yt;exports.constants=Gt;exports.disableDebug=mn;exports.enableDebug=fn;exports.eventNames=$t;exports.hasCanceledCallError=Qn;exports.logger=v;exports.setEncodingsToSender=ft;exports.setParametersToSender=It;