agrasya-voice-sdk 1.0.30 → 1.0.31
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/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';const
|
|
1
|
+
'use strict';const a0_0x49183f=a0_0x394e;function a0_0x3ca8(){const _0x56f489=['onmessage','default','957VamGFy','10FonjLC','154MEGXpb','ontrack','message','cleanup','getPrototypeOf','prototype','events','1sWlvOa','create','onCallDurationUpdate','error','dataChannel','1654219trLFYc','createDataChannel','apiKey','315xjIjTM','/v1/agrasya/usage','addTrack','/v1/agrasya/connect','hasOwnProperty','getTracks','join_session','stopTimer','application/json','/v1/agrasya/client-token?language=','forEach','Failed\x20to\x20initialize\x20session:\x20','setStatus','http://localhost:4001','__esModule','172704FqOmKJ','close','success','socket','function','object','ephKey','websocket','setRemoteDescription','fetchMinutesUsage','log','getUserMedia','streams','model','durationInterval','oai-events','audioStream','8qDgYmM','Failed\x20to\x20fetch\x20minutes\x20usage:\x20','GET','initializeBackendSession','onStatusChange','POST','createOffer','startVoiceSession','catch','audio','3536322KOkMFI','text','sdp','statusText','25660EiBiim','1082406zWOFos','exports','connected','baseUrl','debug','setLocalDescription','json','key\x20is\x20null\x20or\x20undefined.','data','config','[AgrasyaSDK]','stopVoiceSession','getOwnPropertyNames','sessionId','1423821DGdTdE','mediaDevices','Minutes\x20left:\x20','startTimer','callDuration','body','defineProperty','peerConnection','4pfceJp','emit','setupSocketListeners','type','application/sdp','204386idDmdQ'];a0_0x3ca8=function(){return _0x56f489;};return a0_0x3ca8();}(function(_0x2e544a,_0x5c6825){const _0x17d666=a0_0x394e,_0x2db565=_0x2e544a();while(!![]){try{const _0x17da94=parseInt(_0x17d666(0x175))/0x1*(parseInt(_0x17d666(0x1ac))/0x2)+parseInt(_0x17d666(0x1ba))/0x3*(parseInt(_0x17d666(0x1c2))/0x4)+-parseInt(_0x17d666(0x16d))/0x5*(parseInt(_0x17d666(0x1a7))/0x6)+-parseInt(_0x17d666(0x17a))/0x7*(parseInt(_0x17d666(0x19d))/0x8)+parseInt(_0x17d666(0x17d))/0x9*(-parseInt(_0x17d666(0x1ab))/0xa)+-parseInt(_0x17d666(0x16c))/0xb*(-parseInt(_0x17d666(0x18c))/0xc)+-parseInt(_0x17d666(0x169))/0xd*(-parseInt(_0x17d666(0x16e))/0xe);if(_0x17da94===_0x5c6825)break;else _0x2db565['push'](_0x2db565['shift']());}catch(_0xa675c2){_0x2db565['push'](_0x2db565['shift']());}}}(a0_0x3ca8,0xe4813));var __create=Object[a0_0x49183f(0x176)],__defProp=Object[a0_0x49183f(0x1c0)],__getOwnPropDesc=Object['getOwnPropertyDescriptor'],__getOwnPropNames=Object[a0_0x49183f(0x1b8)],__getProtoOf=Object[a0_0x49183f(0x172)],__hasOwnProp=Object[a0_0x49183f(0x173)][a0_0x49183f(0x181)],__export=(_0x18cf73,_0x529dd3)=>{for(var _0x21eacd in _0x529dd3)__defProp(_0x18cf73,_0x21eacd,{'get':_0x529dd3[_0x21eacd],'enumerable':!![]});},__copyProps=(_0x45928c,_0x427998,_0x1068e8,_0x2ae692)=>{const _0x20da73=a0_0x49183f;if(_0x427998&&typeof _0x427998===_0x20da73(0x191)||typeof _0x427998===_0x20da73(0x190)){for(let _0x3edbec of __getOwnPropNames(_0x427998))if(!__hasOwnProp['call'](_0x45928c,_0x3edbec)&&_0x3edbec!==_0x1068e8)__defProp(_0x45928c,_0x3edbec,{'get':()=>_0x427998[_0x3edbec],'enumerable':!(_0x2ae692=__getOwnPropDesc(_0x427998,_0x3edbec))||_0x2ae692['enumerable']});}return _0x45928c;},__toESM=(_0x53df75,_0x2e5445,_0x3fb9c6)=>(_0x3fb9c6=_0x53df75!=null?__create(__getProtoOf(_0x53df75)):{},__copyProps(_0x2e5445||!_0x53df75||!_0x53df75[a0_0x49183f(0x18b)]?__defProp(_0x3fb9c6,a0_0x49183f(0x16b),{'value':_0x53df75,'enumerable':!![]}):_0x3fb9c6,_0x53df75)),__toCommonJS=_0x375510=>__copyProps(__defProp({},a0_0x49183f(0x18b),{'value':!![]}),_0x375510),index_exports={};function a0_0x394e(_0x31f577,_0x54d8aa){_0x31f577=_0x31f577-0x167;const _0x3ca822=a0_0x3ca8();let _0x394e64=_0x3ca822[_0x31f577];return _0x394e64;}__export(index_exports,{'AgrasyaVoiceSDK':()=>AgrasyaVoiceSDK}),module[a0_0x49183f(0x1ad)]=__toCommonJS(index_exports);var import_socket=__toESM(require('socket.io-client')),AgrasyaVoiceSDK=class{['config'];[a0_0x49183f(0x174)];['peerConnection']=null;[a0_0x49183f(0x179)]=null;[a0_0x49183f(0x19c)]=null;[a0_0x49183f(0x18f)]=null;['sessionId']=null;[a0_0x49183f(0x192)]=null;['dataUrl']=null;[a0_0x49183f(0x199)]=null;['callDuration']=0x0;[a0_0x49183f(0x19a)]=null;constructor(_0x4c92c1,_0x1926ce={}){const _0x1f8f14=a0_0x49183f;this[_0x1f8f14(0x1b5)]={'baseUrl':_0x1f8f14(0x18a),'language':'','debug':![],..._0x4c92c1},this[_0x1f8f14(0x174)]=_0x1926ce;}[a0_0x49183f(0x196)](..._0x1cc588){const _0x4b6ec0=a0_0x49183f;this[_0x4b6ec0(0x1b5)][_0x4b6ec0(0x1b0)]&&console[_0x4b6ec0(0x196)](_0x4b6ec0(0x1b6),..._0x1cc588);}['setStatus'](_0x50d78d){const _0x4452df=a0_0x49183f;this[_0x4452df(0x174)][_0x4452df(0x1a1)]?.(_0x50d78d);}[a0_0x49183f(0x1bd)](){const _0x3dda2f=a0_0x49183f;this[_0x3dda2f(0x1be)]=0x0,this[_0x3dda2f(0x19a)]=setInterval(()=>{const _0x4add02=_0x3dda2f;this['callDuration']+=0x1,this[_0x4add02(0x174)][_0x4add02(0x177)]?.(this[_0x4add02(0x1be)]);},0x3e8);}[a0_0x49183f(0x184)](){const _0xed28f8=a0_0x49183f;this[_0xed28f8(0x19a)]&&(clearInterval(this[_0xed28f8(0x19a)]),this[_0xed28f8(0x19a)]=null);}async['initializeBackendSession'](){const _0x3914a5=a0_0x49183f,_0x4acffb=this['config'][_0x3914a5(0x1af)]+_0x3914a5(0x186)+this[_0x3914a5(0x1b5)]['language'],_0x314063=await fetch(_0x4acffb,{'method':_0x3914a5(0x19f),'headers':{'x-agrasya-client-api-key':this[_0x3914a5(0x1b5)][_0x3914a5(0x17c)],'Content-Type':_0x3914a5(0x185)}});if(!_0x314063['ok']){const _0x330c3e=await _0x314063[_0x3914a5(0x1b2)]()[_0x3914a5(0x1a5)](()=>({'message':_0x314063[_0x3914a5(0x1aa)]}));throw new Error(_0x3914a5(0x188)+(_0x330c3e[_0x3914a5(0x170)]||_0x314063[_0x3914a5(0x1aa)]));}const _0x2cf2d4=await _0x314063[_0x3914a5(0x1b2)]();if(!_0x2cf2d4['success'])throw new Error(_0x2cf2d4[_0x3914a5(0x170)]||'Backend\x20initialization\x20failed');return _0x2cf2d4[_0x3914a5(0x1b4)];}async['setupWebRTC'](_0x57be48){const _0x19004a=a0_0x49183f;this[_0x19004a(0x1c1)]=new RTCPeerConnection(),this['dataChannel']=this['peerConnection'][_0x19004a(0x17b)](_0x19004a(0x19b));this[_0x19004a(0x179)]&&(this[_0x19004a(0x179)][_0x19004a(0x16a)]=_0x483375=>{const _0x36a1c2=_0x19004a,_0x401047=JSON['parse'](_0x483375[_0x36a1c2(0x1b4)]);this[_0x36a1c2(0x174)]['onTranscript']?.(_0x401047);});this[_0x19004a(0x1c1)][_0x19004a(0x16f)]=_0x5073c6=>{const _0x525142=_0x19004a,_0x10d1b6=document['createElement'](_0x525142(0x1a6));_0x10d1b6['srcObject']=_0x5073c6[_0x525142(0x198)][0x0],_0x10d1b6['autoplay']=!![],document[_0x525142(0x1bf)]['appendChild'](_0x10d1b6);},this[_0x19004a(0x19c)]=await navigator[_0x19004a(0x1bb)][_0x19004a(0x197)]({'audio':!![]});if(this[_0x19004a(0x19c)]){const _0x284b3f=this[_0x19004a(0x19c)][_0x19004a(0x182)]()[0x0];this[_0x19004a(0x1c1)][_0x19004a(0x17f)](_0x284b3f,this[_0x19004a(0x19c)]);}const _0x1aa3dc=await this['peerConnection'][_0x19004a(0x1a3)]();await this[_0x19004a(0x1c1)][_0x19004a(0x1b1)](_0x1aa3dc);const _0x4cd9c5=this[_0x19004a(0x1b5)][_0x19004a(0x1af)]+_0x19004a(0x180),_0x285bfe=await fetch(_0x4cd9c5,{'method':_0x19004a(0x1a2),'body':JSON['stringify']({'sessionId':this[_0x19004a(0x1b9)],'sdp':_0x1aa3dc['sdp']}),'headers':{'x-agrasya-client-api-key':this[_0x19004a(0x1b5)][_0x19004a(0x17c)],'Content-Type':_0x19004a(0x168)}});if(!_0x285bfe['ok'])throw new Error('SDP\x20exchange\x20failed:\x20'+_0x285bfe[_0x19004a(0x1aa)]);const _0x2ec730={'type':'answer','sdp':await _0x285bfe[_0x19004a(0x1a8)]()},_0x31d655={'type':_0x2ec730[_0x19004a(0x167)],'sdp':_0x2ec730[_0x19004a(0x1a9)]};await this[_0x19004a(0x1c1)][_0x19004a(0x194)](_0x31d655);}[a0_0x49183f(0x1c4)](_0x592726){_0x592726['on']('disconnect',()=>{const _0x2361e0=a0_0x394e;this[_0x2361e0(0x171)]();}),_0x592726['on']('session_ended',()=>{const _0x5d0f95=a0_0x394e;this[_0x5d0f95(0x171)]();});}async[a0_0x49183f(0x1a4)](_0x2d88a3){const _0x1f0090=a0_0x49183f;try{this[_0x1f0090(0x189)]('initializing');const _0x32a8a6=await this[_0x1f0090(0x1a0)]();this['sessionId']=_0x32a8a6[_0x1f0090(0x1b9)],this['ephKey']=_0x32a8a6[_0x1f0090(0x192)];if(!this[_0x1f0090(0x192)])throw new Error(_0x1f0090(0x1b3));const _0x5a44a7=await this['fetchMinutesUsage']();this[_0x1f0090(0x196)](_0x1f0090(0x1bc)+_0x5a44a7),await this['setupWebRTC'](this[_0x1f0090(0x192)]),this[_0x1f0090(0x18f)]=(0x0,import_socket[_0x1f0090(0x16b)])(this[_0x1f0090(0x1b5)][_0x1f0090(0x1af)],{'transports':[_0x1f0090(0x193)]}),this[_0x1f0090(0x18f)][_0x1f0090(0x1c3)](_0x1f0090(0x183),{'sessionId':this['sessionId']}),this[_0x1f0090(0x1c4)](this[_0x1f0090(0x18f)]),this[_0x1f0090(0x189)](_0x1f0090(0x1ae)),this['startTimer']();}catch(_0x4a9b5f){this[_0x1f0090(0x189)](_0x1f0090(0x178));throw _0x4a9b5f;}}async[a0_0x49183f(0x1b7)](){const _0xa1aa72=a0_0x49183f;this[_0xa1aa72(0x171)]();}['cleanup'](){const _0x460725=a0_0x49183f;this['peerConnection']&&(this[_0x460725(0x1c1)]['close'](),this[_0x460725(0x1c1)]=null),this['dataChannel']&&(this[_0x460725(0x179)][_0x460725(0x18d)](),this[_0x460725(0x179)]=null),this[_0x460725(0x19c)]&&(this[_0x460725(0x19c)]['getTracks']()[_0x460725(0x187)](_0x34129e=>_0x34129e['stop']()),this[_0x460725(0x19c)]=null),this[_0x460725(0x18f)]&&(this[_0x460725(0x18f)]['disconnect'](),this[_0x460725(0x18f)]=null),this['stopTimer'](),this['setStatus']('idle');}async[a0_0x49183f(0x195)](){const _0x110648=a0_0x49183f,_0x27340a=this['config']['baseUrl']+_0x110648(0x17e),_0x35bf2d=await fetch(_0x27340a,{'method':_0x110648(0x19f),'headers':{'x-agrasya-client-api-key':this[_0x110648(0x1b5)][_0x110648(0x17c)],'Content-Type':_0x110648(0x185)}});if(!_0x35bf2d['ok']){const _0x45d3bd=await _0x35bf2d[_0x110648(0x1b2)]()[_0x110648(0x1a5)](()=>({'message':_0x35bf2d[_0x110648(0x1aa)]}));throw new Error(_0x110648(0x19e)+(_0x45d3bd[_0x110648(0x170)]||_0x35bf2d[_0x110648(0x1aa)]));}const _0x56788b=await _0x35bf2d[_0x110648(0x1b2)]();if(!_0x56788b[_0x110648(0x18e)])throw new Error(_0x56788b['message']||'Failed\x20to\x20fetch\x20minutes\x20usage');return _0x56788b[_0x110648(0x1b4)]['minutesLeft'];}};0x0&&(module[a0_0x49183f(0x1ad)]={'AgrasyaVoiceSDK':AgrasyaVoiceSDK});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a1_0x1f7b57=a1_0x2c62;(function(_0x135dfe,_0x440dba){const _0x2633a0=a1_0x2c62,_0x4987b1=_0x135dfe();while(!![]){try{const _0x4b2fa4=-parseInt(_0x2633a0(0x16f))/0x1*(parseInt(_0x2633a0(0x180))/0x2)+parseInt(_0x2633a0(0x184))/0x3+-parseInt(_0x2633a0(0x147))/0x4*(-parseInt(_0x2633a0(0x17e))/0x5)+-parseInt(_0x2633a0(0x177))/0x6*(-parseInt(_0x2633a0(0x191))/0x7)+-parseInt(_0x2633a0(0x143))/0x8+parseInt(_0x2633a0(0x167))/0x9+-parseInt(_0x2633a0(0x181))/0xa;if(_0x4b2fa4===_0x440dba)break;else _0x4987b1['push'](_0x4987b1['shift']());}catch(_0x1ec3ef){_0x4987b1['push'](_0x4987b1['shift']());}}}(a1_0x6d67,0x54173));function a1_0x6d67(){const _0x3427bb=['/v1/agrasya/usage','statusText','startVoiceSession','initializing','dataChannel','30ZZQlQT','connected','onTranscript','appendChild','setLocalDescription','srcObject','oai-events','891600lwIXTW','config','552778qnvSUj','6912060mBXlOK','body','forEach','1216365wzjiEX','/v1/agrasya/client-token?language=','onStatusChange','createOffer','createElement','json','setRemoteDescription','Failed\x20to\x20fetch\x20minutes\x20usage','message','sessionId','startTimer','application/sdp','ephKey','844641DwgeFX','streams','peerConnection','setupWebRTC','success','text','autoplay','750288EOsDuy','emit','ontrack','Failed\x20to\x20initialize\x20session:\x20','8XrGcIf','durationInterval','setupSocketListeners','key\x20is\x20null\x20or\x20undefined.','[AgrasyaSDK]','stopTimer','error','apiKey','addTrack','parse','application/json','audio','baseUrl','data','session_ended','fetchMinutesUsage','onCallDurationUpdate','sdp','close','idle','setStatus','initializeBackendSession','disconnect','http://localhost:4001','log','callDuration','getTracks','audioStream','language','/v1/agrasya/connect','debug','createDataChannel','2851155sXhCmE','catch','cleanup','POST','Failed\x20to\x20fetch\x20minutes\x20usage:\x20','socket','SDP\x20exchange\x20failed:\x20','GET','2VLwMDr','stop','events'];a1_0x6d67=function(){return _0x3427bb;};return a1_0x6d67();}import a1_0x2a3ce6 from'socket.io-client';function a1_0x2c62(_0x1a4fd1,_0x50b7ee){_0x1a4fd1=_0x1a4fd1-0x13f;const _0x6d6796=a1_0x6d67();let _0x2c6252=_0x6d6796[_0x1a4fd1];return _0x2c6252;}var AgrasyaVoiceSDK=class{[a1_0x1f7b57(0x17f)];[a1_0x1f7b57(0x171)];[a1_0x1f7b57(0x193)]=null;[a1_0x1f7b57(0x176)]=null;[a1_0x1f7b57(0x162)]=null;['socket']=null;[a1_0x1f7b57(0x18d)]=null;['ephKey']=null;['dataUrl']=null;['model']=null;[a1_0x1f7b57(0x160)]=0x0;[a1_0x1f7b57(0x148)]=null;constructor(_0x40f8cc,_0x31e7e5={}){const _0xb8acce=a1_0x1f7b57;this[_0xb8acce(0x17f)]={'baseUrl':_0xb8acce(0x15e),'language':'','debug':![],..._0x40f8cc},this[_0xb8acce(0x171)]=_0x31e7e5;}[a1_0x1f7b57(0x15f)](..._0x33e2c3){const _0x208ac1=a1_0x1f7b57;this[_0x208ac1(0x17f)][_0x208ac1(0x165)]&&console[_0x208ac1(0x15f)](_0x208ac1(0x14b),..._0x33e2c3);}[a1_0x1f7b57(0x15b)](_0x54c124){const _0x4b549f=a1_0x1f7b57;this[_0x4b549f(0x171)][_0x4b549f(0x186)]?.(_0x54c124);}['startTimer'](){const _0x45b396=a1_0x1f7b57;this[_0x45b396(0x160)]=0x0,this['durationInterval']=setInterval(()=>{const _0x3e3112=_0x45b396;this[_0x3e3112(0x160)]+=0x1,this['events'][_0x3e3112(0x157)]?.(this['callDuration']);},0x3e8);}[a1_0x1f7b57(0x14c)](){const _0x3de275=a1_0x1f7b57;this['durationInterval']&&(clearInterval(this[_0x3de275(0x148)]),this['durationInterval']=null);}async[a1_0x1f7b57(0x15c)](){const _0x483f00=a1_0x1f7b57,_0x447afd=this[_0x483f00(0x17f)][_0x483f00(0x153)]+_0x483f00(0x185)+this[_0x483f00(0x17f)][_0x483f00(0x163)],_0x16762b=await fetch(_0x447afd,{'method':_0x483f00(0x16e),'headers':{'x-agrasya-client-api-key':this[_0x483f00(0x17f)][_0x483f00(0x14e)],'Content-Type':'application/json'}});if(!_0x16762b['ok']){const _0x212792=await _0x16762b[_0x483f00(0x189)]()[_0x483f00(0x168)](()=>({'message':_0x16762b['statusText']}));throw new Error(_0x483f00(0x146)+(_0x212792[_0x483f00(0x18c)]||_0x16762b['statusText']));}const _0x1e11c8=await _0x16762b[_0x483f00(0x189)]();if(!_0x1e11c8[_0x483f00(0x140)])throw new Error(_0x1e11c8[_0x483f00(0x18c)]||'Backend\x20initialization\x20failed');return _0x1e11c8[_0x483f00(0x154)];}async[a1_0x1f7b57(0x13f)](_0x5965e6){const _0xf7c31b=a1_0x1f7b57;this[_0xf7c31b(0x193)]=new RTCPeerConnection(),this[_0xf7c31b(0x176)]=this[_0xf7c31b(0x193)][_0xf7c31b(0x166)](_0xf7c31b(0x17d));this[_0xf7c31b(0x176)]&&(this['dataChannel']['onmessage']=_0x37f9d2=>{const _0x5c94ab=_0xf7c31b,_0x74cb7=JSON[_0x5c94ab(0x150)](_0x37f9d2[_0x5c94ab(0x154)]);this['events'][_0x5c94ab(0x179)]?.(_0x74cb7);});this['peerConnection'][_0xf7c31b(0x145)]=_0x55ad69=>{const _0x3bd453=_0xf7c31b,_0x27e0cf=document[_0x3bd453(0x188)](_0x3bd453(0x152));_0x27e0cf[_0x3bd453(0x17c)]=_0x55ad69[_0x3bd453(0x192)][0x0],_0x27e0cf[_0x3bd453(0x142)]=!![],document[_0x3bd453(0x182)][_0x3bd453(0x17a)](_0x27e0cf);},this['audioStream']=await navigator['mediaDevices']['getUserMedia']({'audio':!![]});if(this[_0xf7c31b(0x162)]){const _0x3eb38f=this[_0xf7c31b(0x162)][_0xf7c31b(0x161)]()[0x0];this[_0xf7c31b(0x193)][_0xf7c31b(0x14f)](_0x3eb38f,this[_0xf7c31b(0x162)]);}const _0x2d537e=await this[_0xf7c31b(0x193)][_0xf7c31b(0x187)]();await this[_0xf7c31b(0x193)][_0xf7c31b(0x17b)](_0x2d537e);const _0xeb9ef7=this[_0xf7c31b(0x17f)][_0xf7c31b(0x153)]+_0xf7c31b(0x164),_0x15269b=await fetch(_0xeb9ef7,{'method':_0xf7c31b(0x16a),'body':JSON['stringify']({'sessionId':this[_0xf7c31b(0x18d)],'sdp':_0x2d537e['sdp']}),'headers':{'x-agrasya-client-api-key':this[_0xf7c31b(0x17f)]['apiKey'],'Content-Type':_0xf7c31b(0x18f)}});if(!_0x15269b['ok'])throw new Error(_0xf7c31b(0x16d)+_0x15269b[_0xf7c31b(0x173)]);const _0x7229f2={'type':'answer','sdp':await _0x15269b[_0xf7c31b(0x141)]()},_0x56bbc0={'type':_0x7229f2['type'],'sdp':_0x7229f2[_0xf7c31b(0x158)]};await this[_0xf7c31b(0x193)][_0xf7c31b(0x18a)](_0x56bbc0);}[a1_0x1f7b57(0x149)](_0x2fbd4e){const _0x2afb13=a1_0x1f7b57;_0x2fbd4e['on']('disconnect',()=>{this['cleanup']();}),_0x2fbd4e['on'](_0x2afb13(0x155),()=>{const _0x24637a=_0x2afb13;this[_0x24637a(0x169)]();});}async[a1_0x1f7b57(0x174)](_0x47d93f){const _0x56da5b=a1_0x1f7b57;try{this[_0x56da5b(0x15b)](_0x56da5b(0x175));const _0x29e200=await this[_0x56da5b(0x15c)]();this[_0x56da5b(0x18d)]=_0x29e200['sessionId'],this[_0x56da5b(0x190)]=_0x29e200[_0x56da5b(0x190)];if(!this[_0x56da5b(0x190)])throw new Error(_0x56da5b(0x14a));const _0x42800a=await this[_0x56da5b(0x156)]();this['log']('Minutes\x20left:\x20'+_0x42800a),await this[_0x56da5b(0x13f)](this['ephKey']),this[_0x56da5b(0x16c)]=a1_0x2a3ce6(this['config'][_0x56da5b(0x153)],{'transports':['websocket']}),this[_0x56da5b(0x16c)][_0x56da5b(0x144)]('join_session',{'sessionId':this['sessionId']}),this[_0x56da5b(0x149)](this[_0x56da5b(0x16c)]),this['setStatus'](_0x56da5b(0x178)),this[_0x56da5b(0x18e)]();}catch(_0x699458){this[_0x56da5b(0x15b)](_0x56da5b(0x14d));throw _0x699458;}}async['stopVoiceSession'](){const _0x417da3=a1_0x1f7b57;this[_0x417da3(0x169)]();}[a1_0x1f7b57(0x169)](){const _0x3ee878=a1_0x1f7b57;this[_0x3ee878(0x193)]&&(this['peerConnection']['close'](),this['peerConnection']=null),this['dataChannel']&&(this[_0x3ee878(0x176)][_0x3ee878(0x159)](),this['dataChannel']=null),this['audioStream']&&(this[_0x3ee878(0x162)][_0x3ee878(0x161)]()[_0x3ee878(0x183)](_0x1bf9cd=>_0x1bf9cd[_0x3ee878(0x170)]()),this['audioStream']=null),this['socket']&&(this['socket'][_0x3ee878(0x15d)](),this[_0x3ee878(0x16c)]=null),this['stopTimer'](),this[_0x3ee878(0x15b)](_0x3ee878(0x15a));}async['fetchMinutesUsage'](){const _0x1cefb3=a1_0x1f7b57,_0x389c16=this[_0x1cefb3(0x17f)][_0x1cefb3(0x153)]+_0x1cefb3(0x172),_0xf69327=await fetch(_0x389c16,{'method':'GET','headers':{'x-agrasya-client-api-key':this[_0x1cefb3(0x17f)][_0x1cefb3(0x14e)],'Content-Type':_0x1cefb3(0x151)}});if(!_0xf69327['ok']){const _0x15f2ef=await _0xf69327[_0x1cefb3(0x189)]()['catch'](()=>({'message':_0xf69327[_0x1cefb3(0x173)]}));throw new Error(_0x1cefb3(0x16b)+(_0x15f2ef[_0x1cefb3(0x18c)]||_0xf69327[_0x1cefb3(0x173)]));}const _0x59a878=await _0xf69327[_0x1cefb3(0x189)]();if(!_0x59a878[_0x1cefb3(0x140)])throw new Error(_0x59a878[_0x1cefb3(0x18c)]||_0x1cefb3(0x18b));return _0x59a878[_0x1cefb3(0x154)]['minutesLeft'];}};export{AgrasyaVoiceSDK};
|