@94ai/softphone 5.0.8 → 5.0.9
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/html-softphone-demo/index.html +6 -0
- package/html-softphone-demo/softphone.umd.min.js +2 -1
- package/html-softphone-demo.7z +0 -0
- package/lib/softphone.cjs.min.cjs +1 -1
- package/lib/softphone.esm-bundler.min.mjs +1 -1
- package/lib/softphone.umd.min.js +2 -1
- package/package.json +1 -1
- package/html-softphone-demo.zip +0 -0
package/html-softphone-demo.7z
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t,n=require("@babel/runtime-corejs3/helpers/esm/classCallCheck"),i=require("@babel/runtime-corejs3/helpers/esm/createClass"),r=require("sip.js"),s=require("sip.js/lib/platform/web/index.js"),a=require("on-change"),o=require("@babel/runtime-corejs3/helpers/esm/typeof"),c=require("@babel/runtime-corejs3/regenerator"),u=require("@babel/runtime-corejs3/core-js/json/stringify"),l=require("@babel/runtime-corejs3/core-js/object/define-property"),f=require("@babel/runtime-corejs3/core-js/date/now"),h=require("@babel/runtime-corejs3/core-js/instance/for-each"),d=require("@babel/runtime-corejs3/core-js/set-timeout"),p=require("@babel/runtime-corejs3/core-js/set-interval"),v=require("@babel/runtime-corejs3/core-js/promise"),g=require("@babel/runtime-corejs3/core-js/object/assign"),m=require("@babel/runtime-corejs3/core-js/instance/concat"),w=require("@babel/runtime-corejs3/core-js/instance/map"),b=require("@babel/runtime-corejs3/core-js/instance/index-of"),k=require("@babel/runtime-corejs3/core-js/instance/filter"),x=require("@babel/runtime-corejs3/core-js/weak-map"),y=require("@babel/runtime-corejs3/core-js/weak-set"),S=require("@babel/runtime-corejs3/core-js/object/keys"),A=require("@babel/runtime-corejs3/core-js/instance/pad-start"),I=require("@babel/runtime-corejs3/core-js/instance/slice"),T=require("crypto-js"),j=require("@fingerprintjs/fingerprintjs");function O(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))}function C(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function q(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var D,E,R,N,P=m(e="sip:".concat("","@")).call(e,""),M=m(t="".concat("","://")).call(t,""),U={authorizationPassword:"",authorizationUsername:"",viaHost:"",uri:r.UserAgent.makeURI(P),logLevel:"error",transportOptions:{server:M},contactName:""},H={connectStatus:!1,registerStatus:!1,invitatingStatus:!1,incomingStatus:!1,answerStatus:!1,reconnectStatus:!1};function z(e){return document.getElementById(e)}function L(e){if(e&&e.getTracks)try{var t=e.getTracks();h(t).call(t,(function(e){try{e.stop()}catch(e){}}))}catch(e){}}function X(e){return navigator.mediaDevices.getUserMedia(e).then((function(e){return e?(L(e),!0):v.reject(new Error("EmptyStreamError"))})).catch((function(e){return(!e||"NotAllowedError"!==e.name)&&v.reject(e)}))}!function(e){e.NO="0",e.YES="1"}(D||(D={})),function(e){e.NO="0",e.YES="1"}(E||(E={})),function(e){e.MULTI_AI="1",e.MULTI_VOICE_NOTIFY="2",e.MULTI_PRETEST="3",e.LABOUR="4",e.AI="5",e.NEW_VOICE_NOTIFY="6"}(R||(R={})),function(e){e.DIRECT_ANSWER="1",e.LISTEN_FIRST_AND_THEN_ANSWER_MANUALLY="2"}(N||(N={}));var F,G,_,B,Y,V,J,W,Z,K,$,Q,ee,te,ne,ie,re,se,ae,oe,ce,ue,le,fe,he,de,pe,ve,ge,me,we,be,ke,xe,ye,Se,Ae,Ie,Te,je,Oe,Ce,qe,De,Ee,Re,Ne,Pe,Me,Ue,He,ze,Le,Xe,Fe,Ge,_e,Be,Ye,Ve,Je,We,Ze,Ke,$e,Qe,et,tt,nt,it,rt,st,at,ot,ct,ut,lt,ft,ht,dt,pt,vt,gt,mt,wt,bt,kt,xt,yt,St,At,It,Tt,jt,Ot,Ct,qt,Dt,Et,Rt,Nt,Pt,Mt,Ut,Ht,zt,Lt,Xt,Ft,Gt,_t,Bt,Yt,Vt,Jt,Wt,Zt,Kt,$t,Qt,en,tn,nn,rn=function(e){var t,n,i;return A(t=e.getHours().toString()).call(t,2,"0")+":"+A(n=e.getMinutes().toString()).call(n,2,"0")+":"+A(i=e.getSeconds().toString()).call(i,2,"0")},sn=function(){return new Date(new Date((new Date).toLocaleDateString()).getTime())},an=function(e){return new Date(e.setSeconds(e.getSeconds()+1))};function on(e,t,n){var i=window.XMLHttpRequest?new window.XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):void 0;i||t(new Error("Your Browser does not support ajax")),i.onreadystatechange=function(){if(4==i.readyState){var n=i.response||i.responseText;if(200==i.status){var r=i.getResponseHeader("Content-Type");-1!=b(r).call(r,"json")?e(JSON.parse(i.responseText)):-1!=b(r).call(r,"xml")?e(i.responseXML):e(i.responseText)}else t(n)}};var r=n.url,s=n.data,a=n.type,o=n.contentType,c=a||"POST",l=r,f=null;return s&&("GET"===c?l=l+"?"+function(e){var t=[];for(var n in e)t.push(n+"="+e[n]);return t.join("&")}(s):"POST"===c&&(f=u(s))),i.open(c,l,!0),{xhr:i,ajaxData:f,contentType:o}}var cn,un,ln=function(){function e(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n(this,e),F.add(this),G.set(this,void 0),_.set(this,void 0),B.set(this,void 0),Y.set(this,void 0),V.set(this,void 0),J.set(this,[]),W.set(this,[]),Z.set(this,{}),K.set(this,void 0),$.set(this,void 0),Q.set(this,new MediaStream),ee.set(this,JSON.parse(u(H))),te.set(this,0),ne.set(this,void 0),ie.set(this,void 0),re.set(this,void 0),l(this,"token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),se.set(this,void 0),ae.set(this,48e4),oe.set(this,12e6),ce.set(this,{}),ue.set(this,void 0),le.set(this,void 0),fe.set(this,void 0),he.set(this,(function(e){})),de.set(this,(function(e){})),pe.set(this,(function(e){})),ve.set(this,(function(e){})),ge.set(this,(function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i,r;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!C(this,ne,"f")||!C(this,ie,"f")){t.next=9;break}if(!(f()-C(this,ie,"f")>e)){t.next=9;break}return t.next=4,C(this,we,"f").call(this);case 4:n=t.sent,i=n.sign,r=n.timestamp,q(this,ne,null!=i?i:C(this,ne,"f"),"f"),q(this,ie,null!=r?r:C(this,ie,"f"),"f");case 9:case"end":return t.stop()}}),t,this)})))})),me.set(this,(function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i,r,s,a;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!C(this,se,"f")){t.next=19;break}if(!(f()-C(this,se,"f")>e)){t.next=19;break}if(!C(this,re,"f")){t.next=12;break}return t.next=5,C(this,be,"f").call(this);case 5:n=t.sent,i=n.token,r=n.tokenTimestamp,q(this,re,null!=i?i:C(this,re,"f"),"f"),q(this,se,null!=r?r:f(),"f"),t.next=19;break;case 12:if(!this.token){t.next=19;break}return t.next=15,this.getGatewayAccessToken({corpId:C(this,Fe,"f"),sid:C(this,Be,"f"),secret:C(this,Ge,"f"),seatOnline:!1});case 15:s=t.sent,a=s.token,this.token=a,q(this,se,f(),"f");case 19:case"end":return t.stop()}}),t,this)})))})),we.set(this,(function(){})),be.set(this,(function(){})),ke.set(this,(function(e){})),xe.set(this,(function(e){})),ye.set(this,void 0),Se.set(this,void 0),l(this,"networkSpeed",{enumerable:!0,configurable:!0,writable:!0,value:"0.00Mb/s"}),l(this,"networkDelay",{enumerable:!0,configurable:!0,writable:!0,value:"0ms"}),l(this,"onLine",{enumerable:!0,configurable:!0,writable:!0,value:navigator.onLine}),l(this,"testspeeding",{enumerable:!0,configurable:!0,writable:!0,value:!1}),l(this,"goodNetworkSpeed",{enumerable:!0,configurable:!0,writable:!0,value:function(){return 1e3*Number(t.networkSpeed.replace("Mb/s",""))>=30}}),l(this,"goodNetworkDelay",{enumerable:!0,configurable:!0,writable:!0,value:function(){return Number(t.networkDelay.replace("ms",""))<=500&&"0ms"!==t.networkDelay}}),l(this,"authorizedMicrophonePermissions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),l(this,"authorizedNotificationPermissions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Ae.set(this,100),Ie.set(this,3),Te.set(this,8),je.set(this,3),Oe.set(this,0),Ce.set(this,!1),qe.set(this,void 0),De.set(this,3),Ee.set(this,3),Re.set(this,0),Ne.set(this,0),Pe.set(this,0),Me.set(this,!1),Ue.set(this,!1),He.set(this,!1),ze.set(this,void 0),Le.set(this,void 0),Xe.set(this,void 0),Fe.set(this,void 0),Ge.set(this,void 0),_e.set(this,void 0),Be.set(this,void 0),Ye.set(this,void 0),Ve.set(this,void 0),Je.set(this,void 0),We.set(this,void 0),Ze.set(this,(function(e){C(t,F,"m",$t).call(t)})),Ke.set(this,(function(){})),$e.set(this,void 0),Qe.set(this,void 0),et.set(this,!1),tt.set(this,4e3),nt.set(this,4e3),it.set(this,{}),rt.set(this,!1),st.set(this,!0),l(this,"ifAutoAnswer",{enumerable:!0,configurable:!0,writable:!0,value:function(){return String(C(t,it,"f").autoAnswer)===D.YES}}),l(this,"notNeedSendStarDtmf",{enumerable:!0,configurable:!0,writable:!0,value:function(){return String(C(t,it,"f").afterTransferLabour)===N.DIRECT_ANSWER}}),at.set(this,(function(){if(C(t,st,"f")){var e;C(t,ot,"f").call(t);var n=new(window.AudioContext||window.webkitAudioContext);q(t,le,n.createScriptProcessor(2048,1,1),"f"),C(t,le,"f").onaudioprocess=function(e){for(var n=e.inputBuffer.getChannelData(0),i=0,r=0;r<n.length;++r)i+=n[r]*n[r];q(t,te,Number(Math.sqrt(i/n.length).toFixed(2)),"f"),C(t,he,"f").call(t,C(t,te,"f"))},q(t,fe,new MediaStream,"f"),h(e=t.getSenders()).call(e,(function(e){e.track&&C(t,fe,"f").addTrack(e.track)})),q(t,ue,n.createMediaStreamSource(C(t,fe,"f")),"f"),C(t,ue,"f").connect(C(t,le,"f")),C(t,le,"f").connect(n.destination)}})),ot.set(this,(function(){if(C(t,st,"f")){if(C(t,ue,"f"))try{C(t,ue,"f").disconnect()}catch(e){console.log(e)}if(C(t,le,"f"))try{C(t,le,"f").disconnect()}catch(e){console.log(e)}if(C(t,fe,"f"))try{var e;h(e=C(t,fe,"f").getTracks()).call(e,(function(e){e.stop()}))}catch(e){console.log(e)}}q(t,ue,void 0,"f"),q(t,le,void 0,"f"),q(t,fe,void 0,"f"),q(t,te,0,"f"),C(t,he,"f").call(t,C(t,te,"f"))})),l(this,"disposeSoftphoneEnvRequirementCheck",{enumerable:!0,configurable:!0,writable:!0,value:function(){C(t,ct,"f").call(t),window.removeEventListener("offline",C(t,ft,"f")),window.removeEventListener("online",C(t,lt,"f")),window.removeEventListener("unload",t.disposeSoftphoneEnvRequirementCheck)}}),ct.set(this,(function(){clearInterval(C(t,ye,"f")),q(t,ye,void 0,"f"),clearTimeout(C(t,Se,"f")),q(t,Se,void 0,"f"),t.testspeeding=!1})),l(this,"softphoneEnvCheck",{enumerable:!0,configurable:!0,writable:!0,value:function(){return O(t,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.testspeeding||(C(this,ut,"f").call(this),this.oneRoundOfTesting());case 1:case"end":return e.stop()}}),e,this)})))}}),ut.set(this,(function(){window.addEventListener("offline",C(t,ft,"f")),window.addEventListener("online",C(t,lt,"f")),window.addEventListener("unload",t.disposeSoftphoneEnvRequirementCheck)})),l(this,"oneRoundOfTesting",{enumerable:!0,configurable:!0,writable:!0,value:function(){return O(t,void 0,void 0,c.mark((function e(){var t=this;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.testspeeding=!0,this.detectNavigatorPermissions(),this.onLine?(C(this,ht,"f").call(this,this),q(this,Se,d((function(){t.testspeeding=!1,t.disposeSoftphoneEnvRequirementCheck()}),4e3),"f")):this.testspeeding=!1;case 3:case"end":return e.stop()}}),e,this)})))}}),lt.set(this,(function(){t.onLine=!0,t.oneRoundOfTesting()})),ft.set(this,(function(){t.onLine=!1,t.networkSpeed="0.00Mb/s",t.networkDelay="0ms",C(t,xe,"f").call(t,{networkSpeed:t.networkSpeed,networkDelay:t.networkDelay,authorizedMicrophonePermissions:t.authorizedMicrophonePermissions,authorizedNotificationPermissions:t.authorizedNotificationPermissions}),C(t,ct,"f").call(t)})),ht.set(this,(function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i,r=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e||this,clearInterval(C(n,ye,"f")),q(n,ye,void 0,"f"),i=function(){return O(r,void 0,void 0,c.mark((function e(){var t;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.onLine){e.next=15;break}return e.prev=1,e.next=4,C(n,dt,"f").call(n);case 4:t=e.sent,n.networkSpeed=t.networkSpeed,n.networkDelay=t.networkDelay,e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),n.networkSpeed="0.00Mb/s",n.networkDelay="0ms";case 13:e.next=17;break;case 15:n.networkSpeed="0.00Mb/s",n.networkDelay="0ms";case 17:C(this,xe,"f").call(this,{networkSpeed:this.networkSpeed,networkDelay:this.networkDelay,authorizedMicrophonePermissions:this.authorizedMicrophonePermissions,authorizedNotificationPermissions:this.authorizedNotificationPermissions}),C(this,Se,"f")||(this.testspeeding=!1,this.disposeSoftphoneEnvRequirementCheck());case 19:case"end":return e.stop()}}),e,this,[[1,9]])})))},t.next=6,i();case 6:C(this,Se,"f")&&q(n,ye,p((function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i();case 2:case"end":return e.stop()}}),e)})))}),1e3),"f");case 7:case"end":return t.stop()}}),t,this)})))})),dt.set(this,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://seat.94ai.com/favicon.png",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:63491,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return O(t,void 0,void 0,c.mark((function t(){var r,s;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=[],s=0;s<i;s++)r.push(C(this,pt,"f").call(this,e+"?d="+f()+s,n));return t.abrupt("return",v.all(r).then((function(e){var t=0,n=0;return h(e).call(e,(function(e){t+=Number(e[0]),n+=Number(e[1])})),{networkDelay:(n/i).toFixed(2)+"ms",networkSpeed:(t/i).toFixed(2)+"Mb/s"}})));case 3:case"end":return t.stop()}}),t,this)})))})),pt.set(this,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://seat.94ai.com/favicon.png?d="+f(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:63491;return new v((function(n,i){var r=document.createElement("img");r.start=window.performance.now(),r.onload=function(){var e=window.performance.now()-r.start;n([(1e3*t/(1048576*e)).toFixed(2),e])},r.onerror=function(e){i(e)},r.src=e})).catch((function(e){throw e}))})),l(this,"openApiAjax",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return new v((function(n,i){return O(t,void 0,void 0,c.mark((function t(){var r,s,a,o,u,l,f;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=on(n,i,e),s=r.xhr,a=r.ajaxData,o=r.contentType,t.next=3,this.getOpenApiSign();case 3:return u=t.sent,l=u.timestamp,f=u.sign,s.setRequestHeader("appKey",C(this,Fe,"f")),s.setRequestHeader("timestamp",String(l)),s.setRequestHeader("sign",f),s.setRequestHeader("Content-type",o||"application/json"),t.next=12,C(this,pe,"f").call(this,s);case 12:s.send(a);case 13:case"end":return t.stop()}}),t,this)})))}))}}),l(this,"requestGateway",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.gatewayApiAjax(g(g({},e),{url:t.getGateway()+e.url}),n)}}),l(this,"gatewayApiAjax",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new v((function(i,r){return O(t,void 0,void 0,c.mark((function t(){var s,a,o,u,l;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=on(i,r,e),a=s.xhr,o=s.ajaxData,u=s.contentType,!n){t.next=8;break}return t.next=4,this.getGatewayToken();case 4:l=t.sent,a.setRequestHeader("x-token",l),a.setRequestHeader("seatsToken",l),a.setRequestHeader("x-authority-token",l);case 8:return a.setRequestHeader("x-app-code",3),a.setRequestHeader("content-type",u||"application/json"),t.next=12,C(this,ve,"f").call(this,a);case 12:a.send(o);case 13:case"end":return t.stop()}}),t,this)})))}))}}),l(this,"requestOpenApi",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return t.openApiAjax(g(g({},e),{url:t.getOpenApi()+e.url}))}}),l(this,"getDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:function(){return O(t,void 0,void 0,c.mark((function e(){var t,n;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,We,"f")){e.next=2;break}return e.abrupt("return",C(this,We,"f"));case 2:return e.next=4,j.load();case 4:return t=e.sent,e.next=7,t.get();case 7:return n=e.sent,q(this,We,n.visitorId,"f"),e.abrupt("return",C(this,We,"f"));case 10:case"end":return e.stop()}}),e,this)})))}}),yt.set(this,(function(){return O(t,void 0,void 0,c.mark((function e(){var t,n,i,s;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,F,"m",xt).call(this)||C(this,Z,"f").authorizationUsername&&C(this,Z,"f").uri&&C(this,Z,"f").authorizationPassword&&C(this,Z,"f").transportOptions.server){e.next=16;break}return e.next=3,this.getAgentInfo();case 3:if(200!=(t=e.sent).code){e.next=15;break}s=t.data,C(this,Z,"f").authorizationUsername=s.agentExtension,C(this,Z,"f").authorizationPassword=s.extensionPwd,C(this,Z,"f").contactName||(C(this,Z,"f").contactName=s.agentExtension),C(this,Z,"f").uri=r.UserAgent.makeURI(m(n="sip:".concat(s.agentExtension,"@")).call(n,s.wsRegisterAddress)),C(this,Z,"f").transportOptions.server=m(i="".concat(s.wsProtocol,"://")).call(i,s.wsRegisterAddress),q(this,Be,s.agentId,"f"),q(this,_e,s.agentTag,"f"),e.next=16;break;case 15:throw new Error(t);case 16:case"end":return e.stop()}}),e,this)})))})),St.set(this,(function(){return O(t,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(C(this,Z,"f").viaHost){e.next=6;break}return e.t0="",e.next=4,this.getDeviceId();case 4:e.t1=e.sent,C(this,Z,"f").viaHost=m(e.t0).call(e.t0,e.t1,".sip");case 6:case"end":return e.stop()}}),e,this)})))})),It.set(this,(function(e){var n,i,r,s,a,o,c,u,l,f,h,d,p,v,g,m,b,k,x,y,S;C(t,it,"f").popWindow=null===(a=e["X-Popwindow"])||void 0===a?void 0:a[0].raw,C(t,it,"f").afterTransferLabour=null===(o=e["X-Aftertransferlabour"])||void 0===o?void 0:o[0].raw,C(t,it,"f").callId=null===(c=e["X-94callid"])||void 0===c?void 0:c[0].raw,C(t,it,"f").cid=null===(u=e["X-Cid"])||void 0===u?void 0:u[0].raw,C(t,it,"f").numberId=null===(l=e["X-Numberid"])||void 0===l?void 0:l[0].raw,C(t,it,"f").tag=(null===(f=e["X-Tag"])||void 0===f?void 0:f[0].raw)&&"null"!==(null===(h=e["X-Tag"])||void 0===h?void 0:h[0].raw)?w(n=e["X-Tag"][0].raw.split("-")).call(n,(function(e){return String.fromCharCode(e)})).join(""):"",C(t,it,"f").taskId=null===(d=e["X-Taskid"])||void 0===d?void 0:d[0].raw,C(t,it,"f").voiceType=null===(p=e["X-Voicetype"])||void 0===p?void 0:p[0].raw,C(t,it,"f").processTime=null===(v=e["X-Processtime"])||void 0===v?void 0:v[0].raw,C(t,it,"f").userPhone=null===(g=e["X-Userphone"])||void 0===g?void 0:g[0].raw,C(t,it,"f").autoAnswer=null===(m=e["X-94autoanswer"])||void 0===m?void 0:m[0].raw,C(t,it,"f").nodeTitle=null===(b=e["X-Nodetitle"])||void 0===b?void 0:w(i=b[0].raw.split("-")).call(i,(function(e){return String.fromCharCode(e)})).join(""),C(t,it,"f").taskName=null===(k=e["X-Taskname"])||void 0===k?void 0:w(r=k[0].raw.split("-")).call(r,(function(e){return String.fromCharCode(e)})).join(""),C(t,it,"f").templateTitle=null===(x=e["X-Templatetitle"])||void 0===x?void 0:w(s=x[0].raw.split("-")).call(s,(function(e){return String.fromCharCode(e)})).join(""),C(t,it,"f").phoneNumber=(null===(y=e["X-Phonenumber"])||void 0===y?void 0:y[0].raw)||(null===(S=e.From)||void 0===S?void 0:S[0].parsed.uri.normal.user)})),zt.set(this,(function(e){switch(e){case r.SessionState.Initial:case r.SessionState.Establishing:break;case r.SessionState.Established:C(t,F,"m",Ht).call(t);break;case r.SessionState.Terminating:case r.SessionState.Terminated:var n=d((function(){clearTimeout(n),n=void 0,C(t,ee,"f").incomingStatus=!1}),10);C(t,ot,"f").call(t);break;default:throw new Error("Unknown session state.")}})),Xt.set(this,(function(e,n,i){C(t,Te,"f")&&(q(t,Ce,!1,"f"),C(t,ee,"f").reconnectStatus=!1,C(t,Ue,"f")&&(q(t,Ue,!1,"f"),C(t,_t,"f").call(t,e,n,i)))})),Ft.set(this,(function(){return O(t,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,Te,"f")){e.next=15;break}return q(this,Ce,!0,"f"),q(this,Ue,!1,"f"),e.next=5,this.getUserAgent().transport.disconnect().catch((function(e){return console.error(e)}));case 5:return console.log("sip transport disconnect"),e.prev=6,e.next=9,C(this,F,"m",Lt).call(this);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:C(this,Bt,"f").call(this),C(this,F,"m",$t).call(this);case 15:case"end":return e.stop()}}),e,this,[[6,11]])})))})),Gt.set(this,(function(){if(C(t,Te,"f")){var e=C(t,Z,"f").uri.clone(),n=C(t,Z,"f").uri.clone(),i=C(t,Z,"f").uri.clone();i.user=void 0,C(t,_t,"f").call(t,i,e,n)}})),_t.set(this,(function(e,n,i){if(C(t,Te,"f")){if(C(t,Ue,"f"))return;q(t,Ue,!0,"f"),q(t,Le,d((function(){C(t,F,"m",Zt).call(t);var r=t.getUserAgent().userAgentCore,s=r.makeOutgoingRequestMessage("OPTIONS",e,n,i,{});q(t,qe,r.request(s,{onAccept:function(){console.log("sip ping ok"),q(t,Oe,0,"f"),q(t,qe,void 0,"f"),C(t,Xt,"f").call(t,e,n,i)},onReject:function(r){var s;if(q(t,qe,void 0,"f"),408===r.message.statusCode||503===r.message.statusCode)if(console.log("sip ping error with code "+r.message.statusCode),C(t,je,"f")>0&&C(t,Oe,"f")>=C(t,je,"f"))console.log("sip maximum ping attempts reached"),C(t,Ft,"f").call(t);else{var a,o;if(C(t,Oe,"f")>0)console.log(m(o="sip ping retry ".concat(C(t,Oe,"f")," of ")).call(o,C(t,je,"f")," fail"));q(t,Oe,(s=C(t,Oe,"f"),++s),"f"),console.log(m(a="sip ping retry ".concat(C(t,Oe,"f")," of ")).call(a,C(t,je,"f"))),C(t,Xt,"f").call(t,e,n,i)}else q(t,Oe,0,"f"),C(t,Xt,"f").call(t,e,n,i)}}),"f")}),1e3*C(t,Te,"f")),"f")}})),Bt.set(this,(function(){if(C(t,Te,"f")){if(q(t,Ue,!1,"f"),q(t,Ce,!1,"f"),C(t,qe,"f")){try{C(t,qe,"f").dispose()}catch(e){}q(t,qe,void 0,"f")}C(t,Le,"f")&&C(t,F,"m",Zt).call(t)}})),Kt.set(this,(function(){if(C(t,De,"f")){if(C(t,He,"f"))return;q(t,He,!0,"f"),C(t,ee,"f").reconnectStatus=!0,q(t,Xe,d((function(){return O(t,void 0,void 0,c.mark((function e(){var t=this;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,C(this,F,"m",Jt).call(this),0===C(this,Re,"f")&&console.log("sip reconnect success then register start"),e.next=5,C(this,B,"f").register({requestDelegate:{onAccept:function(e){console.log("sip reconnect success and register ok"),q(t,Re,0,"f"),q(t,He,!1,"f"),C(t,ee,"f").registerStatus=!0,C(t,ee,"f").reconnectStatus=!1,C(t,Gt,"f").call(t)},onReject:function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log("sip reconnect success but register fail with code "+e.message.statusCode),q(this,He,!1,"f"),!(C(this,Ee,"f")<=C(this,Re,"f"))){t.next=10;break}return console.log("sip maximum register attempts reached"),q(this,Re,0,"f"),t.next=7,this.getUserAgent().transport.disconnect().catch((function(e){return console.error(e)}));case 7:C(this,F,"m",$t).call(this),t.next=13;break;case 10:q(this,Re,(n=C(this,Re,"f"),++n),"f"),console.log(m(i="sip reconnect success and register retry ".concat(C(this,Re,"f")," of ")).call(i,C(this,Ee,"f"))),C(this,Kt,"f").call(this);case 13:case"end":return t.stop()}}),t,this)})))}},requestOptions:{extraHeaders:C(this,G,"f")}});case 5:e.next=12;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("sip reconnect then registerer register error",e.t0),q(this,Re,0,"f"),q(this,He,!1,"f");case 12:case"end":return e.stop()}}),e,this,[[0,7]])})))}),1e3*C(t,De,"f")),"f")}})),"object"!==o(i))throw new Error("userAgentOption must be plain object");C(this,F,"m",wt).call(this,i),C(this,F,"m",bt).call(this,i),C(this,F,"m",mt).call(this,i),C(this,F,"m",kt).call(this,i),C(this,F,"m",jt).call(this,i),C(this,F,"m",gt).call(this,i),C(this,F,"m",vt).call(this,i),q(this,Z,C(this,F,"m",Ct).call(this,i),"f")}return i(e,[{key:"volumeValue",get:function(){return C(this,te,"f")}},{key:"businessAttribute",get:function(){return C(this,it,"f")}},{key:"getFastOutboundCall",value:function(){return C(this,it,"f").voiceType===R.LABOUR}},{key:"getSitOutboundCall",value:function(){return C(this,it,"f").voiceType===R.AI}},{key:"detectNavigatorPermissions",value:function(){var e,t=this;-1===b(e=navigator.userAgent).call(e,"Firefox")?navigator.permissions.query({name:"microphone"}).then((function(e){"granted"===e.state?t.authorizedMicrophonePermissions=!0:t.authorizedMicrophonePermissions=!1})).catch((function(e){console.log("Got error :",e),t.authorizedMicrophonePermissions=!1})):navigator.mediaDevices.enumerateDevices().then((function(e){""!==k(e).call(e,(function(e){return"audioinput"===e.kind}))[0].label?t.authorizedMicrophonePermissions=!0:t.authorizedMicrophonePermissions=!1})),navigator.permissions.query({name:"notifications"}).then((function(e){"granted"===e.state?t.authorizedNotificationPermissions=!0:t.authorizedNotificationPermissions=!1})).catch((function(e){console.log("Got error :",e),t.authorizedNotificationPermissions=!1}))}},{key:"getGateway",value:function(){return"1"===C(this,Je,"f")?"https://gateway.sg.94ai.com":"https://gateway.94ai.com"}},{key:"getGatewayToken",value:function(){return O(this,void 0,void 0,c.mark((function e(){var t,n;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C(this,me,"f").call(this,C(this,oe,"f"));case 2:if(!C(this,re,"f")){e.next=4;break}return e.abrupt("return",C(this,re,"f"));case 4:if(this.token){e.next=13;break}return e.next=7,C(this,yt,"f").call(this);case 7:return e.next=9,this.getGatewayAccessToken({corpId:C(this,Fe,"f"),sid:C(this,Be,"f"),secret:C(this,Ge,"f"),seatOnline:!1});case 9:t=e.sent,n=t.token,this.token=n,q(this,se,f(),"f");case 13:return e.abrupt("return",this.token);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"getGatewayAccessToken",value:function(e){return this.requestGateway({url:"/authority/accessToken/openApi",data:e},!1)}},{key:"getCallNumberDetail",value:function(e){return this.requestGateway({url:"/task-aggre/callCenterNumber/get",data:e})}},{key:"getCallNumberChats",value:function(e){return this.requestGateway({url:"/dialogue-aggre/call-center-number/chat/list",data:e})}},{key:"getCallInfo",value:function(){return O(this,void 0,void 0,c.mark((function e(){var t,n,i=this;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=g({},C(this,it,"f")),n=function(){return O(i,void 0,void 0,c.mark((function e(){var n,i,r,s,a,o,u,l,f,h,d,p,v,g,b,k,x,y,S,A;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.numberId||!t.taskId){e.next=57;break}return n={},e.prev=2,e.next=5,this.getCallNumberDetail({id:t.numberId,taskId:t.taskId});case 5:if(200===(n=e.sent).code){e.next=11;break}return console.error(n.message),t.stop=!0,C(this,ke,"f").call(this,new Error(n.message)),e.abrupt("return");case 11:e.next=20;break;case 13:return e.prev=13,e.t0=e.catch(2),s=m(i=m(r="当前会话callid:".concat(t.callId,",根据numberId:")).call(r,t.numberId,",taskId:")).call(i,t.taskId,":查询坐席接听状态异常"),console.error(s),t.stop=!0,C(this,ke,"f").call(this,new Error(n.message)),e.abrupt("return");case 20:if(a=n.data,o=a.callType,u=a.newIntentTag,l=a.intentTag,f=a.number,h=a.numberMd5,d=a.sid,p=a.config,v=a.tag,10!==a.state){e.next=25;break}return console.log("当前会话callid:".concat(t.callId,"已结束")),t.stop=!0,e.abrupt("return");case 25:if(t.callType||(t.callType=o),t.intentTag=u||l,t.number||(t.number=f),t.numberMD5||(t.numberMD5=h),t.agentId||(t.agentId=d),t.tag||(t.tag=v),t.templateId||p&&"string"==typeof p&&(g=JSON.parse(p))&&g.templateId&&(t.templateId=g.templateId),!t.callId){e.next=54;break}return k={},e.prev=34,e.next=37,this.getCallNumberChats({callId:t.callId,taskId:t.taskId});case 37:if(200===(k=e.sent).code){e.next=43;break}return console.error(k.message),t.stop=!0,C(this,ke,"f").call(this,new Error(k.message)),e.abrupt("return");case 43:e.next=52;break;case 45:return e.prev=45,e.t1=e.catch(34),y=m(x="当前会话根据callId:".concat(t.callId,",taskId:")).call(x,t.taskId,":查询会话对话记录异常"),console.error(y),t.stop=!0,C(this,ke,"f").call(this,new Error(y)),e.abrupt("return");case 52:t.chats=w(b=k.data).call(b,(function(e){return e.matchinfo&&(e.matchinfo=JSON.parse(e.matchinfo)),e})),C(this,ce,"f")[t.callId]=t;case 54:try{C(this,de,"f").call(this,C(this,ce,"f")[t.callId])}catch(e){console.log(e)}e.next=60;break;case 57:t.stop=!0,t.taskId||(S="当前会话callid:".concat(t.callId,"的taskId不存在,无法查询通话记录"),console.error(S),C(this,ke,"f").call(this,new Error(S))),t.numberId||(A="当前会话callid:".concat(t.callId,"的numberId不存在,无法查询通话记录"),console.error(A),C(this,ke,"f").call(this,new Error(A)));case 60:case"end":return e.stop()}}),e,this,[[2,13],[34,45]])})))},e.prev=2;case 3:if(!t.stop){e.next=6;break}return e.abrupt("break",14);case 6:return e.next=8,n();case 8:if(!t.stop){e.next=10;break}return e.abrupt("break",14);case 10:return e.next=12,new v((function(e){var t=d((function(){return O(i,void 0,void 0,c.mark((function n(){return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:clearTimeout(t),t=void 0,e(!0);case 3:case"end":return n.stop()}}),n)})))}),3e3)}));case 12:e.next=3;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(2),C(this,ke,"f").call(this,e.t0);case 19:case"end":return e.stop()}}),e,this,[[2,16]])})))}},{key:"refreshCallChatInfo",value:function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(C(this,it,"f").numberId&&C(this,it,"f").callId&&C(this,it,"f").taskId&&C(this,rt,"f"))){e.next=3;break}return e.next=3,this.getCallInfo();case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getOpenApi",value:function(){return C(this,Ye,"f")?function(e){if(!e)return!1;var t=/^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/;return!!/^(\d{1,3}\.){3}\d{1,3}$/.test(e)||("//"===I(e).call(e,0,2)?t.test(I(e).call(e,2,e.length)):"http://"===I(e).call(e,0,7)?t.test(I(e).call(e,7,e.length)):"https://"===I(e).call(e,0,8)?t.test(I(e).call(e,8,e.length)):t.test(e))}(C(this,Ye,"f"))?C(this,Ye,"f"):"1"===C(this,Je,"f")?"1"===C(this,Ve,"f")?"https://seatsg.94ai.com/sgopenapi":"https://seatsg.94ai.com/openapi":"1"===C(this,Ve,"f")?"https://seat.94ai.com/sgopenapi":"https://seat.94ai.com/openapi":"https://seat.94ai.com/openapi"}},{key:"getAgentInfo",value:function(){return this.requestOpenApi({url:"/v1/agent/getAgent",data:{agentTag:C(this,_e,"f"),agentId:C(this,Be,"f")}})}},{key:"getOpenApiSign",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f(),i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;return O(this,void 0,void 0,c.mark((function s(){return c.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,C(this,ge,"f").call(this,C(this,ae,"f"));case 2:return s.abrupt("return",{sign:null!==(e=C(this,ne,"f"))&&void 0!==e?e:T.enc.Base64.stringify(T.HmacSHA1(i||C(this,Fe,"f")+n,r||C(this,Ge,"f"))),timestamp:null!==(t=C(this,ie,"f"))&&void 0!==t?t:n});case 3:case"end":return s.stop()}}),s,this)})))}},{key:"updateOpenApiAgentStatus",value:function(e){return this.requestOpenApi({url:"/v1/agent/updateAgentStatus",data:{agentTag:C(this,_e,"f"),agentId:C(this,Be,"f"),agentStatus:e}})}},{key:"importOpenApiAgentCustomer",value:function(e){return this.requestOpenApi({url:"/v1/task/importAgentCustomer",data:{agentTag:C(this,_e,"f"),agentId:C(this,Be,"f"),callType:1001,customers:[{number:e}]}})}},{key:"callNumber",value:function(e){return this.importOpenApiAgentCustomer(e)}},{key:"toggleNap",value:function(e){return e?this.updateOpenApiAgentStatus(3):this.updateOpenApiAgentStatus(1)}},{key:"refreshSign",value:function(e){q(this,ne,e,"f")}},{key:"prepareUserAgent",value:function(e,t){var n;return O(this,void 0,void 0,c.mark((function i(){var r,s,a,o,u,l,f,h,d,p,v;return c.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return s=(r=e||{}).refresh,a=r.registererOptions,o=r.registererRegisterOptions,u=r.extraHeaders,l=r.authorizationUsername,f=r.authorizationPassword,h=r.uri,d=r.contactName,p=r.transportOptions,i.next=3,this.dispose();case 3:return C(this,Z,"f").uri=null!=h?h:C(this,Z,"f").uri,C(this,Z,"f").authorizationUsername=null!=l?l:C(this,Z,"f").authorizationUsername,C(this,Z,"f").authorizationPassword=null!=f?f:C(this,Z,"f").authorizationPassword,C(this,Z,"f").contactName=null!==(n=null!=d?d:l)&&void 0!==n?n:C(this,Z,"f").contactName,p&&(C(this,Z,"f").transportOptions=g(g({},C(this,Z,"f").transportOptions),p)),i.prev=8,C(this,F,"m",bt).call(this,e),i.next=12,C(this,yt,"f").call(this);case 12:return i.next=14,C(this,St,"f").call(this);case 14:return C(this,F,"m",Tt).call(this,{refresh:s}),i.next=17,C(this,F,"m",tn).call(this);case 17:return t&&C(this,F,"m",en).call(this,t),i.next=20,C(this,F,"m",nn).call(this,{registererOptions:a,registererRegisterOptions:o,extraHeaders:u},C(this,et,"f"));case 20:return v=i.sent,i.abrupt("return",v);case 24:return i.prev=24,i.t0=i.catch(8),i.next=28,this.dispose();case 28:throw i.t0;case 29:case"end":return i.stop()}}),i,this,[[8,24]])})))}},{key:"dispose",value:function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,C(this,F,"m",At).call(this),e.next=4,C(this,F,"m",Dt).call(this);case 4:e.next=10;break;case 6:e.prev=6,e.t0=e.catch(0),C(this,F,"m",Rt).call(this),console.log("sip dispose with error",e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,6]])})))}},{key:"ignoreInvite",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return C(this,ee,"f").incomingStatus=!1,t.next=3,this.getCurrentInvitation().reject(e);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"acceptInvite",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){var n=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,new v((function(t,i){O(n,void 0,void 0,c.mark((function n(){var r,s;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,r=null==e?void 0:e.onAck,s=null==e?void 0:e.onAckTimeout,null==e||delete e.onAck,null==e||delete e.onAckTimeout,n.next=7,this.getCurrentInvitation().accept(g({sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}},onAck:function(e){t(e),null==r||r()},onAckTimeout:function(){null==s||s(),i(new Error("接听响应超时"))}},e||{}));case 7:n.next=12;break;case 9:n.prev=9,n.t0=n.catch(0),i(n.t0);case 12:case"end":return n.stop()}}),n,this,[[0,9]])})))}));case 3:C(this,ee,"f").incomingStatus&&(C(this,ee,"f").incomingStatus=!1,C(this,ee,"f").answerStatus=!0),t.next=10;break;case 6:throw t.prev=6,t.t0=t.catch(0),C(this,ee,"f").incomingStatus=!1,t.t0;case 10:case"end":return t.stop()}}),t,this,[[0,6]])})))}},{key:"hangUpInvite",value:function(e){return O(this,void 0,void 0,c.mark((function t(){var n,i,s,a,o,u=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(n=e||{}).rejectOptions,s=n.byeOptions,a=n.extraHeaders,o=n.scoutResponse,t.abrupt("return",new v((function(e,t){return O(u,void 0,void 0,c.mark((function n(){var u,l,f,h,d,p,v,m,w;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:n.prev=0,v=null===(u=(p=s||{}).requestDelegate)||void 0===u?void 0:u.onAccept,m=null===(l=p.requestDelegate)||void 0===l?void 0:l.onReject,null===(f=p.requestDelegate)||void 0===f||delete f.onAccept,null===(h=p.requestDelegate)||void 0===h||delete h.onReject,w=C(this,F,"m",Ot).call(this,{onAccept:function(t){console.log("sip bye success"),e(t),null==v||v(t)},onReject:function(e){null==m||m(e),t(new Error("sip bye fail with code "+e.message.statusCode))}},p.requestDelegate),delete p.requestDelegate,n.t0=null===(d=C(this,K,"f"))||void 0===d?void 0:d.state,n.next=n.t0===r.SessionState.Initial||n.t0===r.SessionState.Establishing?11:n.t0===r.SessionState.Established?15:n.t0===r.SessionState.Terminating||n.t0===r.SessionState.Terminated?19:21;break;case 11:return n.next=13,C(this,K,"f").reject(g({extraHeaders:a},i||{}));case 13:return e(!0),n.abrupt("break",21);case 15:return n.next=17,C(this,K,"f").bye(g({requestDelegate:w,requestOptions:{extraHeaders:a}},p));case 17:return o||e(!0),n.abrupt("break",21);case 19:return e(!0),n.abrupt("break",21);case 21:n.next=26;break;case 23:n.prev=23,n.t1=n.catch(0),t(n.t1);case 26:return n.prev=26,C(this,ee,"f").incomingStatus=!1,C(this,ee,"f").answerStatus=!1,n.finish(26);case 30:case"end":return n.stop()}}),n,this,[[0,23,26,30]])})))})));case 2:case"end":return t.stop()}}),t)})))}},{key:"sendStarDtmf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){var n=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new v((function(t,i){return O(n,void 0,void 0,c.mark((function n(){var r,s,a,o;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,s=(r=e||{}).extraHeaders,a=r.requestDelegate,o=C(this,F,"m",Ot).call(this,{onAccept:function(e){console.log("sip send dtmf Signal=* success"),t(e)},onReject:function(e){i(new Error("sip send dtmf Signal=* fail with code "+e.message.statusCode))}},a),delete r.requestDelegate,n.next=7,this.getCurrentInvitation().info(g({requestOptions:{body:{contentDisposition:"render",contentType:"application/dtmf-relay",content:"Signal=*\r\nDuration=100"},extraHeaders:s},requestDelegate:o},r));case 7:C(this,at,"f").call(this),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(0),i(n.t0);case 13:case"end":return n.stop()}}),n,this,[[0,10]])})))})));case 1:case"end":return t.stop()}}),t)})))}},{key:"muteRemoteAudio",value:function(){var e;h(e=C(this,V,"f").getReceivers()).call(e,(function(e){e.track.enabled=!1}))}},{key:"unMuteRemoteAudio",value:function(){var e;h(e=C(this,V,"f").getReceivers()).call(e,(function(e){e.track.enabled=!0}))}},{key:"muteLocalAudio",value:function(){var e;h(e=C(this,V,"f").getSenders()).call(e,(function(e){e.track.enabled=!1}))}},{key:"unMuteLocalAudio",value:function(){var e;h(e=C(this,V,"f").getSenders()).call(e,(function(e){e.track.enabled=!0}))}},{key:"getUserAgentStatue",value:function(){return C(this,ee,"f")}},{key:"getUserAgent",value:function(){return C(this,_,"f")||q(this,_,new r.UserAgent(C(this,Z,"f")),"f"),C(this,_,"f")}},{key:"getSessionDescriptionHandler",value:function(){return C(this,Y,"f")}},{key:"getPeerConnection",value:function(){return C(this,V,"f")}},{key:"getSenders",value:function(){return C(this,W,"f")}},{key:"getReceivers",value:function(){return C(this,J,"f")}},{key:"getStream",value:function(){var e,t=this;return C(this,Q,"f")||q(this,Q,new MediaStream,"f"),h(e=C(this,J,"f")).call(e,(function(e){e.track&&C(t,Q,"f").addTrack(e.track)})),C(this,Q,"f")}},{key:"getCurrentInviter",value:function(){if(!C(this,$,"f"))throw new Error("No currentInviter...");return C(this,$,"f")}},{key:"getCurrentInvitation",value:function(){return C(this,K,"f")}},{key:"invite",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return O(this,void 0,void 0,c.mark((function n(){var i,s,a;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=r.UserAgent.makeURI(e.uri?e.uri:m(i="sip:".concat(e.extension,"@")).call(i,C(this,Z,"f").transportOptions.server.split("://")[1]))){n.next=3;break}throw new Error("Failed to create target URI.");case 3:return q(this,$,new r.Inviter(this.getUserAgent(),s,{sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}}),"f"),a=(t||{}).extraHeaders,n.next=7,this.getCurrentInviter().invite(g({requestOptions:{extraHeaders:a}},t));case 7:return n.abrupt("return",C(this,$,"f"));case 8:case"end":return n.stop()}}),n,this)})))}}]),e}();G=new x,_=new x,B=new x,Y=new x,V=new x,J=new x,W=new x,Z=new x,K=new x,$=new x,Q=new x,ee=new x,te=new x,ne=new x,ie=new x,re=new x,se=new x,ae=new x,oe=new x,ce=new x,ue=new x,le=new x,fe=new x,he=new x,de=new x,pe=new x,ve=new x,ge=new x,me=new x,we=new x,be=new x,ke=new x,xe=new x,ye=new x,Se=new x,Ae=new x,Ie=new x,Te=new x,je=new x,Oe=new x,Ce=new x,qe=new x,De=new x,Ee=new x,Re=new x,Ne=new x,Pe=new x,Me=new x,Ue=new x,He=new x,ze=new x,Le=new x,Xe=new x,Fe=new x,Ge=new x,_e=new x,Be=new x,Ye=new x,Ve=new x,Je=new x,We=new x,Ze=new x,Ke=new x,$e=new x,Qe=new x,et=new x,tt=new x,nt=new x,it=new x,rt=new x,st=new x,at=new x,ot=new x,ct=new x,ut=new x,lt=new x,ft=new x,ht=new x,dt=new x,pt=new x,yt=new x,St=new x,It=new x,zt=new x,Xt=new x,Ft=new x,Gt=new x,_t=new x,Bt=new x,Kt=new x,F=new y,vt=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,pe,null!==(e=n.openXhrIntercept)&&void 0!==e?e:C(this,pe,"f"),"f"),q(this,ve,null!==(t=n.gatewayXhrIntercept)&&void 0!==t?t:C(this,ve,"f"),"f")},gt=function(){var e,t,n,i,r,s,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,rt,null!==(e=a.enableChatInfoPush)&&void 0!==e?e:C(this,rt,"f"),"f"),q(this,st,null!==(t=a.enableVolumnTrack)&&void 0!==t?t:C(this,st,"f"),"f"),q(this,he,null!==(n=a.refreshSpeekVolumn)&&void 0!==n?n:C(this,he,"f"),"f"),q(this,xe,null!==(i=a.refreshRequirementCheck)&&void 0!==i?i:C(this,xe,"f"),"f"),q(this,de,null!==(r=a.refreshChat)&&void 0!==r?r:C(this,de,"f"),"f"),q(this,ke,null!==(s=a.refreshChatErrorCallback)&&void 0!==s?s:C(this,ke,"f"),"f")},mt=function(){var e,t,n,i,r,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,re,null!==(e=s.token)&&void 0!==e?e:C(this,re,"f"),"f"),q(this,se,null!==(t=s.tokenTimestamp)&&void 0!==t?t:C(this,se,"f"),"f"),q(this,oe,null!==(n=s.tokenExpirationTime)&&void 0!==n?n:C(this,oe,"f"),"f"),C(this,re,"f")&&!C(this,se,"f")&&q(this,se,f(),"f"),q(this,me,null!==(i=s.tokenCheck)&&void 0!==i?i:C(this,me,"f"),"f"),q(this,be,null!==(r=s.tokenOverdued)&&void 0!==r?r:C(this,be,"f"),"f")},wt=function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,et,null!==(e=i.clusterMode)&&void 0!==e?e:C(this,et,"f"),"f"),q(this,tt,null!==(t=i.reClusterRegisterTimeout)&&void 0!==t?t:C(this,tt,"f"),"f"),q(this,nt,null!==(n=i.reClusterConnectTimeout)&&void 0!==n?n:C(this,nt,"f"),"f")},bt=function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.agentId,s=i.agentTag,a=i.appKey,o=i.appSecret,c=i.openBaseUrl,u=i.sg,l=i.sgOpen,f=i.sign,h=i.timestamp;q(this,Be,null!=r?r:C(this,Be,"f"),"f"),q(this,_e,null!=s?s:C(this,_e,"f"),"f"),q(this,Fe,null!=a?a:C(this,Fe,"f"),"f"),q(this,Ge,null!=o?o:C(this,Ge,"f"),"f"),q(this,Ye,null!=c?c:C(this,Ye,"f"),"f"),q(this,Je,null!=u?u:C(this,Je,"f"),"f"),q(this,Ve,null!=l?l:C(this,Ve,"f"),"f"),q(this,ne,null!=f?f:C(this,ne,"f"),"f"),q(this,ie,null!=h?h:C(this,ie,"f"),"f"),q(this,ae,null!==(e=i.signExpirationTime)&&void 0!==e?e:C(this,ae,"f"),"f"),q(this,ge,null!==(t=i.signCheck)&&void 0!==t?t:C(this,ge,"f"),"f"),q(this,we,null!==(n=i.signOverdued)&&void 0!==n?n:C(this,we,"f"),"f")},kt=function(e){e.sipHeaders&&(q(this,G,e.sipHeaders,"f"),delete e.sipHeaders)},xt=function(){return!(!C(this,Be,"f")&&!C(this,_e,"f")||!(C(this,Fe,"f")&&C(this,Ge,"f")||C(this,ne,"f")&&C(this,ie,"f")))},At=function(){C(this,F,"m",Et).call(this),C(this,F,"m",Mt).call(this),C(this,F,"m",Ut).call(this),C(this,F,"m",Pt).call(this),C(this,F,"m",Nt).call(this),C(this,F,"m",Yt).call(this),C(this,F,"m",Vt).call(this),C(this,F,"m",Rt).call(this),C(this,ot,"f").call(this),q(this,it,{},"f"),q(this,ce,{},"f")},Tt=function(e){q(this,ee,a(JSON.parse(u(H)),"function"==typeof e.refresh?e.refresh:C(this,Ke,"f")),"f")},jt=function(e){var t,n,i,r,s,a,o,c,u,l,f,h,d,p,v;q(this,Ae,null!==(i=null!==(t=e.reconnectionAttempts)&&void 0!==t?t:null===(n=null==e?void 0:e.transportOptions)||void 0===n?void 0:n.maxReconnectionAttempts)&&void 0!==i?i:C(this,Ae,"f"),"f"),q(this,Ie,null!==(o=null!==(s=null!==(r=e.reconnectionInterval)&&void 0!==r?r:e.reconnectionDelay)&&void 0!==s?s:null===(a=null==e?void 0:e.transportOptions)||void 0===a?void 0:a.reconnectionTimeout)&&void 0!==o?o:C(this,Ie,"f"),"f"),q(this,Ne,null!==(u=null===(c=e.transportOptions)||void 0===c?void 0:c.keepAliveInterval)&&void 0!==u?u:C(this,Ne,"f"),"f"),q(this,Pe,null!==(f=null===(l=e.transportOptions)||void 0===l?void 0:l.keepAliveDebounce)&&void 0!==f?f:C(this,Pe,"f"),"f"),q(this,De,null!==(h=e.registerInterval)&&void 0!==h?h:C(this,De,"f"),"f"),q(this,Te,null!==(d=e.optionsPingInterval)&&void 0!==d?d:C(this,Te,"f"),"f"),q(this,je,null!==(p=e.optionsPingAttempts)&&void 0!==p?p:C(this,je,"f"),"f"),q(this,Ee,null!==(v=e.registerAttempts)&&void 0!==v?v:C(this,Ee,"f"),"f")},Ot=function(e,t){var n,i=this;return t?(h(n=S(t)).call(n,(function(n){if(t[n]&&"function"==typeof t[n])if(e[n]){if("function"==typeof e[n]){var r=e[n];e[n]=function(e){return O(i,void 0,void 0,c.mark((function i(){return c.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t[n](e);case 2:return i.next=4,r(e);case 4:case"end":return i.stop()}}),i)})))}}}else e[n]=t[n]})),e):e},Ct=function(e){var t,n=this,i={delegate:{onConnect:function(){return O(n,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("sip connected"),C(this,Gt,"f").call(this);case 2:case"end":return e.stop()}}),e,this)})))},onInvite:function(e){C(n,It,"f").call(n,e.incomingInviteRequest.message.headers),n.refreshCallChatInfo(),C(n,F,"m",qt).call(n),q(n,K,e,"f"),C(n,ee,"f").incomingStatus=!0,e.stateChange.addListener(C(n,zt,"f"))},onDisconnect:function(e){return O(n,void 0,void 0,c.mark((function t(){var n;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("sip disconnected"),n=!1,C(this,Te,"f")>0&&(n=C(this,Ce,"f"),C(this,Bt,"f").call(this)),t.prev=3,t.next=6,C(this,F,"m",Lt).call(this);case 6:t.next=10;break;case 8:t.prev=8,t.t0=t.catch(3);case 10:(e||n)&&C(this,F,"m",$t).call(this);case 11:case"end":return t.stop()}}),t,this,[[3,8]])})))}}};e.delegate?h(t=S(e.delegate)).call(t,(function(t){var r=t;if(e.delegate[r]&&"function"==typeof e.delegate[r]){var s=e.delegate[r];e.delegate[r]=function(e){return O(n,void 0,void 0,c.mark((function t(){var n,a;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(a=(n=i.delegate)[r])||void 0===a||a.call(n,e),t.next=3,s(e);case 3:case"end":return t.stop()}}),t)})))}}})):e.delegate=i.delegate;return e.reconnectionAttempts=0,e.transportOptions=g(g({},e.transportOptions||{}),{keepAliveInterval:C(this,Ne,"f"),keepAliveDebounce:C(this,Pe,"f")}),void 0===e.sessionDescriptionHandlerFactoryOptions&&(e.sessionDescriptionHandlerFactoryOptions={iceGatheringTimeout:2e3,peerConnectionConfiguration:{iceServers:[]}}),g(g({},U),e)},qt=function(){C(this,K,"f")&&(C(this,K,"f").dispose(),q(this,K,void 0,"f"))},Dt=function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,_,"f")){e.next=4;break}return e.next=3,C(this,_,"f").stop();case 3:q(this,_,void 0,"f");case 4:case"end":return e.stop()}}),e,this)})))},Et=function(){var e;C(this,Q,"f")&&(h(e=C(this,Q,"f").getTracks()).call(e,(function(e){e.stop()})),q(this,Q,void 0,"f"))},Rt=function(){var e,t=this;h(e=S(H)).call(e,(function(e){var n=e;C(t,ee,"f")[n]=H[n]}))},Nt=function(){C(this,Y,"f")&&(C(this,Y,"f").close(),q(this,Y,void 0,"f"))},Pt=function(){C(this,V,"f")&&(C(this,V,"f").close(),q(this,V,void 0,"f"))},Mt=function(){q(this,W,[],"f")},Ut=function(){q(this,J,[],"f")},Ht=function(){var e=this.getCurrentInvitation().sessionDescriptionHandler;C(this,F,"m",Pt).call(this),C(this,F,"m",Nt).call(this),C(this,F,"m",Mt).call(this),C(this,F,"m",Ut).call(this),q(this,Y,e,"f"),q(this,V,e.peerConnection,"f"),q(this,W,C(this,V,"f").getSenders(),"f"),q(this,J,C(this,V,"f").getReceivers(),"f"),(this.getFastOutboundCall()||!this.getSitOutboundCall()&&this.notNeedSendStarDtmf())&&C(this,at,"f").call(this)},Lt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){var n=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!C(this,B,"f")){t.next=3;break}return console.log("sip due to disconnection, unregistered"),t.abrupt("return",new v((function(t,i){return O(n,void 0,void 0,c.mark((function n(){var r,s;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,r=e||{},s=C(this,F,"m",Ot).call(this,{onAccept:function(e){console.log("sip unregister successed"),t(e)},onReject:function(e){i(new Error("sip unregister fail with code "+e.message.statusCode))}},r.requestDelegate),delete e.requestDelegate,n.next=6,C(this,B,"f").unregister(g({requestDelegate:s},e));case 6:n.next=11;break;case 8:n.prev=8,n.t0=n.catch(0),i(n.t0);case 11:case"end":return n.stop()}}),n,this,[[0,8]])})))})));case 3:case"end":return t.stop()}}),t,this)})))},Yt=function(){C(this,F,"m",Jt).call(this),C(this,F,"m",Wt).call(this),C(this,F,"m",Zt).call(this),q(this,He,!1,"f"),q(this,Me,!1,"f"),q(this,Ue,!1,"f")},Vt=function(){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(clearTimeout(C(this,$e,"f")),q(this,$e,void 0,"f")),e&&(clearTimeout(C(this,Qe,"f")),q(this,Qe,void 0,"f"))},Jt=function(){clearTimeout(C(this,Xe,"f")),q(this,Xe,void 0,"f")},Wt=function(){clearTimeout(C(this,ze,"f")),q(this,ze,void 0,"f")},Zt=function(){clearTimeout(C(this,Le,"f")),q(this,Le,void 0,"f")},$t=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return O(this,void 0,void 0,c.mark((function n(){var i=this;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!C(this,Ie,"f")){n.next=12;break}if(C(this,ee,"f").reconnectStatus=!0,!C(this,Me,"f")){n.next=4;break}return n.abrupt("return");case 4:if(!(t>C(this,Ae,"f"))){n.next=9;break}return console.log("sip maximum reconnection attempts reached"),n.next=8,this.dispose();case 8:return n.abrupt("return");case 9:console.log("sip reconnection attempt..."),q(this,Me,!0,"f"),q(this,ze,d((function(){C(i,F,"m",Wt).call(i),i.getUserAgent().reconnect().then((function(){return O(i,void 0,void 0,c.mark((function e(){var n;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log(m(n="sip reconnection attempt ".concat(t," of ")).call(n,C(this,Ae,"f")," - succeeded")),q(this,Me,!1,"f"),C(this,Kt,"f").call(this);case 3:case"end":return e.stop()}}),e,this)})))})).catch((function(n){var r;console.error(n),console.log(m(r="sip reconnection attempt ".concat(t," of ")).call(r,C(i,Ae,"f")," - failed")),q(i,Me,!1,"f"),C(i,F,"m",e).call(i,++t)}))}),1===t?0:1e3*C(this,Ie,"f")),"f");case 12:case"end":return n.stop()}}),n,this)})))},Qt=function(e){var t,n=this;return h(t=S(e)).call(t,(function(t){var i=t;if("function"==typeof(null==e?void 0:e[i])){var r=e[i];e[i]=function(e){return O(n,void 0,void 0,c.mark((function t(){var n,s;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(s=(n=C(this,Z,"f").delegate)[i])||void 0===s||s.call(n,e),t.next=3,r(e);case 3:case"end":return t.stop()}}),t,this)})))}}})),e},en=function(e){var t=this.getUserAgent();return t.delegate=C(this,F,"m",Qt).call(this,e),t},tn=function(){return O(this,void 0,void 0,c.mark((function e(){var t;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getUserAgent(),e.next=3,t.start();case 3:if(t.isConnected()){e.next=6;break}return e.next=6,t.reconnect();case 6:if(t.isConnected()){e.next=8;break}throw new Error("链接失败,请稍后再试");case 8:return C(this,ee,"f").connectStatus=!0,e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this)})))},nn=function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=t||{},a=s.registererOptions,o=s.registererRegisterOptions,u=s.extraHeaders;return new v((function(t,s){return O(n,void 0,void 0,c.mark((function n(){var l,f,h,p,v=this;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return l=this.getUserAgent(),q(this,B,new r.Registerer(l,g({extraHeaders:u||C(this,G,"f")},a||{})),"f"),h=o||{},p=C(this,F,"m",Ot).call(this,{onAccept:function(e){f=e,C(v,F,"m",Vt).call(v),C(v,ee,"f").registerStatus=!0,t(l)},onReject:function(e){C(v,F,"m",Vt).call(v),s(new Error("sip register fail with code "+e.message.statusCode))}},h.requestDelegate),delete h.requestDelegate,i&&q(this,$e,d((function(){return O(v,void 0,void 0,c.mark((function n(){var i=this;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(f){n.next=14;break}q(this,Qe,d((function(){return O(i,void 0,void 0,c.mark((function n(){var i;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(C(this,F,"m",Vt).call(this,!1,!0),f){n.next=22;break}n.prev=2;try{C(this,B,"f").dispose()}catch(e){}return C(this,F,"m",At).call(this),C(this,Bt,"f").call(this),q(this,Oe,0,"f"),q(this,Re,0,"f"),n.next=10,C(this,_,"f").transport.dispose();case 10:return q(this,_,new r.UserAgent(C(this,Z,"f")),"f"),n.next=13,C(this,F,"m",tn).call(this);case 13:return n.next=15,C(this,F,"m",e).call(this,{registererOptions:a,registererRegisterOptions:o,extraHeaders:u});case 15:i=n.sent,t(i),n.next=22;break;case 19:n.prev=19,n.t0=n.catch(2),s(n.t0);case 22:case"end":return n.stop()}}),n,this,[[2,19]])})))}),C(this,nt,"f")),"f");try{C(this,B,"f").dispose()}catch(e){}return q(this,B,new r.Registerer(l,g({extraHeaders:u||C(this,G,"f")},a||{})),"f"),C(this,F,"m",Vt).call(this,!0,!1),n.prev=5,n.next=8,C(this,B,"f").register(g({requestDelegate:p,requestOptions:{extraHeaders:u||C(this,G,"f")}},h));case 8:n.next=14;break;case 10:n.prev=10,n.t0=n.catch(5),C(this,F,"m",Vt).call(this),s(n.t0);case 14:case"end":return n.stop()}}),n,this,[[5,10]])})))}),C(this,tt,"f")),"f"),n.prev=6,n.next=9,C(this,B,"f").register(g({requestDelegate:p,requestOptions:{extraHeaders:u||C(this,G,"f")}},h));case 9:n.next=15;break;case 11:n.prev=11,n.t0=n.catch(6),C(this,F,"m",Vt).call(this),s(n.t0);case 15:case"end":return n.stop()}}),n,this,[[6,11]])})))}))};var fn=function(){function e(){n(this,e)}return i(e,null,[{key:"getUserAgentManager",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return C(this,cn,"f",un)||q(this,cn,new ln(e),"f",un),C(this,cn,"f",un)}},{key:"hasUserAgentManager",value:function(){return!!C(this,cn,"f",un)}},{key:"newUserAgentManager",value:function(){return new ln(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},{key:"dispose",value:function(){if(C(this,cn,"f",un))try{C(this,cn,"f",un).dispose()}catch(e){}finally{q(this,cn,void 0,"f",un)}}}]),e}();cn=fn,un={value:void 0},Object.defineProperty(exports,"Inviter",{enumerable:!0,get:function(){return r.Inviter}}),Object.defineProperty(exports,"Registerer",{enumerable:!0,get:function(){return r.Registerer}}),Object.defineProperty(exports,"SessionState",{enumerable:!0,get:function(){return r.SessionState}}),Object.defineProperty(exports,"URI",{enumerable:!0,get:function(){return r.URI}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function(){return r.UserAgent}}),Object.defineProperty(exports,"SimpleUser",{enumerable:!0,get:function(){return s.SimpleUser}}),exports.onChange=a,exports.UserAgentFactory=fn,exports.UserAgentManager=ln,exports.accumulateSec=an,exports.accumulationTimer=function(e){var t=sn();e(rn(t));var n=p((function(){var n=an(t),i=rn(n);e(i)}),1e3);return function(){clearInterval(n),n=null}},exports.cleanupMedia=function(e){var t=z(e);t&&(t.srcObject=null,t.pause())},exports.getDevicePermission=X,exports.getMedia=z,exports.getTimes=rn,exports.getZeorTime=sn,exports.pauseMedia=function(e){var t=z(e);t&&(t.currentTime=0,t.pause())},exports.playMedia=function(e){var t=z(e);t&&(t.currentTime=0,t.play())},exports.requestMicroPhonePermission=function(){try{var e;if(-1===b(e=navigator.userAgent).call(e,"Firefox"))return X({video:!1,audio:!0}).catch((function(){return!0}))}catch(e){console.log(e)}},exports.stopStreamTracks=L,exports.userAgentDefault=U,exports.userAgentStatus=H;
|
|
1
|
+
"use strict";var e,t,n=require("@babel/runtime-corejs3/helpers/esm/classCallCheck"),i=require("@babel/runtime-corejs3/helpers/esm/createClass"),r=require("sip.js"),s=require("sip.js/lib/platform/web/index.js"),a=require("on-change"),o=require("@babel/runtime-corejs3/helpers/esm/typeof"),c=require("@babel/runtime-corejs3/regenerator"),u=require("@babel/runtime-corejs3/core-js/json/stringify"),l=require("@babel/runtime-corejs3/core-js/object/define-property"),f=require("@babel/runtime-corejs3/core-js/date/now"),h=require("@babel/runtime-corejs3/core-js/instance/for-each"),d=require("@babel/runtime-corejs3/core-js/set-timeout"),p=require("@babel/runtime-corejs3/core-js/set-interval"),v=require("@babel/runtime-corejs3/core-js/promise"),g=require("@babel/runtime-corejs3/core-js/object/assign"),m=require("@babel/runtime-corejs3/core-js/instance/concat"),w=require("@babel/runtime-corejs3/core-js/instance/map"),b=require("@babel/runtime-corejs3/core-js/instance/index-of"),k=require("@babel/runtime-corejs3/core-js/instance/filter"),x=require("@babel/runtime-corejs3/core-js/weak-map"),y=require("@babel/runtime-corejs3/core-js/weak-set"),S=require("@babel/runtime-corejs3/core-js/object/keys"),A=require("@babel/runtime-corejs3/core-js/instance/pad-start"),I=require("@babel/runtime-corejs3/core-js/instance/slice"),T=require("crypto-js"),j=require("@fingerprintjs/fingerprintjs");function O(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))}function C(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function q(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var D,E,R,N,P=m(e="sip:".concat("","@")).call(e,""),M=m(t="".concat("","://")).call(t,""),U={authorizationPassword:"",authorizationUsername:"",viaHost:"",uri:r.UserAgent.makeURI(P),logLevel:"error",transportOptions:{server:M},contactName:""},H={connectStatus:!1,registerStatus:!1,invitatingStatus:!1,incomingStatus:!1,answerStatus:!1,reconnectStatus:!1};function z(e){return document.getElementById(e)}function L(e){if(e&&e.getTracks)try{var t=e.getTracks();h(t).call(t,(function(e){try{e.stop()}catch(e){}}))}catch(e){}}function X(e){return navigator.mediaDevices.getUserMedia(e).then((function(e){return e?(L(e),!0):v.reject(new Error("EmptyStreamError"))})).catch((function(e){return(!e||"NotAllowedError"!==e.name)&&v.reject(e)}))}!function(e){e.NO="0",e.YES="1"}(D||(D={})),function(e){e.NO="0",e.YES="1"}(E||(E={})),function(e){e.MULTI_AI="1",e.MULTI_VOICE_NOTIFY="2",e.MULTI_PRETEST="3",e.LABOUR="4",e.AI="5",e.NEW_VOICE_NOTIFY="6"}(R||(R={})),function(e){e.DIRECT_ANSWER="1",e.LISTEN_FIRST_AND_THEN_ANSWER_MANUALLY="2"}(N||(N={}));var F,G,_,B,Y,V,J,W,Z,K,$,Q,ee,te,ne,ie,re,se,ae,oe,ce,ue,le,fe,he,de,pe,ve,ge,me,we,be,ke,xe,ye,Se,Ae,Ie,Te,je,Oe,Ce,qe,De,Ee,Re,Ne,Pe,Me,Ue,He,ze,Le,Xe,Fe,Ge,_e,Be,Ye,Ve,Je,We,Ze,Ke,$e,Qe,et,tt,nt,it,rt,st,at,ot,ct,ut,lt,ft,ht,dt,pt,vt,gt,mt,wt,bt,kt,xt,yt,St,At,It,Tt,jt,Ot,Ct,qt,Dt,Et,Rt,Nt,Pt,Mt,Ut,Ht,zt,Lt,Xt,Ft,Gt,_t,Bt,Yt,Vt,Jt,Wt,Zt,Kt,$t,Qt,en,tn,nn,rn=function(e){var t,n,i;return A(t=e.getHours().toString()).call(t,2,"0")+":"+A(n=e.getMinutes().toString()).call(n,2,"0")+":"+A(i=e.getSeconds().toString()).call(i,2,"0")},sn=function(){return new Date(new Date((new Date).toLocaleDateString()).getTime())},an=function(e){return new Date(e.setSeconds(e.getSeconds()+1))};function on(e,t,n){var i=window.XMLHttpRequest?new window.XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):void 0;i||t(new Error("Your Browser does not support ajax")),i.onreadystatechange=function(){if(4==i.readyState){var n=i.response||i.responseText;if(200==i.status){var r=i.getResponseHeader("Content-Type");-1!=b(r).call(r,"json")?e(JSON.parse(i.responseText)):-1!=b(r).call(r,"xml")?e(i.responseXML):e(i.responseText)}else t(n)}};var r=n.url,s=n.data,a=n.type,o=n.contentType,c=a||"POST",l=r,f=null;return s&&("GET"===c?l=l+"?"+function(e){var t=[];for(var n in e)t.push(n+"="+e[n]);return t.join("&")}(s):"POST"===c&&(f=u(s))),i.open(c,l,!0),{xhr:i,ajaxData:f,contentType:o}}var cn,un,ln=function(){function e(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n(this,e),F.add(this),G.set(this,void 0),_.set(this,void 0),B.set(this,void 0),Y.set(this,void 0),V.set(this,void 0),J.set(this,[]),W.set(this,[]),Z.set(this,{}),K.set(this,void 0),$.set(this,void 0),Q.set(this,new MediaStream),ee.set(this,JSON.parse(u(H))),te.set(this,0),ne.set(this,void 0),ie.set(this,void 0),re.set(this,void 0),l(this,"token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),se.set(this,void 0),ae.set(this,48e4),oe.set(this,12e6),ce.set(this,{}),ue.set(this,void 0),le.set(this,void 0),fe.set(this,void 0),he.set(this,(function(e){})),de.set(this,(function(e){})),pe.set(this,(function(e){})),ve.set(this,(function(e){})),ge.set(this,(function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i,r;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!C(this,ne,"f")||!C(this,ie,"f")){t.next=9;break}if(!(f()-C(this,ie,"f")>e)){t.next=9;break}return t.next=4,C(this,we,"f").call(this);case 4:n=t.sent,i=n.sign,r=n.timestamp,q(this,ne,null!=i?i:C(this,ne,"f"),"f"),q(this,ie,null!=r?r:C(this,ie,"f"),"f");case 9:case"end":return t.stop()}}),t,this)})))})),me.set(this,(function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i,r,s,a;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!C(this,se,"f")){t.next=19;break}if(!(f()-C(this,se,"f")>e)){t.next=19;break}if(!C(this,re,"f")){t.next=12;break}return t.next=5,C(this,be,"f").call(this);case 5:n=t.sent,i=n.token,r=n.tokenTimestamp,q(this,re,null!=i?i:C(this,re,"f"),"f"),q(this,se,null!=r?r:f(),"f"),t.next=19;break;case 12:if(!this.token){t.next=19;break}return t.next=15,this.getGatewayAccessToken({corpId:C(this,Fe,"f"),sid:C(this,Be,"f"),secret:C(this,Ge,"f"),seatOnline:!1});case 15:s=t.sent,a=s.token,this.token=a,q(this,se,f(),"f");case 19:case"end":return t.stop()}}),t,this)})))})),we.set(this,(function(){})),be.set(this,(function(){})),ke.set(this,(function(e){})),xe.set(this,(function(e){})),ye.set(this,void 0),Se.set(this,void 0),l(this,"networkSpeed",{enumerable:!0,configurable:!0,writable:!0,value:"0.00Mb/s"}),l(this,"networkDelay",{enumerable:!0,configurable:!0,writable:!0,value:"0ms"}),l(this,"onLine",{enumerable:!0,configurable:!0,writable:!0,value:navigator.onLine}),l(this,"testspeeding",{enumerable:!0,configurable:!0,writable:!0,value:!1}),l(this,"goodNetworkSpeed",{enumerable:!0,configurable:!0,writable:!0,value:function(){return 1e3*Number(t.networkSpeed.replace("Mb/s",""))>=30}}),l(this,"goodNetworkDelay",{enumerable:!0,configurable:!0,writable:!0,value:function(){return Number(t.networkDelay.replace("ms",""))<=500&&"0ms"!==t.networkDelay}}),l(this,"authorizedMicrophonePermissions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),l(this,"authorizedNotificationPermissions",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Ae.set(this,100),Ie.set(this,3),Te.set(this,8),je.set(this,3),Oe.set(this,0),Ce.set(this,!1),qe.set(this,void 0),De.set(this,3),Ee.set(this,3),Re.set(this,0),Ne.set(this,0),Pe.set(this,0),Me.set(this,!1),Ue.set(this,!1),He.set(this,!1),ze.set(this,void 0),Le.set(this,void 0),Xe.set(this,void 0),Fe.set(this,void 0),Ge.set(this,void 0),_e.set(this,void 0),Be.set(this,void 0),Ye.set(this,void 0),Ve.set(this,void 0),Je.set(this,void 0),We.set(this,void 0),Ze.set(this,(function(e){C(t,F,"m",$t).call(t)})),Ke.set(this,(function(){})),$e.set(this,void 0),Qe.set(this,void 0),et.set(this,!1),tt.set(this,4e3),nt.set(this,4e3),it.set(this,{}),rt.set(this,!1),st.set(this,!0),l(this,"ifAutoAnswer",{enumerable:!0,configurable:!0,writable:!0,value:function(){return String(C(t,it,"f").autoAnswer)===D.YES}}),l(this,"notNeedSendStarDtmf",{enumerable:!0,configurable:!0,writable:!0,value:function(){return String(C(t,it,"f").afterTransferLabour)===N.DIRECT_ANSWER}}),at.set(this,(function(){if(C(t,st,"f")){var e;C(t,ot,"f").call(t);var n=new(window.AudioContext||window.webkitAudioContext);q(t,le,n.createScriptProcessor(2048,1,1),"f"),C(t,le,"f").onaudioprocess=function(e){for(var n=e.inputBuffer.getChannelData(0),i=0,r=0;r<n.length;++r)i+=n[r]*n[r];q(t,te,Number(Math.sqrt(i/n.length).toFixed(2)),"f"),C(t,he,"f").call(t,C(t,te,"f"))},q(t,fe,new MediaStream,"f"),h(e=t.getSenders()).call(e,(function(e){e.track&&C(t,fe,"f").addTrack(e.track)})),q(t,ue,n.createMediaStreamSource(C(t,fe,"f")),"f"),C(t,ue,"f").connect(C(t,le,"f")),C(t,le,"f").connect(n.destination)}})),ot.set(this,(function(){if(C(t,st,"f")){if(C(t,ue,"f"))try{C(t,ue,"f").disconnect()}catch(e){console.log(e)}if(C(t,le,"f"))try{C(t,le,"f").disconnect()}catch(e){console.log(e)}if(C(t,fe,"f"))try{var e;h(e=C(t,fe,"f").getTracks()).call(e,(function(e){e.stop()}))}catch(e){console.log(e)}}q(t,ue,void 0,"f"),q(t,le,void 0,"f"),q(t,fe,void 0,"f"),q(t,te,0,"f"),C(t,he,"f").call(t,C(t,te,"f"))})),l(this,"disposeSoftphoneEnvRequirementCheck",{enumerable:!0,configurable:!0,writable:!0,value:function(){C(t,ct,"f").call(t),window.removeEventListener("offline",C(t,ft,"f")),window.removeEventListener("online",C(t,lt,"f")),window.removeEventListener("unload",t.disposeSoftphoneEnvRequirementCheck)}}),ct.set(this,(function(){clearInterval(C(t,ye,"f")),q(t,ye,void 0,"f"),clearTimeout(C(t,Se,"f")),q(t,Se,void 0,"f"),t.testspeeding=!1})),l(this,"softphoneEnvCheck",{enumerable:!0,configurable:!0,writable:!0,value:function(){return O(t,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.testspeeding||(C(this,ut,"f").call(this),this.oneRoundOfTesting());case 1:case"end":return e.stop()}}),e,this)})))}}),ut.set(this,(function(){window.addEventListener("offline",C(t,ft,"f")),window.addEventListener("online",C(t,lt,"f")),window.addEventListener("unload",t.disposeSoftphoneEnvRequirementCheck)})),l(this,"oneRoundOfTesting",{enumerable:!0,configurable:!0,writable:!0,value:function(){return O(t,void 0,void 0,c.mark((function e(){var t=this;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.testspeeding=!0,this.detectNavigatorPermissions(),this.onLine?(C(this,ht,"f").call(this,this),q(this,Se,d((function(){t.testspeeding=!1,t.disposeSoftphoneEnvRequirementCheck()}),4e3),"f")):this.testspeeding=!1;case 3:case"end":return e.stop()}}),e,this)})))}}),lt.set(this,(function(){t.onLine=!0,t.oneRoundOfTesting()})),ft.set(this,(function(){t.onLine=!1,t.networkSpeed="0.00Mb/s",t.networkDelay="0ms",C(t,xe,"f").call(t,{networkSpeed:t.networkSpeed,networkDelay:t.networkDelay,authorizedMicrophonePermissions:t.authorizedMicrophonePermissions,authorizedNotificationPermissions:t.authorizedNotificationPermissions}),C(t,ct,"f").call(t)})),ht.set(this,(function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i,r=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e||this,clearInterval(C(n,ye,"f")),q(n,ye,void 0,"f"),i=function(){return O(r,void 0,void 0,c.mark((function e(){var t;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.onLine){e.next=15;break}return e.prev=1,e.next=4,C(n,dt,"f").call(n);case 4:t=e.sent,n.networkSpeed=t.networkSpeed,n.networkDelay=t.networkDelay,e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),n.networkSpeed="0.00Mb/s",n.networkDelay="0ms";case 13:e.next=17;break;case 15:n.networkSpeed="0.00Mb/s",n.networkDelay="0ms";case 17:C(this,xe,"f").call(this,{networkSpeed:this.networkSpeed,networkDelay:this.networkDelay,authorizedMicrophonePermissions:this.authorizedMicrophonePermissions,authorizedNotificationPermissions:this.authorizedNotificationPermissions}),C(this,Se,"f")||(this.testspeeding=!1,this.disposeSoftphoneEnvRequirementCheck());case 19:case"end":return e.stop()}}),e,this,[[1,9]])})))},t.next=6,i();case 6:C(this,Se,"f")&&q(n,ye,p((function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i();case 2:case"end":return e.stop()}}),e)})))}),1e3),"f");case 7:case"end":return t.stop()}}),t,this)})))})),dt.set(this,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://seat.94ai.com/favicon.png",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:63491,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return O(t,void 0,void 0,c.mark((function t(){var r,s;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=[],s=0;s<i;s++)r.push(C(this,pt,"f").call(this,e+"?d="+f()+s,n));return t.abrupt("return",v.all(r).then((function(e){var t=0,n=0;return h(e).call(e,(function(e){t+=Number(e[0]),n+=Number(e[1])})),{networkDelay:(n/i).toFixed(2)+"ms",networkSpeed:(t/i).toFixed(2)+"Mb/s"}})));case 3:case"end":return t.stop()}}),t,this)})))})),pt.set(this,(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://seat.94ai.com/favicon.png?d="+f(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:63491;return new v((function(n,i){var r=document.createElement("img");r.start=window.performance.now(),r.onload=function(){var e=window.performance.now()-r.start;n([(1e3*t/(1048576*e)).toFixed(2),e])},r.onerror=function(e){i(e)},r.src=e})).catch((function(e){throw e}))})),l(this,"openApiAjax",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return new v((function(n,i){return O(t,void 0,void 0,c.mark((function t(){var r,s,a,o,u,l,f;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=on(n,i,e),s=r.xhr,a=r.ajaxData,o=r.contentType,t.next=3,this.getOpenApiSign();case 3:return u=t.sent,l=u.timestamp,f=u.sign,s.setRequestHeader("appKey",C(this,Fe,"f")),s.setRequestHeader("timestamp",String(l)),s.setRequestHeader("sign",f),s.setRequestHeader("Content-type",o||"application/json"),t.next=12,C(this,pe,"f").call(this,s);case 12:s.send(a);case 13:case"end":return t.stop()}}),t,this)})))}))}}),l(this,"requestGateway",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.gatewayApiAjax(g(g({},e),{url:t.getGateway()+e.url}),n)}}),l(this,"gatewayApiAjax",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new v((function(i,r){return O(t,void 0,void 0,c.mark((function t(){var s,a,o,u,l;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s=on(i,r,e),a=s.xhr,o=s.ajaxData,u=s.contentType,!n){t.next=8;break}return t.next=4,this.getGatewayToken();case 4:l=t.sent,a.setRequestHeader("x-token",l),a.setRequestHeader("seatsToken",l),a.setRequestHeader("x-authority-token",l);case 8:return a.setRequestHeader("x-app-code",3),a.setRequestHeader("content-type",u||"application/json"),t.next=12,C(this,ve,"f").call(this,a);case 12:a.send(o);case 13:case"end":return t.stop()}}),t,this)})))}))}}),l(this,"requestOpenApi",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return t.openApiAjax(g(g({},e),{url:t.getOpenApi()+e.url}))}}),l(this,"getDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:function(){return O(t,void 0,void 0,c.mark((function e(){var t,n;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,We,"f")){e.next=2;break}return e.abrupt("return",C(this,We,"f"));case 2:return e.next=4,j.load();case 4:return t=e.sent,e.next=7,t.get();case 7:return n=e.sent,q(this,We,n.visitorId,"f"),e.abrupt("return",C(this,We,"f"));case 10:case"end":return e.stop()}}),e,this)})))}}),yt.set(this,(function(){return O(t,void 0,void 0,c.mark((function e(){var t,n,i,s;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,F,"m",xt).call(this)||C(this,Z,"f").authorizationUsername&&C(this,Z,"f").uri&&C(this,Z,"f").authorizationPassword&&C(this,Z,"f").transportOptions.server){e.next=16;break}return e.next=3,this.getAgentInfo();case 3:if(200!=(t=e.sent).code){e.next=15;break}s=t.data,C(this,Z,"f").authorizationUsername=s.agentExtension,C(this,Z,"f").authorizationPassword=s.extensionPwd,C(this,Z,"f").contactName||(C(this,Z,"f").contactName=s.agentExtension),C(this,Z,"f").uri=r.UserAgent.makeURI(m(n="sip:".concat(s.agentExtension,"@")).call(n,s.wsRegisterAddress)),C(this,Z,"f").transportOptions.server=m(i="".concat(s.wsProtocol,"://")).call(i,s.wsRegisterAddress),q(this,Be,s.agentId,"f"),q(this,_e,s.agentTag,"f"),e.next=16;break;case 15:throw new Error(t);case 16:case"end":return e.stop()}}),e,this)})))})),St.set(this,(function(){return O(t,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(C(this,Z,"f").viaHost){e.next=6;break}return e.t0="",e.next=4,this.getDeviceId();case 4:e.t1=e.sent,C(this,Z,"f").viaHost=m(e.t0).call(e.t0,e.t1,".sip");case 6:case"end":return e.stop()}}),e,this)})))})),It.set(this,(function(e){var n,i,r,s,a,o,c,u,l,f,h,d,p,v,g,m,b,k,x,y,S;C(t,it,"f").popWindow=null===(a=e["X-Popwindow"])||void 0===a?void 0:a[0].raw,C(t,it,"f").afterTransferLabour=null===(o=e["X-Aftertransferlabour"])||void 0===o?void 0:o[0].raw,C(t,it,"f").callId=null===(c=e["X-94callid"])||void 0===c?void 0:c[0].raw,C(t,it,"f").cid=null===(u=e["X-Cid"])||void 0===u?void 0:u[0].raw,C(t,it,"f").numberId=null===(l=e["X-Numberid"])||void 0===l?void 0:l[0].raw,C(t,it,"f").tag=(null===(f=e["X-Tag"])||void 0===f?void 0:f[0].raw)&&"null"!==(null===(h=e["X-Tag"])||void 0===h?void 0:h[0].raw)?w(n=e["X-Tag"][0].raw.split("-")).call(n,(function(e){return String.fromCharCode(e)})).join(""):"",C(t,it,"f").taskId=null===(d=e["X-Taskid"])||void 0===d?void 0:d[0].raw,C(t,it,"f").voiceType=null===(p=e["X-Voicetype"])||void 0===p?void 0:p[0].raw,C(t,it,"f").processTime=null===(v=e["X-Processtime"])||void 0===v?void 0:v[0].raw,C(t,it,"f").userPhone=null===(g=e["X-Userphone"])||void 0===g?void 0:g[0].raw,C(t,it,"f").autoAnswer=null===(m=e["X-94autoanswer"])||void 0===m?void 0:m[0].raw,C(t,it,"f").nodeTitle=null===(b=e["X-Nodetitle"])||void 0===b?void 0:w(i=b[0].raw.split("-")).call(i,(function(e){return String.fromCharCode(e)})).join(""),C(t,it,"f").taskName=null===(k=e["X-Taskname"])||void 0===k?void 0:w(r=k[0].raw.split("-")).call(r,(function(e){return String.fromCharCode(e)})).join(""),C(t,it,"f").templateTitle=null===(x=e["X-Templatetitle"])||void 0===x?void 0:w(s=x[0].raw.split("-")).call(s,(function(e){return String.fromCharCode(e)})).join(""),C(t,it,"f").phoneNumber=(null===(y=e["X-Phonenumber"])||void 0===y?void 0:y[0].raw)||(null===(S=e.From)||void 0===S?void 0:S[0].parsed.uri.normal.user)})),zt.set(this,(function(e){switch(e){case r.SessionState.Initial:case r.SessionState.Establishing:break;case r.SessionState.Established:C(t,F,"m",Ht).call(t);break;case r.SessionState.Terminating:case r.SessionState.Terminated:var n=d((function(){clearTimeout(n),n=void 0,C(t,ee,"f").incomingStatus=!1,C(t,ee,"f").answerStatus=!1}),10);C(t,ot,"f").call(t);break;default:throw new Error("Unknown session state.")}})),Xt.set(this,(function(e,n,i){C(t,Te,"f")&&(q(t,Ce,!1,"f"),C(t,ee,"f").reconnectStatus=!1,C(t,Ue,"f")&&(q(t,Ue,!1,"f"),C(t,_t,"f").call(t,e,n,i)))})),Ft.set(this,(function(){return O(t,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,Te,"f")){e.next=15;break}return q(this,Ce,!0,"f"),q(this,Ue,!1,"f"),e.next=5,this.getUserAgent().transport.disconnect().catch((function(e){return console.error(e)}));case 5:return console.log("sip transport disconnect"),e.prev=6,e.next=9,C(this,F,"m",Lt).call(this);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:C(this,Bt,"f").call(this),C(this,F,"m",$t).call(this);case 15:case"end":return e.stop()}}),e,this,[[6,11]])})))})),Gt.set(this,(function(){if(C(t,Te,"f")){var e=C(t,Z,"f").uri.clone(),n=C(t,Z,"f").uri.clone(),i=C(t,Z,"f").uri.clone();i.user=void 0,C(t,_t,"f").call(t,i,e,n)}})),_t.set(this,(function(e,n,i){if(C(t,Te,"f")){if(C(t,Ue,"f"))return;q(t,Ue,!0,"f"),q(t,Le,d((function(){C(t,F,"m",Zt).call(t);var r=t.getUserAgent().userAgentCore,s=r.makeOutgoingRequestMessage("OPTIONS",e,n,i,{});q(t,qe,r.request(s,{onAccept:function(){console.log("sip ping ok"),q(t,Oe,0,"f"),q(t,qe,void 0,"f"),C(t,Xt,"f").call(t,e,n,i)},onReject:function(r){var s;if(q(t,qe,void 0,"f"),408===r.message.statusCode||503===r.message.statusCode)if(console.log("sip ping error with code "+r.message.statusCode),C(t,je,"f")>0&&C(t,Oe,"f")>=C(t,je,"f"))console.log("sip maximum ping attempts reached"),C(t,Ft,"f").call(t);else{var a,o;if(C(t,Oe,"f")>0)console.log(m(o="sip ping retry ".concat(C(t,Oe,"f")," of ")).call(o,C(t,je,"f")," fail"));q(t,Oe,(s=C(t,Oe,"f"),++s),"f"),console.log(m(a="sip ping retry ".concat(C(t,Oe,"f")," of ")).call(a,C(t,je,"f"))),C(t,Xt,"f").call(t,e,n,i)}else q(t,Oe,0,"f"),C(t,Xt,"f").call(t,e,n,i)}}),"f")}),1e3*C(t,Te,"f")),"f")}})),Bt.set(this,(function(){if(C(t,Te,"f")){if(q(t,Ue,!1,"f"),q(t,Ce,!1,"f"),C(t,qe,"f")){try{C(t,qe,"f").dispose()}catch(e){}q(t,qe,void 0,"f")}C(t,Le,"f")&&C(t,F,"m",Zt).call(t)}})),Kt.set(this,(function(){if(C(t,De,"f")){if(C(t,He,"f"))return;q(t,He,!0,"f"),C(t,ee,"f").reconnectStatus=!0,q(t,Xe,d((function(){return O(t,void 0,void 0,c.mark((function e(){var t=this;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,C(this,F,"m",Jt).call(this),0===C(this,Re,"f")&&console.log("sip reconnect success then register start"),e.next=5,C(this,B,"f").register({requestDelegate:{onAccept:function(e){console.log("sip reconnect success and register ok"),q(t,Re,0,"f"),q(t,He,!1,"f"),C(t,ee,"f").registerStatus=!0,C(t,ee,"f").reconnectStatus=!1,C(t,Gt,"f").call(t)},onReject:function(e){return O(t,void 0,void 0,c.mark((function t(){var n,i;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log("sip reconnect success but register fail with code "+e.message.statusCode),q(this,He,!1,"f"),!(C(this,Ee,"f")<=C(this,Re,"f"))){t.next=10;break}return console.log("sip maximum register attempts reached"),q(this,Re,0,"f"),t.next=7,this.getUserAgent().transport.disconnect().catch((function(e){return console.error(e)}));case 7:C(this,F,"m",$t).call(this),t.next=13;break;case 10:q(this,Re,(n=C(this,Re,"f"),++n),"f"),console.log(m(i="sip reconnect success and register retry ".concat(C(this,Re,"f")," of ")).call(i,C(this,Ee,"f"))),C(this,Kt,"f").call(this);case 13:case"end":return t.stop()}}),t,this)})))}},requestOptions:{extraHeaders:C(this,G,"f")}});case 5:e.next=12;break;case 7:e.prev=7,e.t0=e.catch(0),console.log("sip reconnect then registerer register error",e.t0),q(this,Re,0,"f"),q(this,He,!1,"f");case 12:case"end":return e.stop()}}),e,this,[[0,7]])})))}),1e3*C(t,De,"f")),"f")}})),"object"!==o(i))throw new Error("userAgentOption must be plain object");C(this,F,"m",wt).call(this,i),C(this,F,"m",bt).call(this,i),C(this,F,"m",mt).call(this,i),C(this,F,"m",kt).call(this,i),C(this,F,"m",jt).call(this,i),C(this,F,"m",gt).call(this,i),C(this,F,"m",vt).call(this,i),q(this,Z,C(this,F,"m",Ct).call(this,i),"f")}return i(e,[{key:"volumeValue",get:function(){return C(this,te,"f")}},{key:"businessAttribute",get:function(){return C(this,it,"f")}},{key:"getFastOutboundCall",value:function(){return C(this,it,"f").voiceType===R.LABOUR}},{key:"getSitOutboundCall",value:function(){return C(this,it,"f").voiceType===R.AI}},{key:"detectNavigatorPermissions",value:function(){var e,t=this;-1===b(e=navigator.userAgent).call(e,"Firefox")?navigator.permissions.query({name:"microphone"}).then((function(e){"granted"===e.state?t.authorizedMicrophonePermissions=!0:t.authorizedMicrophonePermissions=!1})).catch((function(e){console.log("Got error :",e),t.authorizedMicrophonePermissions=!1})):navigator.mediaDevices.enumerateDevices().then((function(e){""!==k(e).call(e,(function(e){return"audioinput"===e.kind}))[0].label?t.authorizedMicrophonePermissions=!0:t.authorizedMicrophonePermissions=!1})),navigator.permissions.query({name:"notifications"}).then((function(e){"granted"===e.state?t.authorizedNotificationPermissions=!0:t.authorizedNotificationPermissions=!1})).catch((function(e){console.log("Got error :",e),t.authorizedNotificationPermissions=!1}))}},{key:"getGateway",value:function(){return"1"===C(this,Je,"f")?"https://gateway.sg.94ai.com":"https://gateway.94ai.com"}},{key:"getGatewayToken",value:function(){return O(this,void 0,void 0,c.mark((function e(){var t,n;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C(this,me,"f").call(this,C(this,oe,"f"));case 2:if(!C(this,re,"f")){e.next=4;break}return e.abrupt("return",C(this,re,"f"));case 4:if(this.token){e.next=13;break}return e.next=7,C(this,yt,"f").call(this);case 7:return e.next=9,this.getGatewayAccessToken({corpId:C(this,Fe,"f"),sid:C(this,Be,"f"),secret:C(this,Ge,"f"),seatOnline:!1});case 9:t=e.sent,n=t.token,this.token=n,q(this,se,f(),"f");case 13:return e.abrupt("return",this.token);case 14:case"end":return e.stop()}}),e,this)})))}},{key:"getGatewayAccessToken",value:function(e){return this.requestGateway({url:"/authority/accessToken/openApi",data:e},!1)}},{key:"getCallNumberDetail",value:function(e){return this.requestGateway({url:"/task-aggre/callCenterNumber/get",data:e})}},{key:"getCallNumberChats",value:function(e){return this.requestGateway({url:"/dialogue-aggre/call-center-number/chat/list",data:e})}},{key:"getCallInfo",value:function(){return O(this,void 0,void 0,c.mark((function e(){var t,n,i=this;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=g({},C(this,it,"f")),n=function(){return O(i,void 0,void 0,c.mark((function e(){var n,i,r,s,a,o,u,l,f,h,d,p,v,g,b,k,x,y,S,A;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.numberId||!t.taskId){e.next=57;break}return n={},e.prev=2,e.next=5,this.getCallNumberDetail({id:t.numberId,taskId:t.taskId});case 5:if(200===(n=e.sent).code){e.next=11;break}return console.error(n.message),t.stop=!0,C(this,ke,"f").call(this,new Error(n.message)),e.abrupt("return");case 11:e.next=20;break;case 13:return e.prev=13,e.t0=e.catch(2),s=m(i=m(r="当前会话callid:".concat(t.callId,",根据numberId:")).call(r,t.numberId,",taskId:")).call(i,t.taskId,":查询坐席接听状态异常"),console.error(s),t.stop=!0,C(this,ke,"f").call(this,new Error(n.message)),e.abrupt("return");case 20:if(a=n.data,o=a.callType,u=a.newIntentTag,l=a.intentTag,f=a.number,h=a.numberMd5,d=a.sid,p=a.config,v=a.tag,10!==a.state){e.next=25;break}return console.log("当前会话callid:".concat(t.callId,"已结束")),t.stop=!0,e.abrupt("return");case 25:if(t.callType||(t.callType=o),t.intentTag=u||l,t.number||(t.number=f),t.numberMD5||(t.numberMD5=h),t.agentId||(t.agentId=d),t.tag||(t.tag=v),t.templateId||p&&"string"==typeof p&&(g=JSON.parse(p))&&g.templateId&&(t.templateId=g.templateId),!t.callId){e.next=54;break}return k={},e.prev=34,e.next=37,this.getCallNumberChats({callId:t.callId,taskId:t.taskId});case 37:if(200===(k=e.sent).code){e.next=43;break}return console.error(k.message),t.stop=!0,C(this,ke,"f").call(this,new Error(k.message)),e.abrupt("return");case 43:e.next=52;break;case 45:return e.prev=45,e.t1=e.catch(34),y=m(x="当前会话根据callId:".concat(t.callId,",taskId:")).call(x,t.taskId,":查询会话对话记录异常"),console.error(y),t.stop=!0,C(this,ke,"f").call(this,new Error(y)),e.abrupt("return");case 52:t.chats=w(b=k.data).call(b,(function(e){return e.matchinfo&&(e.matchinfo=JSON.parse(e.matchinfo)),e})),C(this,ce,"f")[t.callId]=t;case 54:try{C(this,de,"f").call(this,C(this,ce,"f")[t.callId])}catch(e){console.log(e)}e.next=60;break;case 57:t.stop=!0,t.taskId||(S="当前会话callid:".concat(t.callId,"的taskId不存在,无法查询通话记录"),console.error(S),C(this,ke,"f").call(this,new Error(S))),t.numberId||(A="当前会话callid:".concat(t.callId,"的numberId不存在,无法查询通话记录"),console.error(A),C(this,ke,"f").call(this,new Error(A)));case 60:case"end":return e.stop()}}),e,this,[[2,13],[34,45]])})))},e.prev=2;case 3:if(!t.stop){e.next=6;break}return e.abrupt("break",14);case 6:return e.next=8,n();case 8:if(!t.stop){e.next=10;break}return e.abrupt("break",14);case 10:return e.next=12,new v((function(e){var t=d((function(){return O(i,void 0,void 0,c.mark((function n(){return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:clearTimeout(t),t=void 0,e(!0);case 3:case"end":return n.stop()}}),n)})))}),3e3)}));case 12:e.next=3;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(2),C(this,ke,"f").call(this,e.t0);case 19:case"end":return e.stop()}}),e,this,[[2,16]])})))}},{key:"refreshCallChatInfo",value:function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(C(this,it,"f").numberId&&C(this,it,"f").callId&&C(this,it,"f").taskId&&C(this,rt,"f"))){e.next=3;break}return e.next=3,this.getCallInfo();case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getOpenApi",value:function(){return C(this,Ye,"f")?function(e){if(!e)return!1;var t=/^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/;return!!/^(\d{1,3}\.){3}\d{1,3}$/.test(e)||("//"===I(e).call(e,0,2)?t.test(I(e).call(e,2,e.length)):"http://"===I(e).call(e,0,7)?t.test(I(e).call(e,7,e.length)):"https://"===I(e).call(e,0,8)?t.test(I(e).call(e,8,e.length)):t.test(e))}(C(this,Ye,"f"))?C(this,Ye,"f"):"1"===C(this,Je,"f")?"1"===C(this,Ve,"f")?"https://seatsg.94ai.com/sgopenapi":"https://seatsg.94ai.com/openapi":"1"===C(this,Ve,"f")?"https://seat.94ai.com/sgopenapi":"https://seat.94ai.com/openapi":"https://seat.94ai.com/openapi"}},{key:"getAgentInfo",value:function(){return this.requestOpenApi({url:"/v1/agent/getAgent",data:{agentTag:C(this,_e,"f"),agentId:C(this,Be,"f")}})}},{key:"getOpenApiSign",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f(),i=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;return O(this,void 0,void 0,c.mark((function s(){return c.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,C(this,ge,"f").call(this,C(this,ae,"f"));case 2:return s.abrupt("return",{sign:null!==(e=C(this,ne,"f"))&&void 0!==e?e:T.enc.Base64.stringify(T.HmacSHA1(i||C(this,Fe,"f")+n,r||C(this,Ge,"f"))),timestamp:null!==(t=C(this,ie,"f"))&&void 0!==t?t:n});case 3:case"end":return s.stop()}}),s,this)})))}},{key:"updateOpenApiAgentStatus",value:function(e){return this.requestOpenApi({url:"/v1/agent/updateAgentStatus",data:{agentTag:C(this,_e,"f"),agentId:C(this,Be,"f"),agentStatus:e}})}},{key:"importOpenApiAgentCustomer",value:function(e){return this.requestOpenApi({url:"/v1/task/importAgentCustomer",data:{agentTag:C(this,_e,"f"),agentId:C(this,Be,"f"),callType:1001,customers:[{number:e}]}})}},{key:"callNumber",value:function(e){return this.importOpenApiAgentCustomer(e)}},{key:"toggleNap",value:function(e){return e?this.updateOpenApiAgentStatus(3):this.updateOpenApiAgentStatus(1)}},{key:"refreshSign",value:function(e){q(this,ne,e,"f")}},{key:"prepareUserAgent",value:function(e,t){var n;return O(this,void 0,void 0,c.mark((function i(){var r,s,a,o,u,l,f,h,d,p,v;return c.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return s=(r=e||{}).refresh,a=r.registererOptions,o=r.registererRegisterOptions,u=r.extraHeaders,l=r.authorizationUsername,f=r.authorizationPassword,h=r.uri,d=r.contactName,p=r.transportOptions,i.next=3,this.dispose();case 3:return C(this,Z,"f").uri=null!=h?h:C(this,Z,"f").uri,C(this,Z,"f").authorizationUsername=null!=l?l:C(this,Z,"f").authorizationUsername,C(this,Z,"f").authorizationPassword=null!=f?f:C(this,Z,"f").authorizationPassword,C(this,Z,"f").contactName=null!==(n=null!=d?d:l)&&void 0!==n?n:C(this,Z,"f").contactName,p&&(C(this,Z,"f").transportOptions=g(g({},C(this,Z,"f").transportOptions),p)),i.prev=8,C(this,F,"m",bt).call(this,e),i.next=12,C(this,yt,"f").call(this);case 12:return i.next=14,C(this,St,"f").call(this);case 14:return C(this,F,"m",Tt).call(this,{refresh:s}),i.next=17,C(this,F,"m",tn).call(this);case 17:return t&&C(this,F,"m",en).call(this,t),i.next=20,C(this,F,"m",nn).call(this,{registererOptions:a,registererRegisterOptions:o,extraHeaders:u},C(this,et,"f"));case 20:return v=i.sent,i.abrupt("return",v);case 24:return i.prev=24,i.t0=i.catch(8),i.next=28,this.dispose();case 28:throw i.t0;case 29:case"end":return i.stop()}}),i,this,[[8,24]])})))}},{key:"dispose",value:function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,C(this,F,"m",At).call(this),e.next=4,C(this,F,"m",Dt).call(this);case 4:e.next=10;break;case 6:e.prev=6,e.t0=e.catch(0),C(this,F,"m",Rt).call(this),console.log("sip dispose with error",e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,6]])})))}},{key:"ignoreInvite",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return C(this,ee,"f").incomingStatus=!1,t.next=3,this.getCurrentInvitation().reject(e);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"acceptInvite",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){var n=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,new v((function(t,i){O(n,void 0,void 0,c.mark((function n(){var r,s;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,r=null==e?void 0:e.onAck,s=null==e?void 0:e.onAckTimeout,null==e||delete e.onAck,null==e||delete e.onAckTimeout,n.next=7,this.getCurrentInvitation().accept(g({sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}},onAck:function(e){t(e),null==r||r()},onAckTimeout:function(){null==s||s(),i(new Error("接听响应超时"))}},e||{}));case 7:n.next=12;break;case 9:n.prev=9,n.t0=n.catch(0),i(n.t0);case 12:case"end":return n.stop()}}),n,this,[[0,9]])})))}));case 3:C(this,ee,"f").incomingStatus&&(C(this,ee,"f").incomingStatus=!1,C(this,ee,"f").answerStatus=!0),t.next=10;break;case 6:throw t.prev=6,t.t0=t.catch(0),C(this,ee,"f").incomingStatus=!1,t.t0;case 10:case"end":return t.stop()}}),t,this,[[0,6]])})))}},{key:"hangUpInvite",value:function(e){return O(this,void 0,void 0,c.mark((function t(){var n,i,s,a,o,u=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(n=e||{}).rejectOptions,s=n.byeOptions,a=n.extraHeaders,o=n.scoutResponse,t.abrupt("return",new v((function(e,t){return O(u,void 0,void 0,c.mark((function n(){var u,l,f,h,d,p,v,m,w;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:n.prev=0,v=null===(u=(p=s||{}).requestDelegate)||void 0===u?void 0:u.onAccept,m=null===(l=p.requestDelegate)||void 0===l?void 0:l.onReject,null===(f=p.requestDelegate)||void 0===f||delete f.onAccept,null===(h=p.requestDelegate)||void 0===h||delete h.onReject,w=C(this,F,"m",Ot).call(this,{onAccept:function(t){console.log("sip bye success"),e(t),null==v||v(t)},onReject:function(e){null==m||m(e),t(new Error("sip bye fail with code "+e.message.statusCode))}},p.requestDelegate),delete p.requestDelegate,n.t0=null===(d=C(this,K,"f"))||void 0===d?void 0:d.state,n.next=n.t0===r.SessionState.Initial||n.t0===r.SessionState.Establishing?11:n.t0===r.SessionState.Established?15:n.t0===r.SessionState.Terminating||n.t0===r.SessionState.Terminated?19:21;break;case 11:return n.next=13,C(this,K,"f").reject(g({extraHeaders:a},i||{}));case 13:return e(!0),n.abrupt("break",21);case 15:return n.next=17,C(this,K,"f").bye(g({requestDelegate:w,requestOptions:{extraHeaders:a}},p));case 17:return o||e(!0),n.abrupt("break",21);case 19:return e(!0),n.abrupt("break",21);case 21:n.next=26;break;case 23:n.prev=23,n.t1=n.catch(0),t(n.t1);case 26:return n.prev=26,C(this,ee,"f").incomingStatus=!1,C(this,ee,"f").answerStatus=!1,n.finish(26);case 30:case"end":return n.stop()}}),n,this,[[0,23,26,30]])})))})));case 2:case"end":return t.stop()}}),t)})))}},{key:"sendStarDtmf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){var n=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new v((function(t,i){return O(n,void 0,void 0,c.mark((function n(){var r,s,a,o;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,s=(r=e||{}).extraHeaders,a=r.requestDelegate,o=C(this,F,"m",Ot).call(this,{onAccept:function(e){console.log("sip send dtmf Signal=* success"),t(e)},onReject:function(e){i(new Error("sip send dtmf Signal=* fail with code "+e.message.statusCode))}},a),delete r.requestDelegate,n.next=7,this.getCurrentInvitation().info(g({requestOptions:{body:{contentDisposition:"render",contentType:"application/dtmf-relay",content:"Signal=*\r\nDuration=100"},extraHeaders:s},requestDelegate:o},r));case 7:C(this,at,"f").call(this),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(0),i(n.t0);case 13:case"end":return n.stop()}}),n,this,[[0,10]])})))})));case 1:case"end":return t.stop()}}),t)})))}},{key:"muteRemoteAudio",value:function(){var e;h(e=C(this,V,"f").getReceivers()).call(e,(function(e){e.track.enabled=!1}))}},{key:"unMuteRemoteAudio",value:function(){var e;h(e=C(this,V,"f").getReceivers()).call(e,(function(e){e.track.enabled=!0}))}},{key:"muteLocalAudio",value:function(){var e;h(e=C(this,V,"f").getSenders()).call(e,(function(e){e.track.enabled=!1}))}},{key:"unMuteLocalAudio",value:function(){var e;h(e=C(this,V,"f").getSenders()).call(e,(function(e){e.track.enabled=!0}))}},{key:"getUserAgentStatue",value:function(){return C(this,ee,"f")}},{key:"getUserAgent",value:function(){return C(this,_,"f")||q(this,_,new r.UserAgent(C(this,Z,"f")),"f"),C(this,_,"f")}},{key:"getSessionDescriptionHandler",value:function(){return C(this,Y,"f")}},{key:"getPeerConnection",value:function(){return C(this,V,"f")}},{key:"getSenders",value:function(){return C(this,W,"f")}},{key:"getReceivers",value:function(){return C(this,J,"f")}},{key:"getStream",value:function(){var e,t=this;return C(this,Q,"f")||q(this,Q,new MediaStream,"f"),h(e=C(this,J,"f")).call(e,(function(e){e.track&&C(t,Q,"f").addTrack(e.track)})),C(this,Q,"f")}},{key:"getCurrentInviter",value:function(){if(!C(this,$,"f"))throw new Error("No currentInviter...");return C(this,$,"f")}},{key:"getCurrentInvitation",value:function(){return C(this,K,"f")}},{key:"invite",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return O(this,void 0,void 0,c.mark((function n(){var i,s,a;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=r.UserAgent.makeURI(e.uri?e.uri:m(i="sip:".concat(e.extension,"@")).call(i,C(this,Z,"f").transportOptions.server.split("://")[1]))){n.next=3;break}throw new Error("Failed to create target URI.");case 3:return q(this,$,new r.Inviter(this.getUserAgent(),s,{sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}}),"f"),a=(t||{}).extraHeaders,n.next=7,this.getCurrentInviter().invite(g({requestOptions:{extraHeaders:a}},t));case 7:return n.abrupt("return",C(this,$,"f"));case 8:case"end":return n.stop()}}),n,this)})))}}]),e}();G=new x,_=new x,B=new x,Y=new x,V=new x,J=new x,W=new x,Z=new x,K=new x,$=new x,Q=new x,ee=new x,te=new x,ne=new x,ie=new x,re=new x,se=new x,ae=new x,oe=new x,ce=new x,ue=new x,le=new x,fe=new x,he=new x,de=new x,pe=new x,ve=new x,ge=new x,me=new x,we=new x,be=new x,ke=new x,xe=new x,ye=new x,Se=new x,Ae=new x,Ie=new x,Te=new x,je=new x,Oe=new x,Ce=new x,qe=new x,De=new x,Ee=new x,Re=new x,Ne=new x,Pe=new x,Me=new x,Ue=new x,He=new x,ze=new x,Le=new x,Xe=new x,Fe=new x,Ge=new x,_e=new x,Be=new x,Ye=new x,Ve=new x,Je=new x,We=new x,Ze=new x,Ke=new x,$e=new x,Qe=new x,et=new x,tt=new x,nt=new x,it=new x,rt=new x,st=new x,at=new x,ot=new x,ct=new x,ut=new x,lt=new x,ft=new x,ht=new x,dt=new x,pt=new x,yt=new x,St=new x,It=new x,zt=new x,Xt=new x,Ft=new x,Gt=new x,_t=new x,Bt=new x,Kt=new x,F=new y,vt=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,pe,null!==(e=n.openXhrIntercept)&&void 0!==e?e:C(this,pe,"f"),"f"),q(this,ve,null!==(t=n.gatewayXhrIntercept)&&void 0!==t?t:C(this,ve,"f"),"f")},gt=function(){var e,t,n,i,r,s,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,rt,null!==(e=a.enableChatInfoPush)&&void 0!==e?e:C(this,rt,"f"),"f"),q(this,st,null!==(t=a.enableVolumnTrack)&&void 0!==t?t:C(this,st,"f"),"f"),q(this,he,null!==(n=a.refreshSpeekVolumn)&&void 0!==n?n:C(this,he,"f"),"f"),q(this,xe,null!==(i=a.refreshRequirementCheck)&&void 0!==i?i:C(this,xe,"f"),"f"),q(this,de,null!==(r=a.refreshChat)&&void 0!==r?r:C(this,de,"f"),"f"),q(this,ke,null!==(s=a.refreshChatErrorCallback)&&void 0!==s?s:C(this,ke,"f"),"f")},mt=function(){var e,t,n,i,r,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,re,null!==(e=s.token)&&void 0!==e?e:C(this,re,"f"),"f"),q(this,se,null!==(t=s.tokenTimestamp)&&void 0!==t?t:C(this,se,"f"),"f"),q(this,oe,null!==(n=s.tokenExpirationTime)&&void 0!==n?n:C(this,oe,"f"),"f"),C(this,re,"f")&&!C(this,se,"f")&&q(this,se,f(),"f"),q(this,me,null!==(i=s.tokenCheck)&&void 0!==i?i:C(this,me,"f"),"f"),q(this,be,null!==(r=s.tokenOverdued)&&void 0!==r?r:C(this,be,"f"),"f")},wt=function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};q(this,et,null!==(e=i.clusterMode)&&void 0!==e?e:C(this,et,"f"),"f"),q(this,tt,null!==(t=i.reClusterRegisterTimeout)&&void 0!==t?t:C(this,tt,"f"),"f"),q(this,nt,null!==(n=i.reClusterConnectTimeout)&&void 0!==n?n:C(this,nt,"f"),"f")},bt=function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.agentId,s=i.agentTag,a=i.appKey,o=i.appSecret,c=i.openBaseUrl,u=i.sg,l=i.sgOpen,f=i.sign,h=i.timestamp;q(this,Be,null!=r?r:C(this,Be,"f"),"f"),q(this,_e,null!=s?s:C(this,_e,"f"),"f"),q(this,Fe,null!=a?a:C(this,Fe,"f"),"f"),q(this,Ge,null!=o?o:C(this,Ge,"f"),"f"),q(this,Ye,null!=c?c:C(this,Ye,"f"),"f"),q(this,Je,null!=u?u:C(this,Je,"f"),"f"),q(this,Ve,null!=l?l:C(this,Ve,"f"),"f"),q(this,ne,null!=f?f:C(this,ne,"f"),"f"),q(this,ie,null!=h?h:C(this,ie,"f"),"f"),q(this,ae,null!==(e=i.signExpirationTime)&&void 0!==e?e:C(this,ae,"f"),"f"),q(this,ge,null!==(t=i.signCheck)&&void 0!==t?t:C(this,ge,"f"),"f"),q(this,we,null!==(n=i.signOverdued)&&void 0!==n?n:C(this,we,"f"),"f")},kt=function(e){e.sipHeaders&&(q(this,G,e.sipHeaders,"f"),delete e.sipHeaders)},xt=function(){return!(!C(this,Be,"f")&&!C(this,_e,"f")||!(C(this,Fe,"f")&&C(this,Ge,"f")||C(this,ne,"f")&&C(this,ie,"f")))},At=function(){C(this,F,"m",Et).call(this),C(this,F,"m",Mt).call(this),C(this,F,"m",Ut).call(this),C(this,F,"m",Pt).call(this),C(this,F,"m",Nt).call(this),C(this,F,"m",Yt).call(this),C(this,F,"m",Vt).call(this),C(this,F,"m",Rt).call(this),C(this,ot,"f").call(this),q(this,it,{},"f"),q(this,ce,{},"f")},Tt=function(e){q(this,ee,a(JSON.parse(u(H)),"function"==typeof e.refresh?e.refresh:C(this,Ke,"f")),"f")},jt=function(e){var t,n,i,r,s,a,o,c,u,l,f,h,d,p,v;q(this,Ae,null!==(i=null!==(t=e.reconnectionAttempts)&&void 0!==t?t:null===(n=null==e?void 0:e.transportOptions)||void 0===n?void 0:n.maxReconnectionAttempts)&&void 0!==i?i:C(this,Ae,"f"),"f"),q(this,Ie,null!==(o=null!==(s=null!==(r=e.reconnectionInterval)&&void 0!==r?r:e.reconnectionDelay)&&void 0!==s?s:null===(a=null==e?void 0:e.transportOptions)||void 0===a?void 0:a.reconnectionTimeout)&&void 0!==o?o:C(this,Ie,"f"),"f"),q(this,Ne,null!==(u=null===(c=e.transportOptions)||void 0===c?void 0:c.keepAliveInterval)&&void 0!==u?u:C(this,Ne,"f"),"f"),q(this,Pe,null!==(f=null===(l=e.transportOptions)||void 0===l?void 0:l.keepAliveDebounce)&&void 0!==f?f:C(this,Pe,"f"),"f"),q(this,De,null!==(h=e.registerInterval)&&void 0!==h?h:C(this,De,"f"),"f"),q(this,Te,null!==(d=e.optionsPingInterval)&&void 0!==d?d:C(this,Te,"f"),"f"),q(this,je,null!==(p=e.optionsPingAttempts)&&void 0!==p?p:C(this,je,"f"),"f"),q(this,Ee,null!==(v=e.registerAttempts)&&void 0!==v?v:C(this,Ee,"f"),"f")},Ot=function(e,t){var n,i=this;return t?(h(n=S(t)).call(n,(function(n){if(t[n]&&"function"==typeof t[n])if(e[n]){if("function"==typeof e[n]){var r=e[n];e[n]=function(e){return O(i,void 0,void 0,c.mark((function i(){return c.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t[n](e);case 2:return i.next=4,r(e);case 4:case"end":return i.stop()}}),i)})))}}}else e[n]=t[n]})),e):e},Ct=function(e){var t,n=this,i={delegate:{onConnect:function(){return O(n,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("sip connected"),C(this,Gt,"f").call(this);case 2:case"end":return e.stop()}}),e,this)})))},onInvite:function(e){C(n,It,"f").call(n,e.incomingInviteRequest.message.headers),n.refreshCallChatInfo(),C(n,F,"m",qt).call(n),q(n,K,e,"f"),C(n,ee,"f").incomingStatus=!0,e.stateChange.addListener(C(n,zt,"f"))},onDisconnect:function(e){return O(n,void 0,void 0,c.mark((function t(){var n;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("sip disconnected"),n=!1,C(this,Te,"f")>0&&(n=C(this,Ce,"f"),C(this,Bt,"f").call(this)),t.prev=3,t.next=6,C(this,F,"m",Lt).call(this);case 6:t.next=10;break;case 8:t.prev=8,t.t0=t.catch(3);case 10:(e||n)&&C(this,F,"m",$t).call(this);case 11:case"end":return t.stop()}}),t,this,[[3,8]])})))}}};e.delegate?h(t=S(e.delegate)).call(t,(function(t){var r=t;if(e.delegate[r]&&"function"==typeof e.delegate[r]){var s=e.delegate[r];e.delegate[r]=function(e){return O(n,void 0,void 0,c.mark((function t(){var n,a;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(a=(n=i.delegate)[r])||void 0===a||a.call(n,e),t.next=3,s(e);case 3:case"end":return t.stop()}}),t)})))}}})):e.delegate=i.delegate;return e.reconnectionAttempts=0,e.transportOptions=g(g({},e.transportOptions||{}),{keepAliveInterval:C(this,Ne,"f"),keepAliveDebounce:C(this,Pe,"f")}),void 0===e.sessionDescriptionHandlerFactoryOptions&&(e.sessionDescriptionHandlerFactoryOptions={iceGatheringTimeout:2e3,peerConnectionConfiguration:{iceServers:[]}}),g(g({},U),e)},qt=function(){C(this,K,"f")&&(C(this,K,"f").dispose(),q(this,K,void 0,"f"))},Dt=function(){return O(this,void 0,void 0,c.mark((function e(){return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C(this,_,"f")){e.next=4;break}return e.next=3,C(this,_,"f").stop();case 3:q(this,_,void 0,"f");case 4:case"end":return e.stop()}}),e,this)})))},Et=function(){var e;C(this,Q,"f")&&(h(e=C(this,Q,"f").getTracks()).call(e,(function(e){e.stop()})),q(this,Q,void 0,"f"))},Rt=function(){var e,t=this;h(e=S(H)).call(e,(function(e){var n=e;C(t,ee,"f")[n]=H[n]}))},Nt=function(){C(this,Y,"f")&&(C(this,Y,"f").close(),q(this,Y,void 0,"f"))},Pt=function(){C(this,V,"f")&&(C(this,V,"f").close(),q(this,V,void 0,"f"))},Mt=function(){q(this,W,[],"f")},Ut=function(){q(this,J,[],"f")},Ht=function(){var e=this.getCurrentInvitation().sessionDescriptionHandler;C(this,F,"m",Pt).call(this),C(this,F,"m",Nt).call(this),C(this,F,"m",Mt).call(this),C(this,F,"m",Ut).call(this),q(this,Y,e,"f"),q(this,V,e.peerConnection,"f"),q(this,W,C(this,V,"f").getSenders(),"f"),q(this,J,C(this,V,"f").getReceivers(),"f"),(this.getFastOutboundCall()||!this.getSitOutboundCall()&&this.notNeedSendStarDtmf())&&C(this,at,"f").call(this)},Lt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O(this,void 0,void 0,c.mark((function t(){var n=this;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!C(this,B,"f")){t.next=3;break}return console.log("sip due to disconnection, unregistered"),t.abrupt("return",new v((function(t,i){return O(n,void 0,void 0,c.mark((function n(){var r,s;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,r=e||{},s=C(this,F,"m",Ot).call(this,{onAccept:function(e){console.log("sip unregister successed"),t(e)},onReject:function(e){i(new Error("sip unregister fail with code "+e.message.statusCode))}},r.requestDelegate),delete e.requestDelegate,n.next=6,C(this,B,"f").unregister(g({requestDelegate:s},e));case 6:n.next=11;break;case 8:n.prev=8,n.t0=n.catch(0),i(n.t0);case 11:case"end":return n.stop()}}),n,this,[[0,8]])})))})));case 3:case"end":return t.stop()}}),t,this)})))},Yt=function(){C(this,F,"m",Jt).call(this),C(this,F,"m",Wt).call(this),C(this,F,"m",Zt).call(this),q(this,He,!1,"f"),q(this,Me,!1,"f"),q(this,Ue,!1,"f")},Vt=function(){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(clearTimeout(C(this,$e,"f")),q(this,$e,void 0,"f")),e&&(clearTimeout(C(this,Qe,"f")),q(this,Qe,void 0,"f"))},Jt=function(){clearTimeout(C(this,Xe,"f")),q(this,Xe,void 0,"f")},Wt=function(){clearTimeout(C(this,ze,"f")),q(this,ze,void 0,"f")},Zt=function(){clearTimeout(C(this,Le,"f")),q(this,Le,void 0,"f")},$t=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return O(this,void 0,void 0,c.mark((function n(){var i=this;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!C(this,Ie,"f")){n.next=12;break}if(C(this,ee,"f").reconnectStatus=!0,!C(this,Me,"f")){n.next=4;break}return n.abrupt("return");case 4:if(!(t>C(this,Ae,"f"))){n.next=9;break}return console.log("sip maximum reconnection attempts reached"),n.next=8,this.dispose();case 8:return n.abrupt("return");case 9:console.log("sip reconnection attempt..."),q(this,Me,!0,"f"),q(this,ze,d((function(){C(i,F,"m",Wt).call(i),i.getUserAgent().reconnect().then((function(){return O(i,void 0,void 0,c.mark((function e(){var n;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log(m(n="sip reconnection attempt ".concat(t," of ")).call(n,C(this,Ae,"f")," - succeeded")),q(this,Me,!1,"f"),C(this,Kt,"f").call(this);case 3:case"end":return e.stop()}}),e,this)})))})).catch((function(n){var r;console.error(n),console.log(m(r="sip reconnection attempt ".concat(t," of ")).call(r,C(i,Ae,"f")," - failed")),q(i,Me,!1,"f"),C(i,F,"m",e).call(i,++t)}))}),1===t?0:1e3*C(this,Ie,"f")),"f");case 12:case"end":return n.stop()}}),n,this)})))},Qt=function(e){var t,n=this;return h(t=S(e)).call(t,(function(t){var i=t;if("function"==typeof(null==e?void 0:e[i])){var r=e[i];e[i]=function(e){return O(n,void 0,void 0,c.mark((function t(){var n,s;return c.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(s=(n=C(this,Z,"f").delegate)[i])||void 0===s||s.call(n,e),t.next=3,r(e);case 3:case"end":return t.stop()}}),t,this)})))}}})),e},en=function(e){var t=this.getUserAgent();return t.delegate=C(this,F,"m",Qt).call(this,e),t},tn=function(){return O(this,void 0,void 0,c.mark((function e(){var t;return c.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.getUserAgent(),e.next=3,t.start();case 3:if(t.isConnected()){e.next=6;break}return e.next=6,t.reconnect();case 6:if(t.isConnected()){e.next=8;break}throw new Error("链接失败,请稍后再试");case 8:return C(this,ee,"f").connectStatus=!0,e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this)})))},nn=function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=t||{},a=s.registererOptions,o=s.registererRegisterOptions,u=s.extraHeaders;return new v((function(t,s){return O(n,void 0,void 0,c.mark((function n(){var l,f,h,p,v=this;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return l=this.getUserAgent(),q(this,B,new r.Registerer(l,g({extraHeaders:u||C(this,G,"f")},a||{})),"f"),h=o||{},p=C(this,F,"m",Ot).call(this,{onAccept:function(e){f=e,C(v,F,"m",Vt).call(v),C(v,ee,"f").registerStatus=!0,t(l)},onReject:function(e){C(v,F,"m",Vt).call(v),s(new Error("sip register fail with code "+e.message.statusCode))}},h.requestDelegate),delete h.requestDelegate,i&&q(this,$e,d((function(){return O(v,void 0,void 0,c.mark((function n(){var i=this;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(f){n.next=14;break}q(this,Qe,d((function(){return O(i,void 0,void 0,c.mark((function n(){var i;return c.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(C(this,F,"m",Vt).call(this,!1,!0),f){n.next=22;break}n.prev=2;try{C(this,B,"f").dispose()}catch(e){}return C(this,F,"m",At).call(this),C(this,Bt,"f").call(this),q(this,Oe,0,"f"),q(this,Re,0,"f"),n.next=10,C(this,_,"f").transport.dispose();case 10:return q(this,_,new r.UserAgent(C(this,Z,"f")),"f"),n.next=13,C(this,F,"m",tn).call(this);case 13:return n.next=15,C(this,F,"m",e).call(this,{registererOptions:a,registererRegisterOptions:o,extraHeaders:u});case 15:i=n.sent,t(i),n.next=22;break;case 19:n.prev=19,n.t0=n.catch(2),s(n.t0);case 22:case"end":return n.stop()}}),n,this,[[2,19]])})))}),C(this,nt,"f")),"f");try{C(this,B,"f").dispose()}catch(e){}return q(this,B,new r.Registerer(l,g({extraHeaders:u||C(this,G,"f")},a||{})),"f"),C(this,F,"m",Vt).call(this,!0,!1),n.prev=5,n.next=8,C(this,B,"f").register(g({requestDelegate:p,requestOptions:{extraHeaders:u||C(this,G,"f")}},h));case 8:n.next=14;break;case 10:n.prev=10,n.t0=n.catch(5),C(this,F,"m",Vt).call(this),s(n.t0);case 14:case"end":return n.stop()}}),n,this,[[5,10]])})))}),C(this,tt,"f")),"f"),n.prev=6,n.next=9,C(this,B,"f").register(g({requestDelegate:p,requestOptions:{extraHeaders:u||C(this,G,"f")}},h));case 9:n.next=15;break;case 11:n.prev=11,n.t0=n.catch(6),C(this,F,"m",Vt).call(this),s(n.t0);case 15:case"end":return n.stop()}}),n,this,[[6,11]])})))}))};var fn=function(){function e(){n(this,e)}return i(e,null,[{key:"getUserAgentManager",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return C(this,cn,"f",un)||q(this,cn,new ln(e),"f",un),C(this,cn,"f",un)}},{key:"hasUserAgentManager",value:function(){return!!C(this,cn,"f",un)}},{key:"newUserAgentManager",value:function(){return new ln(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},{key:"dispose",value:function(){if(C(this,cn,"f",un))try{C(this,cn,"f",un).dispose()}catch(e){}finally{q(this,cn,void 0,"f",un)}}}]),e}();cn=fn,un={value:void 0},Object.defineProperty(exports,"Inviter",{enumerable:!0,get:function(){return r.Inviter}}),Object.defineProperty(exports,"Registerer",{enumerable:!0,get:function(){return r.Registerer}}),Object.defineProperty(exports,"SessionState",{enumerable:!0,get:function(){return r.SessionState}}),Object.defineProperty(exports,"URI",{enumerable:!0,get:function(){return r.URI}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function(){return r.UserAgent}}),Object.defineProperty(exports,"SimpleUser",{enumerable:!0,get:function(){return s.SimpleUser}}),exports.onChange=a,exports.UserAgentFactory=fn,exports.UserAgentManager=ln,exports.accumulateSec=an,exports.accumulationTimer=function(e){var t=sn();e(rn(t));var n=p((function(){var n=an(t),i=rn(n);e(i)}),1e3);return function(){clearInterval(n),n=null}},exports.cleanupMedia=function(e){var t=z(e);t&&(t.srcObject=null,t.pause())},exports.getDevicePermission=X,exports.getMedia=z,exports.getTimes=rn,exports.getZeorTime=sn,exports.pauseMedia=function(e){var t=z(e);t&&(t.currentTime=0,t.pause())},exports.playMedia=function(e){var t=z(e);t&&(t.currentTime=0,t.play())},exports.requestMicroPhonePermission=function(){try{var e;if(-1===b(e=navigator.userAgent).call(e,"Firefox"))return X({video:!1,audio:!0}).catch((function(){return!0}))}catch(e){console.log(e)}},exports.stopStreamTracks=L,exports.userAgentDefault=U,exports.userAgentStatus=H;
|