@telegenta/webclient 2.0.11 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +102 -81
  2. package/demos/add_phone_number.html +8 -7
  3. package/demos/calldata_available.html +5 -5
  4. package/demos/embedded_config.html +95 -95
  5. package/demos/event_client.html +226 -226
  6. package/demos/phone_client.html +564 -558
  7. package/dist/telegenta.js +3627 -0
  8. package/dist/telegenta.min.js +1 -0
  9. package/docs/EventClient.html +3 -1093
  10. package/docs/InvalidMediaDevice.html +3 -0
  11. package/docs/InvalidOptions.html +3 -0
  12. package/docs/InvalidParameter.html +3 -0
  13. package/docs/LogHandler.html +7 -0
  14. package/docs/MediaNotPrepared.html +3 -0
  15. package/docs/NoActiveSession.html +3 -0
  16. package/docs/NotAllowed.html +3 -0
  17. package/docs/NotReady.html +3 -0
  18. package/docs/Phone.html +4 -2837
  19. package/docs/Request.html +3 -0
  20. package/docs/Requestor.html +3 -0
  21. package/docs/Session.html +3 -2599
  22. package/docs/UnableToConnect.html +3 -0
  23. package/docs/data/search.json +1 -0
  24. package/docs/event-client.js.html +346 -0
  25. package/docs/exceptions.js.html +94 -0
  26. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  27. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  28. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  29. package/docs/global.html +5 -4950
  30. package/docs/index.html +3 -66
  31. package/docs/logger.js.html +106 -0
  32. package/docs/phone-client.js.html +2155 -0
  33. package/docs/requestor.js.html +223 -0
  34. package/docs/scripts/core.js +726 -0
  35. package/docs/scripts/core.min.js +23 -0
  36. package/docs/scripts/resize.js +90 -0
  37. package/docs/scripts/search.js +265 -0
  38. package/docs/scripts/search.min.js +6 -0
  39. package/docs/scripts/{prettify → third-party}/Apache-License-2.0.txt +202 -202
  40. package/docs/scripts/third-party/fuse.js +9 -0
  41. package/docs/scripts/third-party/hljs-line-num-original.js +369 -0
  42. package/docs/scripts/third-party/hljs-line-num.js +1 -0
  43. package/docs/scripts/third-party/hljs-original.js +5171 -0
  44. package/docs/scripts/third-party/hljs.js +1 -0
  45. package/docs/scripts/third-party/popper.js +5 -0
  46. package/docs/scripts/third-party/tippy.js +1 -0
  47. package/docs/scripts/third-party/tocbot.js +672 -0
  48. package/docs/scripts/third-party/tocbot.min.js +1 -0
  49. package/docs/styles/clean-jsdoc-theme-base.css +1159 -0
  50. package/docs/styles/clean-jsdoc-theme-dark.css +412 -0
  51. package/docs/styles/clean-jsdoc-theme-light.css +482 -0
  52. package/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
  53. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  54. package/docs/styles/clean-jsdoc-theme.min.css +1 -0
  55. package/package.json +46 -34
  56. package/babel.config.js +0 -16
  57. package/browser/telegenta.min.js +0 -1
  58. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  59. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  60. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  61. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  62. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  63. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  64. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  65. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  66. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  67. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  68. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  69. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  70. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  71. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  72. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  73. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  74. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  75. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  76. package/docs/fonts/OpenSans-Semibold-webfont.eot +0 -0
  77. package/docs/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  78. package/docs/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  79. package/docs/fonts/OpenSans-Semibold-webfont.woff +0 -0
  80. package/docs/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  81. package/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  82. package/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  83. package/docs/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  84. package/docs/scripts/linenumber.js +0 -25
  85. package/docs/scripts/prettify/lang-css.js +0 -2
  86. package/docs/scripts/prettify/prettify.js +0 -28
  87. package/docs/styles/jsdoc-default.css +0 -692
  88. package/docs/styles/prettify-jsdoc.css +0 -111
  89. package/docs/styles/prettify-tomorrow.css +0 -132
  90. package/embedded_client/embedded_phone.js +0 -325
  91. package/embedded_client/index.html +0 -201
  92. package/embedded_client/server.php +0 -28
  93. package/embedded_client/styles.css +0 -310
  94. package/embedded_client/tiny_rest_client.php +0 -73
  95. package/embedded_client/webphone_sprites.png +0 -0
  96. package/es5/event-client.js +0 -322
  97. package/es5/index.js +0 -44
  98. package/es5/phone-client.js +0 -1739
  99. package/src/event-client.js +0 -1
  100. package/src/index.js +0 -10
  101. package/src/phone-client.js +0 -1
  102. package/webpack.config.js +0 -39
@@ -1 +0,0 @@
1
- var _0x26cf=['disconnect','_socket','NoActiveSession','close','readyState','subscribe','InvalidParameter','You\x20must\x20specify\x20both\x20event\x20spec\x20and\x20callback\x20function','event_name','sendRequest','then','Subscription\x20to\x20\x27','\x27\x20was\x20successful,\x20ID\x20=\x20','push','log','\x27\x20failed:\x20','You\x20must\x20specify\x20subscription\x20id','isConnected','info','Unsubscribe\x20id:\x20','unsubscribe','Unsubscribe\x20to\x20\x27','\x27\x20was\x20successful','warning','Remote\x20unsubscribe\x20to\x20\x27','fireEvent','Event\x20','\x20was\x20successful','\x20failed:\x20','_removeSubscription','Removed\x20local\x20subscription:\x20','_connectServer','Connecting\x20to\x20event\x20server:\x20','_serverAddress','Unable\x20to\x20connect,\x20already\x20connecting','Unable\x20to\x20connect,\x20already\x20connected','Unable\x20to\x20connect,\x20socket\x20is\x20still\x20closing','open','_reconnectRetrySeconds','addEventListener','message','receiveMessage','data','ping','_reconnectServer','catch','Disconnected\x20from\x20event\x20service','error','floor','Reconnecting\x20in\x20','\x20secs','Auto\x20reconnect\x20disabled\x20(disconnecting?)','_handleIncomingEvent','Received\x20event\x20for\x20subcription\x20id\x20','\x20payload:\x20','stringify','payload','Callback\x20had\x20unhandled\x20exception\x20','resolve','reject','Invalid\x20subscription\x20id\x20for\x20event:\x20','wss://api.telegenta.com/es/','specification','callback','doCallback','apply','_previousSubscriptions','_activeSubscriptions','_pingTimerObj','_autoReconnect','LogHandler','LOGLVL','ERROR','_requestor','event','connect'];(function(_0x58d96e,_0x4efa09){var _0x19dafb=function(_0x5d72d9){while(--_0x5d72d9){_0x58d96e['push'](_0x58d96e['shift']());}};_0x19dafb(++_0x4efa09);}(_0x26cf,0x16d));var _0x5f41=function(_0x4a7d5a,_0x5d39ed){_0x4a7d5a=_0x4a7d5a-0x0;var _0x35c1fd=_0x26cf[_0x4a7d5a];return _0x35c1fd;};'use strict';import{Exceptions,Logger,Requestor}from'@telegenta/common';const PING_INTERVAL=0x32;const ES_DEFAULT_SERVER_URL=_0x5f41('0x0');const RETRY_INTERVAL_START=0x1+Math['random']();const RETRY_MAX_BACKOFF=0x12c;class EventSubscription{constructor(_0x39629b,_0x2ba0f1,_0xe05c14){this['id']=_0x39629b;this[_0x5f41('0x1')]=_0x2ba0f1;this[_0x5f41('0x2')]=_0xe05c14;}[_0x5f41('0x3')](_0x414fe3,_0x23f65a){return this[_0x5f41('0x2')][_0x5f41('0x4')](_0x414fe3,[_0x23f65a]);}}export class EventClient{constructor(_0x198b97=null){this['_socket']=null;this[_0x5f41('0x5')]=[];this[_0x5f41('0x6')]=[];this[_0x5f41('0x7')]=null;this[_0x5f41('0x8')]=![];this['_reconnectRetrySeconds']=RETRY_INTERVAL_START;this['log']=_0x198b97?_0x198b97:new Logger[(_0x5f41('0x9'))](Logger[_0x5f41('0xa')][_0x5f41('0xb')]);this['_requestor']=new Requestor(this['log']);this[_0x5f41('0xc')]['on'](_0x5f41('0xd'),_0x221354=>{this['_handleIncomingEvent'](_0x221354);});}[_0x5f41('0xe')](_0xc1772f=null){if(!_0xc1772f){_0xc1772f=ES_DEFAULT_SERVER_URL;}this['_serverAddress']=_0xc1772f;this[_0x5f41('0x5')]=[];this[_0x5f41('0x6')]=[];return this['_connectServer']();}[_0x5f41('0xf')](){if(this[_0x5f41('0x10')]['readyState']!==0x1){throw new Exceptions[(_0x5f41('0x11'))]();}this[_0x5f41('0x6')]=[];this[_0x5f41('0x8')]=![];this[_0x5f41('0x10')][_0x5f41('0x12')]();}['isConnected'](){if(this[_0x5f41('0x10')]){return this[_0x5f41('0x10')][_0x5f41('0x13')]===0x1;}else{return![];}}[_0x5f41('0x14')](_0x1c9058,_0x2e5135){if(!_0x1c9058||!_0x2e5135){throw new Exceptions[(_0x5f41('0x15'))](_0x5f41('0x16'));}if(!_0x1c9058['hasOwnProperty'](_0x5f41('0x17'))){throw new Exceptions[(_0x5f41('0x15'))]('Your\x20event\x20specification\x20must\x20contain\x20event\x20name');}if(!this['isConnected']()){throw new Exceptions[(_0x5f41('0x11'))]();}const _0x46915b=this;return new Promise(function(_0x3ac380,_0x4aab71){_0x46915b[_0x5f41('0xc')][_0x5f41('0x18')](_0x46915b[_0x5f41('0x10')],_0x5f41('0x14'),_0x1c9058)[_0x5f41('0x19')](function(_0x168a5c){_0x46915b['log']['debug'](_0x5f41('0x1a')+_0x1c9058['event_name']+_0x5f41('0x1b')+_0x168a5c);_0x46915b['_activeSubscriptions'][_0x5f41('0x1c')](new EventSubscription(_0x168a5c,_0x1c9058,_0x2e5135));_0x3ac380(_0x168a5c);},function(_0x55cef6){_0x46915b[_0x5f41('0x1d')]['warning'](_0x5f41('0x1a')+_0x1c9058[_0x5f41('0x17')]+_0x5f41('0x1e')+_0x55cef6);_0x4aab71(_0x55cef6);});});}['unsubscribe'](_0x4148dd){if(!_0x4148dd){throw new Exceptions[(_0x5f41('0x15'))](_0x5f41('0x1f'));}if(!this[_0x5f41('0x20')]()){throw new Exceptions[(_0x5f41('0x11'))]();}this[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x22')+_0x4148dd);const _0x8135e=this;return new Promise(function(_0x42bdcb,_0x159dbc){_0x8135e[_0x5f41('0xc')][_0x5f41('0x18')](_0x8135e[_0x5f41('0x10')],_0x5f41('0x23'),{'id':_0x4148dd})['then'](_0x2100fe=>{_0x8135e[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x24')+_0x4148dd+_0x5f41('0x25'));_0x8135e['_removeSubscription'](_0x4148dd);_0x42bdcb(_0x2100fe);},_0x3b5189=>{_0x8135e[_0x5f41('0x1d')][_0x5f41('0x26')](_0x5f41('0x27')+_0x4148dd+_0x5f41('0x1e')+_0x3b5189);_0x159dbc(_0x3b5189);});});}[_0x5f41('0x28')](_0x5e87c0,_0x322a2f){if(!this[_0x5f41('0x20')]()){throw new Exceptions['NoActiveSession']();}return new Promise((_0x518d32,_0x3f07bb)=>{this['_requestor'][_0x5f41('0x18')](this[_0x5f41('0x10')],_0x5e87c0,_0x322a2f)[_0x5f41('0x19')](_0x3facb5=>{this['log'][_0x5f41('0x21')](_0x5f41('0x29')+_0x5e87c0+_0x5f41('0x2a'));_0x518d32(_0x3facb5);},_0x5d633f=>{this[_0x5f41('0x1d')][_0x5f41('0x26')](_0x5f41('0x29')+_0x5e87c0+_0x5f41('0x2b')+_0x5d633f);_0x3f07bb(_0x5d633f);});});}[_0x5f41('0x2c')](_0x207ba2){for(let _0xf85798 in this[_0x5f41('0x6')]){if(this[_0x5f41('0x6')][_0xf85798]['id']===_0x207ba2){this[_0x5f41('0x1d')]['debug'](_0x5f41('0x2d')+_0x207ba2);this[_0x5f41('0x6')]['splice'](_0xf85798,0x1);return!![];}}this[_0x5f41('0x1d')]['warning']('Unable\x20to\x20remove\x20subscription\x20'+_0x207ba2+'\x20locally,\x20not\x20found?');return![];}[_0x5f41('0x2e')](){this[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x2f')+this[_0x5f41('0x30')]);const _0x274a25=this;return new Promise(function(_0xe351c8,_0x4696ae){if(_0x274a25[_0x5f41('0x10')]){switch(_0x274a25[_0x5f41('0x10')][_0x5f41('0x13')]){case 0x0:_0x4696ae(_0x5f41('0x31'));return;case 0x1:_0x4696ae(_0x5f41('0x32'));return;case 0x2:_0x4696ae(_0x5f41('0x33'));return;}}_0x274a25[_0x5f41('0x10')]=new WebSocket(_0x274a25['_serverAddress']);let _0x34582e=![];_0x274a25[_0x5f41('0x10')]['addEventListener'](_0x5f41('0x34'),function(){_0x274a25[_0x5f41('0x1d')][_0x5f41('0x21')]('Successfully\x20connected\x20to\x20event\x20service');_0x34582e=!![];_0x274a25['_autoReconnect']=!![];_0x274a25[_0x5f41('0x35')]=RETRY_INTERVAL_START;_0x274a25[_0x5f41('0x10')][_0x5f41('0x36')](_0x5f41('0x37'),function(_0x3cc0ce){_0x274a25[_0x5f41('0xc')][_0x5f41('0x38')](_0x274a25[_0x5f41('0x10')],_0x3cc0ce[_0x5f41('0x39')]);});clearTimeout(_0x274a25[_0x5f41('0x7')]);_0x274a25[_0x5f41('0x7')]=setInterval(function(){_0x274a25[_0x5f41('0xc')][_0x5f41('0x3a')](_0x274a25[_0x5f41('0x10')])[_0x5f41('0x19')](function(){},function(_0x4eeed4){_0x274a25[_0x5f41('0x1d')][_0x5f41('0x26')]('Ping\x20failed:\x20'+_0x4eeed4);_0x274a25[_0x5f41('0x3b')]();});},PING_INTERVAL*0x3e8);_0x274a25[_0x5f41('0x5')]=_0x274a25[_0x5f41('0x6')];_0x274a25[_0x5f41('0x6')]=[];for(let _0x4a07ca of _0x274a25[_0x5f41('0x5')]){_0x274a25[_0x5f41('0x14')](_0x4a07ca[_0x5f41('0x1')],_0x4a07ca[_0x5f41('0x2')])[_0x5f41('0x3c')](function(_0x2430a1){_0x274a25[_0x5f41('0x1d')]['error']('Resubscribing\x20to\x20'+_0x4a07ca['specification'][_0x5f41('0x17')]+'\x20failed:\x20'+_0x2430a1);});}_0xe351c8();});_0x274a25[_0x5f41('0x10')]['addEventListener'](_0x5f41('0x12'),function(){_0x274a25[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x3d'));clearTimeout(_0x274a25['_pingTimerObj']);_0x274a25[_0x5f41('0x3b')]();});_0x274a25['_socket'][_0x5f41('0x36')]('error',function(_0x5278a9){_0x274a25[_0x5f41('0x1d')][_0x5f41('0x3e')]('Websocket\x20connection\x20error');if(!_0x34582e){_0x4696ae('Unable\x20to\x20connect:\x20'+_0x5278a9);}});});}[_0x5f41('0x3b')](){if(this[_0x5f41('0x8')]){const _0x24937b=Math[_0x5f41('0x3f')](this[_0x5f41('0x35')]);this['log'][_0x5f41('0x21')](_0x5f41('0x40')+_0x24937b+_0x5f41('0x41'));const _0x4108e7=this;setTimeout(function(){_0x4108e7[_0x5f41('0x2e')]()[_0x5f41('0x19')](function(){_0x4108e7[_0x5f41('0x1d')]['info']('Reconnect\x20attempt\x20successful');},function(){_0x4108e7[_0x5f41('0x1d')][_0x5f41('0x26')]('Reconnect\x20attempt\x20failed');});if(_0x4108e7[_0x5f41('0x35')]<=RETRY_MAX_BACKOFF){_0x4108e7[_0x5f41('0x35')]=_0x4108e7['_reconnectRetrySeconds']*0x2;}},_0x4108e7['_reconnectRetrySeconds']*0x3e8);}else{this[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x42'));}}[_0x5f41('0x43')](_0x9c1810){const _0x5b7540=_0x9c1810['data']['subscription_id'];for(let _0x4addd8 of this[_0x5f41('0x6')]){if(_0x4addd8['id']===_0x5b7540){this[_0x5f41('0x1d')]['debug'](_0x5f41('0x44')+_0x4addd8['id']+_0x5f41('0x45')+JSON[_0x5f41('0x46')](_0x9c1810['data'][_0x5f41('0x47')]));try{_0x4addd8[_0x5f41('0x2')](_0x9c1810[_0x5f41('0x39')][_0x5f41('0x47')]);}catch(_0x1cc940){this[_0x5f41('0x1d')][_0x5f41('0x26')](_0x5f41('0x48')+_0x1cc940);_0x9c1810[_0x5f41('0x49')]();}_0x9c1810[_0x5f41('0x49')]();return;}}_0x9c1810[_0x5f41('0x4a')](_0x5f41('0x4b')+_0x5b7540);}}
package/src/index.js DELETED
@@ -1,10 +0,0 @@
1
- /*
2
- * Telegenta web client library
3
- * (c) 2018 Akanto ApS
4
- *
5
- */
6
-
7
- export * from '@telegenta/common';
8
- export * from './event-client';
9
- export * from './phone-client';
10
-
@@ -1 +0,0 @@
1
- var _0x571f=['muteStateChange','holdStateChange','Exception\x20in\x20hold\x20state\x20change\x20event:\x20','whisperModeChange','Exception\x20in\x20whisper\x20mode\x20change\x20event:\x20','toISOString','callQualityReport','callEnded','Exception\x20in\x20callEnded\x20event:\x20','ontrack','Start\x20media\x20output\x20(track):','_mediaPermission','_mediaPermissionError','_UA','_connectionState','_isStarted','_eventClient','_options','_sessionCounter','_activeSessions','_remoteAudioElement','autoplay','_toneAudioElement','AUDIO','_toneTimer','_repeatToneActive','_repeatToneSequence','_toneGainProcessor','log','LogHandler','INFO','level','DEBUG','debug','JsSIP:*','disable','info','Get\x20media\x20permission','getUserMedia','then','error','start','_checkMediaPermission','warning','Phone\x20already\x20started,\x20stopping\x20first','stop','assign','_initToneGenerator','provisionToken','Using\x20provisioning\x20token\x20authorization','wssServer','wss_server','eventServer','authorizationUsername','wss_username','wss_password','wss_token','Using\x20manual\x20specified\x20credentials','InvalidOptions','Missing\x20username','password','callToken','useCallDataInfoEvent','Enabled\x20event\x20service\x20because\x20\x27useCallDataInfoEvent\x27\x20is\x20enabled','connectEventService','connect','Connected\x20to\x20event\x20server','calldata_available','subscribe','_fireCallDataInfoEvent','Event\x20callback\x20failed:\x20','Subscription\x20successful\x20ID\x20=\x20','Subscribe\x20failed:\x20','Unable\x20to\x20connect\x20to\x20event\x20server:\x20','UnableToConnect','Unable\x20to\x20connect\x20phone\x20websocket:\x20','Starting\x20phone','@telegenta.com','New\x20RTCSession','remote','newInboundSession','playRingOnIncoming','_startRepeatTone','autoBusyIncoming','keys','length','Autorejecting\x20incoming\x20call\x20','uuid','\x20because\x20there\x20is\x20already\x20active\x20calls','reject','Busy','_addSession','_setSessionState','INCOMING','_fireIncomingCallEvent','CONNECTING','connected','_setConnectionState','CONNECTED','disconnected','registered','REGISTERED','unregistered','UNREGISTERED','registrationFailed','REGISTRATION_FAILED','NotReady','Phone\x20is\x20not\x20started','Event\x20client\x20not\x20running,\x20not\x20stopping','disconnect','Unable\x20to\x20disconnect\x20event\x20client','call','_checkForConnectingCalls','NotAllowed','Unable\x20to\x20make\x20new\x20calls\x20while\x20others\x20are\x20connecting','holdAllCalls','trim','replace','Calling\x20number:\x20','split','sip:','Initiating\x20listen\x20to\x20call\x20with\x20uuid\x20','\x20on\x20media\x20switch\x20','listen-','getSessionByUUID','hasOwnProperty','options','push','hasMediaPermission','hasMediaPermissionError','browserSupported','browserIsFirefox','browserIsOpera','browserIsSafari','remoteAudioElement','playTone','Playing\x20tone\x20','\x20/\x20','\x20for\x20','\x20ms','_oscillator1','frequency','value','_oscillator2','gain','toneVolume','stopTone','Repeating\x20tone\x20sequence\x20started','_doRepeatTone','Playing\x20repeated\x20tone,\x20pos\x20=\x20','_repeatToneSequencePos','_endRepeatTone','webkitAudioContext','Audio\x20API\x20not\x20supported\x20by\x20this\x20browser','_toneStreamNode','createMediaStreamDestination','srcObject','stream','createOscillator','state','ACTIVE','hold','__containerId','Adding\x20new\x20session\x20','\x20sessions:','emit','sessionCreated','Exception\x20in\x20sessionCreated\x20event:\x20','Removing\x20session\x20','sessionRemoved','Exception\x20in\x20sessionRemoved\x20event:\x20','Session\x20','_removeSession','autoRemoveSessionTime','INITIALIZING','Connection\x20state:\x20','connectionStateChange','incomingCall','Exception\x20in\x20incomingCall\x20event:\x20','recordings','answerDuration','durationStr','createDurationString','duration','answerDurationStr','activeDurationStr','activeDuration','callDataInfo','Exception\x20in\x20callDataInfo\x20event:\x20','_callUUID','_webRTCSession','_sessionState','_isOnHold','_isMuted','_isRecording','_recordingError','_callBeginTime','_callAnswerTime','_callEndTime','_durationUpdTimerObj','_originatingNumber','_destinationNumber','_callDisposition','_localNumberName','_isListenCall','_currentReport','_answerCallTimeout','_answerCallTimer','_mediaSwitch','createUUID','Created\x20new\x20outbound\x20session\x20to:\x20','destinationNumber','X-Call-token:\x20','_phone','X-Max-cost:\x20','maximumCallCost','extraHeaders','X-CID-Number-Id:\x20','explicitCallerId','X-Short-CID-Id:\x20','explicitShortCallerId','X-Meta-Info:\x20','toString','substr','record','InvalidParameter','Recording\x20enabled\x20and\x20kept\x20for\x20','\x20days','X-Record:\x20','mediaSwitchURI','X-RMS:\x20','getOtherSessions','X-RMS:\x20sip:','Other\x20sessions\x20exist\x20but\x20media\x20switch\x20address\x20is\x20invalid','_initWebRTCSession','answerCallTimeout','_setAnswerCallTimeout','request','getHeader','X-P-UUID','X-DID-NAME','from','uri','user','Incoming\x20call\x20from\x20','X-MS','Media\x20switch\x20handling\x20call:\x20','session','sessions','candidate','type','relatedPort','Accepting\x20ICE\x20candidate:\x20','_iceCandidateTimer','ready','ICE\x20Timeout\x20(','iceGatherTimeout','\x20ms)\x20reached','connecting','_startRTCPStatsUpdateTimer','sending','CALLING','progress','originator','PROGRESS','response','status_code','Answer\x20call\x20timeout\x20after\x20','accepted','X-Recording','Call\x20is\x20being\x20prerecorded','No\x20call\x20recording\x20started\x20yet','ended','now','TERMINATED','failed','message','reason_phrase','FAILED','cause','dtmf','Session\x20DTMF','newInfo','New\x20session\x20info','_fireHoldStateEvent','ON_HOLD','unhold','muted','Microphone\x20muted','_fireMuteStateEvent','unmuted','Microphone\x20unmuted','reinvite','Session\x20reinvite','Session\x20update','getusermediafailed','Getusermedia\x20failed','connection','_handleRemoteAudio','WebRTCSession\x20object:','hangup','Hanging\x20up\x20call','terminate','Hanging\x20up\x20call\x20with\x20disposition\x20','_manualDisposition','X-HDISP:\x20','answer','stun:stun.l.google.com:19302','Rejected\x20call','Rejecting\x20call','direction','LISTEN','incoming','INBOUND','Call\x20direction\x20is\x20OUTBOUND','OUTBOUND','Unknown\x20call\x20direction:\x20','startRecording','Record:\x20on','Request\x20start\x20recording','once','succeeded','Recording\x20started\x20successfully','Recording\x20start\x20failed:\x20','sendInfo','application/info','stopRecording','Record:\x20off','Request\x20stop\x20recording','Recording\x20stopped\x20successfully','Exception\x20in\x20recordingStateChange\x20event:\x20','recordingStateChange','isRecording','muteMic','Mute\x20microphone','mute','unmuteMic','Unmute\x20microphone','unmute','isMuted','Hold\x20call','isOnHold','sendDTMF','Invalid\x20DTMF\x20code','Sending\x20DTMF:\x20','Mic\x20already\x20muted,\x20just\x20sending\x20DTMF','Mute\x20mic\x20while\x20sending\x20DTMF','Unmute\x20mic\x20after\x20DTMF','transfer','Transferring\x20','\x20=>\x20','refer','requestSucceeded','Transfer\x20completed\x20successfully','requestFailed','Transfer\x20rejected:\x20','Transfer\x20failed:\x20','playback','Event\x20service\x20not\x20enabled','Playback\x20media\x20file\x20','\x20hangup\x20after\x20','call_command','PLAYBACK','setWhisperMode','Call\x20is\x20not\x20correct\x20type\x20(listen)','Invalid\x20mode','_fireWhisperModeChangeEvent','_startDurationUpdateTimer','Exception\x20in\x20call\x20duration\x20update\x20event:\x20','_rtcpStatsTimer','getStats','values','outbound-rtp','outboundPacketsSent','packetsSent','outboundBytesSent','bytesSent','inbound-rtp','inboundPacketsReceived','packetsReceived','bytesReceived','inboundBytesReceived','inboundPacketsLost','packetsLost','inboundJitter','jitter','remote-inbound-rtp','outboundPacketsLost','outboundJitter','roundTripTime','_calcReportMetrics','callQualityReportUpdate','Exception\x20in\x20call\x20quality\x20report\x20update\x20event:\x20','outboundPacketLossPct','inboundPacketLossPct','effectiveLatency','rFactor','Bad','qualityString','Fair','Good','Excellent','Error','Session\x20state:\x20','sessionStateChange','NORMAL','_callFinished','Unavailable','TEMP_UNAVAIL','playSignalTones','INVALID_NUMBER','Canceled','NO_ANSWER','Rejected','REJECTED','BARRED','BUSY','Call\x20finished','_fireCallEndedEvent','_sessionTerminated','Setting\x20answer\x20call\x20timeout\x20to:\x20'];(function(_0x7ebfd7,_0x4048a2){var _0x38b4df=function(_0x3fa5a8){while(--_0x3fa5a8){_0x7ebfd7['push'](_0x7ebfd7['shift']());}};_0x38b4df(++_0x4048a2);}(_0x571f,0x1b0));var _0x2b52=function(_0x538dac,_0x480a7e){_0x538dac=_0x538dac-0x0;var _0x3a6337=_0x571f[_0x538dac];return _0x3a6337;};import _0x1a44b7 from'events';import _0x1f9aab from'jssip';import{Logger,Exceptions,Tools}from'@telegenta/common';import{EventClient}from'./event-client';import _0x574636 from'camelcase-keys';const options={'wssServer':'wss://api.telegenta.com/sip/','eventServer':'wss://api.telegenta.com/es/','provisionToken':null,'authorizationUsername':null,'password':null,'callToken':null,'register':!![],'iceGatherTimeout':0xbb8,'playSignalTones':!![],'logger':null,'logLevel':0x3,'connectEventService':![],'useCallDataInfoEvent':![],'toneVolume':0.3,'autoBusyIncoming':!![],'autoRemoveSessionTime':0xbb8,'playRingOnIncoming':!![],'playCallInitializedTone':![]};const DTMF_FREQUENCY_TABLE={'1':[0x4b9,0x2b9],'2':[0x538,0x2b9],'3':[0x5c5,0x2b9],'a':[0x661,0x2b9],'4':[0x4b9,0x302],'5':[0x538,0x302],'6':[0x5c5,0x302],'b':[0x661,0x302],'7':[0x4b9,0x354],'8':[0x538,0x354],'9':[0x5c5,0x354],'c':[0x661,0x354],'*':[0x4b9,0x3ad],'0':[0x538,0x3ad],'#':[0x5c5,0x3ad],'d':[0x661,0x3ad]};const ST_TEMP_UNAVAIL=[{'d':0xfa,'f1':0x1a9,'f2':0x0,'g':0xfa}];const ST_BUSY=[{'d':0x1f4,'f1':0x1a9,'f2':0x0,'g':0x1f4}];const ST_INVALID_NUMBER=[{'d':0x14d,'f1':0x3b6,'f2':0x0,'g':0x0},{'d':0x14d,'f1':0x578,'f2':0x0,'g':0x0},{'d':0x14d,'f1':0x708,'f2':0x0,'g':0x3e8}];const ST_CALLINIT=[{'d':0xc8,'f1':0x1f4,'f2':0x0,'g':0x0},{'d':0xc8,'f1':0x2bc,'f2':0x0,'g':0x1388}];const ST_RINGBACK=[{'d':0x3e8,'f1':0x1a9,'f2':0x0,'g':0xfa0}];const ST_INCOMING=[{'d':0x96,'f1':0x190,'f2':0x0,'g':0x0},{'d':0x96,'f1':0x258,'f2':0x0,'g':0x0},{'d':0x96,'f1':0x190,'f2':0x0,'g':0x0},{'d':0x96,'f1':0x258,'f2':0x0,'g':0x0},{'d':0x96,'f1':0x190,'f2':0x0,'g':0x0},{'d':0x96,'f1':0x258,'f2':0x0,'g':0xbb8}];export class Phone extends _0x1a44b7{constructor(logger=null){super();this[_0x2b52('0x0')]=![];this[_0x2b52('0x1')]=![];this[_0x2b52('0x2')]=null;this[_0x2b52('0x3')]=null;this[_0x2b52('0x4')]=![];this[_0x2b52('0x5')]=null;this[_0x2b52('0x6')]=null;this[_0x2b52('0x7')]=0x0;this[_0x2b52('0x8')]={};this[_0x2b52('0x9')]=document['createElement']('AUDIO');this[_0x2b52('0x9')][_0x2b52('0xa')]=!![];this[_0x2b52('0xb')]=document['createElement'](_0x2b52('0xc'));this[_0x2b52('0xb')][_0x2b52('0xa')]=!![];this[_0x2b52('0xd')]=null;this[_0x2b52('0xe')]=![];this[_0x2b52('0xf')]=[];this['_repeatToneSequencePos']=0x0;this[_0x2b52('0x10')]=null;this['_oscillator1']=null;this['_oscillator2']=null;this[_0x2b52('0x11')]=logger?logger:new Logger[(_0x2b52('0x12'))](Logger['LOGLVL'][_0x2b52('0x13')]);if(this[_0x2b52('0x11')][_0x2b52('0x14')]===Logger['LOGLVL'][_0x2b52('0x15')]){_0x1f9aab[_0x2b52('0x16')]['disable'](_0x2b52('0x17'));}else{_0x1f9aab[_0x2b52('0x16')][_0x2b52('0x18')]('JsSIP:*');}}['prepareMedia'](){this['log'][_0x2b52('0x19')](_0x2b52('0x1a'));const self=this;const constraints={'audio':!![],'video':![]};return new Promise(function(resolve,reject){navigator['mediaDevices'][_0x2b52('0x1b')](constraints)[_0x2b52('0x1c')](()=>{self['_mediaPermission']=!![];self[_0x2b52('0x1')]=![];self[_0x2b52('0x11')][_0x2b52('0x19')]('Media\x20permission\x20granted');resolve();},err=>{self[_0x2b52('0x0')]=![];self['_mediaPermissionError']=!![];self['log'][_0x2b52('0x1d')]('Denied\x20media\x20permission:\x20'+err);reject(err);});});}[_0x2b52('0x1e')](phoneOptions){this[_0x2b52('0x1f')]();if(this[_0x2b52('0x4')]){this[_0x2b52('0x11')][_0x2b52('0x20')](_0x2b52('0x21'));this[_0x2b52('0x22')]();}this[_0x2b52('0x6')]=Object[_0x2b52('0x23')](options,phoneOptions);this[_0x2b52('0x24')]();if(this[_0x2b52('0x6')]['provisionToken']){let pt=null;try{pt=JSON['parse'](atob(this[_0x2b52('0x6')][_0x2b52('0x25')]));}catch(_0x46f239){throw new Exceptions['InvalidOptions'](_0x2b52('0x25'),'Invalid\x20token');}this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x26'));this[_0x2b52('0x6')][_0x2b52('0x27')]=pt[_0x2b52('0x28')];this[_0x2b52('0x6')][_0x2b52('0x29')]=pt['event_server'];this[_0x2b52('0x6')][_0x2b52('0x2a')]=pt[_0x2b52('0x2b')];this[_0x2b52('0x6')]['password']=pt[_0x2b52('0x2c')];this['_options']['callToken']=pt[_0x2b52('0x2d')];}else{this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x2e'));if(!this[_0x2b52('0x6')][_0x2b52('0x2a')]){throw new Exceptions[(_0x2b52('0x2f'))](_0x2b52('0x2a'),_0x2b52('0x30'));}if(!this[_0x2b52('0x6')]['password']){throw new Exceptions[(_0x2b52('0x2f'))](_0x2b52('0x31'),'Missing\x20password');}if(!this[_0x2b52('0x6')]['callToken']){throw new Exceptions[(_0x2b52('0x2f'))](_0x2b52('0x32'),'Missing\x20call\x20token');}}if(this[_0x2b52('0x6')][_0x2b52('0x33')]&&!this[_0x2b52('0x6')]['connectEventService']){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x34'));this[_0x2b52('0x6')][_0x2b52('0x35')]=!![];}if(this[_0x2b52('0x6')]['connectEventService']){this[_0x2b52('0x5')]=new EventClient(this[_0x2b52('0x11')]);this[_0x2b52('0x5')][_0x2b52('0x36')](this[_0x2b52('0x6')]['eventServer'])['then'](()=>{this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x37'));if(this[_0x2b52('0x6')][_0x2b52('0x33')]){let eventSpec={'event_name':_0x2b52('0x38'),'call_token':this['_options'][_0x2b52('0x32')]};this[_0x2b52('0x5')][_0x2b52('0x39')](eventSpec,data=>{try{this['log'][_0x2b52('0x16')]('Received\x20remote\x20call\x20data\x20info');this[_0x2b52('0x11')]['debug'](data);this[_0x2b52('0x3a')](data);}catch(_0x5884cb){this[_0x2b52('0x11')]['error'](_0x2b52('0x3b')+_0x5884cb);}})['then'](subscriptionId=>{this['log']['info'](_0x2b52('0x3c')+subscriptionId);},reason=>{this['log']['error'](_0x2b52('0x3d')+reason);});}},reason=>{this[_0x2b52('0x11')][_0x2b52('0x1d')](_0x2b52('0x3e')+reason);});}let wsSocket=null;try{wsSocket=new _0x1f9aab['WebSocketInterface'](this[_0x2b52('0x6')][_0x2b52('0x27')]);}catch(_0x57272f){throw new Exceptions[(_0x2b52('0x3f'))](_0x2b52('0x40')+_0x57272f);}this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x41'));this[_0x2b52('0x11')][_0x2b52('0x16')](this[_0x2b52('0x6')]);this[_0x2b52('0x2')]=new _0x1f9aab['UA']({'sockets':[wsSocket],'authorization_user':this[_0x2b52('0x6')][_0x2b52('0x2a')],'password':this['_options'][_0x2b52('0x31')],'register':this['_options']['register'],'display_name':this[_0x2b52('0x6')]['authorizationUsername'],'uri':this[_0x2b52('0x6')][_0x2b52('0x2a')]+_0x2b52('0x42'),'session_timers':![]});const self=this;this['_UA']['on']('newRTCSession',function(data){self[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x43'));if(data['originator']===_0x2b52('0x44')){const session=new Session(self);session[_0x2b52('0x45')](data);if(self['_options'][_0x2b52('0x46')]){self[_0x2b52('0x47')](ST_INCOMING);}if(self['_options'][_0x2b52('0x48')]){if(Object[_0x2b52('0x49')](self[_0x2b52('0x8')])[_0x2b52('0x4a')]>0x0){self[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x4b')+session[_0x2b52('0x4c')]+_0x2b52('0x4d'));session[_0x2b52('0x4e')](0x1e6,_0x2b52('0x4f'));return;}else{self[_0x2b52('0x11')][_0x2b52('0x16')]('There\x20are\x20no\x20other\x20sessions,\x20adding\x20incoming\x20call');}}self[_0x2b52('0x50')](session);session[_0x2b52('0x51')](_0x2b52('0x52'));self[_0x2b52('0x53')](session);}});this[_0x2b52('0x2')]['on']('connecting',function(){self['_setConnectionState'](_0x2b52('0x54'));});this[_0x2b52('0x2')]['on'](_0x2b52('0x55'),function(){self[_0x2b52('0x56')](_0x2b52('0x57'));});this[_0x2b52('0x2')]['on'](_0x2b52('0x58'),function(){self[_0x2b52('0x56')]('DISCONNECTED');});this[_0x2b52('0x2')]['on'](_0x2b52('0x59'),function(){self['_setConnectionState'](_0x2b52('0x5a'));});this['_UA']['on'](_0x2b52('0x5b'),function(){self[_0x2b52('0x56')](_0x2b52('0x5c'));});this[_0x2b52('0x2')]['on'](_0x2b52('0x5d'),function(){self['_setConnectionState'](_0x2b52('0x5e'));});this[_0x2b52('0x2')][_0x2b52('0x1e')]();this[_0x2b52('0x4')]=!![];this[_0x2b52('0x11')][_0x2b52('0x19')]('Successfully\x20started\x20phone');}[_0x2b52('0x22')](){if(!this[_0x2b52('0x4')]){throw new Exceptions[(_0x2b52('0x5f'))](_0x2b52('0x60'));}this[_0x2b52('0x2')]['removeAllListeners']();this[_0x2b52('0x2')][_0x2b52('0x22')]();delete this[_0x2b52('0x2')];if(!this[_0x2b52('0x5')]){this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x61'));return;}try{this[_0x2b52('0x5')][_0x2b52('0x62')]();delete this['_eventClient'];}catch(_0x56956c){this[_0x2b52('0x11')]['warning'](_0x2b52('0x63'));}this[_0x2b52('0x4')]=![];this[_0x2b52('0x11')][_0x2b52('0x19')]('Phone\x20client\x20successfully\x20stopped');}[_0x2b52('0x64')](number,params={}){if(!this[_0x2b52('0x4')]){throw new Exceptions[(_0x2b52('0x5f'))](_0x2b52('0x60'));}if(this[_0x2b52('0x65')]()){throw Exceptions[_0x2b52('0x66')](_0x2b52('0x67'));}this[_0x2b52('0x68')]();const callParams=Object[_0x2b52('0x23')]({'record':![],'maximumCallCost':0x0,'answerCallTimeout':0x0,'explicitCallerId':null,'explicitShortCallerId':null,'metaInfo':null,'_isListenCall':![]},params);number=number[_0x2b52('0x69')]()[_0x2b52('0x6a')](/ |\(|\)/g,'');this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x6b')+number);let session=new Session(this);session['newOutboundSession'](number,callParams);this[_0x2b52('0x50')](session);return session;}['listen'](listenKey){const s=listenKey[_0x2b52('0x6c')]('@');let callUUID=s[0x0];let mediaSwitch=_0x2b52('0x6d')+s[0x1];this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x6e')+callUUID+_0x2b52('0x6f')+mediaSwitch);return this[_0x2b52('0x64')](_0x2b52('0x70')+callUUID,{'mediaSwitchURI':mediaSwitch,'_isListenCall':!![]});}[_0x2b52('0x71')](uuid){for(let key in this[_0x2b52('0x8')]){if(this['_activeSessions'][_0x2b52('0x72')](key)){if(this[_0x2b52('0x8')][key][_0x2b52('0x4c')]===uuid){return this[_0x2b52('0x8')][key];}}}return null;}get[_0x2b52('0x73')](){return this['_options'];}get['sessions'](){let s=[];for(let key in this[_0x2b52('0x8')]){if(this[_0x2b52('0x8')][_0x2b52('0x72')](key)){s[_0x2b52('0x74')](this[_0x2b52('0x8')][key]);}}return s;}get[_0x2b52('0x75')](){return this[_0x2b52('0x0')];}get[_0x2b52('0x76')](){return this[_0x2b52('0x1')];}get['isStarted'](){return this[_0x2b52('0x4')];}get[_0x2b52('0x77')](){return Tools['browserIsChrome']()||Tools[_0x2b52('0x78')]()||Tools[_0x2b52('0x79')]()||Tools[_0x2b52('0x7a')]();}get[_0x2b52('0x7b')](){return this[_0x2b52('0x9')];}[_0x2b52('0x7c')](duration,freq1,freq2=0x0,callback=null){this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x7d')+freq1+_0x2b52('0x7e')+freq2+_0x2b52('0x7f')+duration+_0x2b52('0x80'));this[_0x2b52('0x81')][_0x2b52('0x82')][_0x2b52('0x83')]=freq1;this[_0x2b52('0x84')][_0x2b52('0x82')][_0x2b52('0x83')]=freq2;this[_0x2b52('0x10')][_0x2b52('0x85')][_0x2b52('0x83')]=this['_options'][_0x2b52('0x86')];const self=this;this['_toneTimer']=setTimeout(function(){self[_0x2b52('0x87')]();if(callback){callback();}},duration);}[_0x2b52('0x87')](){this[_0x2b52('0x81')][_0x2b52('0x82')][_0x2b52('0x83')]=0x0;this[_0x2b52('0x84')]['frequency'][_0x2b52('0x83')]=0x0;this['_toneGainProcessor'][_0x2b52('0x85')][_0x2b52('0x83')]=0x0;clearTimeout(this[_0x2b52('0xd')]);}[_0x2b52('0x47')](sequences){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x88'));this['log'][_0x2b52('0x16')](sequences);this[_0x2b52('0xf')]=sequences;this['_repeatToneSequencePos']=0x0;this[_0x2b52('0xe')]=!![];this[_0x2b52('0x89')]();}[_0x2b52('0x89')](){if(this[_0x2b52('0xe')]){this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x8a')+this['_repeatToneSequencePos']);let toneDef=this[_0x2b52('0xf')][this[_0x2b52('0x8b')]];this[_0x2b52('0x8b')]++;if(this[_0x2b52('0x8b')]===this[_0x2b52('0xf')][_0x2b52('0x4a')]){this[_0x2b52('0x8b')]=0x0;}const self=this;this[_0x2b52('0x7c')](toneDef['d'],toneDef['f1'],toneDef['f2'],function(){setTimeout(self[_0x2b52('0x89')]['bind'](self),toneDef['g']);});}}[_0x2b52('0x8c')](){if(this[_0x2b52('0xe')]){this[_0x2b52('0x11')][_0x2b52('0x19')]('Repeating\x20tone\x20stopped');this['_repeatToneActive']=![];this[_0x2b52('0x87')]();}}['_initToneGenerator'](){const AudioContext=window['AudioContext']||window[_0x2b52('0x8d')]||![];if(!AudioContext){throw new Exceptions['NotAllowed'](_0x2b52('0x8e'));}const ctx=new AudioContext();this[_0x2b52('0x8f')]=ctx[_0x2b52('0x90')]();this[_0x2b52('0xb')][_0x2b52('0x91')]=this[_0x2b52('0x8f')][_0x2b52('0x92')];this[_0x2b52('0x10')]=ctx['createGain']();this[_0x2b52('0x10')]['gain'][_0x2b52('0x83')]=0x0;this['_toneGainProcessor'][_0x2b52('0x36')](this[_0x2b52('0x8f')]);this[_0x2b52('0x81')]=ctx[_0x2b52('0x93')]();this['_oscillator1']['connect'](this[_0x2b52('0x10')]);this[_0x2b52('0x81')][_0x2b52('0x82')][_0x2b52('0x83')]=0x0;this[_0x2b52('0x81')][_0x2b52('0x1e')]();this['_oscillator2']=ctx[_0x2b52('0x93')]();this[_0x2b52('0x84')]['connect'](this[_0x2b52('0x10')]);this['_oscillator2'][_0x2b52('0x82')][_0x2b52('0x83')]=0x0;this[_0x2b52('0x84')][_0x2b52('0x1e')]();}['holdAllCalls'](){this[_0x2b52('0x11')]['info']('Holding\x20all\x20active\x20sessions');if(this[_0x2b52('0x65')]()){throw Exceptions[_0x2b52('0x66')]('A\x20session\x20is\x20currently\x20connecting');}for(let key in this[_0x2b52('0x8')]){if(this['_activeSessions'][_0x2b52('0x72')](key)){let session=this[_0x2b52('0x8')][key];if(session[_0x2b52('0x94')]===_0x2b52('0x95')){session[_0x2b52('0x96')]();}}}}['_addSession'](session){this[_0x2b52('0x7')]++;session[_0x2b52('0x97')]=this[_0x2b52('0x7')];this['log'][_0x2b52('0x19')](_0x2b52('0x98')+session[_0x2b52('0x97')]+':\x20'+session[_0x2b52('0x4c')]);this['_activeSessions'][session[_0x2b52('0x97')]]=session;this['log'][_0x2b52('0x16')]('We\x20now\x20have\x20'+Object[_0x2b52('0x49')](this['_activeSessions'])['length']+_0x2b52('0x99'));this[_0x2b52('0x11')][_0x2b52('0x16')](this['_activeSessions']);try{this[_0x2b52('0x9a')](_0x2b52('0x9b'),{'session':session});}catch(_0x48e4f5){this[_0x2b52('0x11')][_0x2b52('0x1d')](_0x2b52('0x9c')+_0x48e4f5);}}['_removeSession'](session){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x9d')+session[_0x2b52('0x97')]+':\x20'+session[_0x2b52('0x4c')]);try{this['emit'](_0x2b52('0x9e'),{'session':session});}catch(_0x2847a2){this[_0x2b52('0x11')][_0x2b52('0x1d')](_0x2b52('0x9f')+_0x2847a2);}delete this['_activeSessions'][session[_0x2b52('0x97')]];this[_0x2b52('0x11')][_0x2b52('0x16')]('We\x20now\x20have\x20'+Object[_0x2b52('0x49')](this['_activeSessions'])[_0x2b52('0x4a')]+'\x20sessions');this[_0x2b52('0x11')][_0x2b52('0x16')](this['_activeSessions']);this[_0x2b52('0x8c')]();}['_sessionTerminated'](session){this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0xa0')+session[_0x2b52('0x4c')]+'\x20terminated,\x20removing\x20in\x20'+this[_0x2b52('0x6')]['autoRemoveSessionTime']+_0x2b52('0x80'));const self=this;setTimeout(function(){self[_0x2b52('0xa1')](session);},this[_0x2b52('0x6')][_0x2b52('0xa2')]);}[_0x2b52('0x65')](){for(let key in this[_0x2b52('0x8')]){if(this[_0x2b52('0x8')][_0x2b52('0x72')](key)){let session=this[_0x2b52('0x8')][key];if(session[_0x2b52('0x94')]===_0x2b52('0xa3')||session[_0x2b52('0x94')]==='CALLING'||session[_0x2b52('0x94')]==='PROGRESS'||session[_0x2b52('0x94')]==='INCOMING'){return!![];}}}return![];}[_0x2b52('0x56')](state){this[_0x2b52('0x11')]['info'](_0x2b52('0xa4')+state);this[_0x2b52('0x3')]=state;try{this['emit'](_0x2b52('0xa5'),{'state':state});}catch(_0x46efb6){this[_0x2b52('0x11')]['error']('Exception\x20in\x20connectionStateChange\x20event:\x20'+_0x46efb6);}}[_0x2b52('0x53')](session){try{this[_0x2b52('0x9a')](_0x2b52('0xa6'),session);}catch(_0x1fb729){this['log'][_0x2b52('0x1d')](_0x2b52('0xa7')+_0x1fb729);}}[_0x2b52('0x3a')](eventData=null){let e;e=_0x574636(eventData);e[_0x2b52('0xa8')]=_0x574636(eventData[_0x2b52('0xa8')]);e['duration']=e['duration']*0x3e8;e['answerDuration']=e[_0x2b52('0xa9')]*0x3e8;e['activeDuration']=e['activeDuration']*0x3e8;e[_0x2b52('0xaa')]=Tools[_0x2b52('0xab')](e[_0x2b52('0xac')]);e[_0x2b52('0xad')]=e[_0x2b52('0xa9')]?Tools[_0x2b52('0xab')](e['answerDuration']):'';e[_0x2b52('0xae')]=e['activeDuration']?Tools['createDurationString'](e[_0x2b52('0xaf')]):'';try{this[_0x2b52('0x9a')](_0x2b52('0xb0'),e);}catch(_0x14d3a3){this['log'][_0x2b52('0x1d')](_0x2b52('0xb1')+_0x14d3a3);}}[_0x2b52('0x1f')](){if(!this[_0x2b52('0x0')]){throw new Exceptions['MediaNotPrepared']();}}}export class Session extends _0x1a44b7{constructor(phone){super();this['_phone']=phone;this[_0x2b52('0x11')]=phone[_0x2b52('0x11')];this[_0x2b52('0xb2')]=null;this[_0x2b52('0xb3')]=null;this[_0x2b52('0xb4')]=null;this['_iceCandidateTimer']=null;this[_0x2b52('0xb5')]=![];this[_0x2b52('0xb6')]=![];this[_0x2b52('0xb7')]=![];this[_0x2b52('0xb8')]=null;this[_0x2b52('0xb9')]=null;this[_0x2b52('0xba')]=null;this[_0x2b52('0xbb')]=null;this[_0x2b52('0xbc')]=null;this[_0x2b52('0xbd')]=null;this[_0x2b52('0xbe')]=null;this[_0x2b52('0xbf')]=null;this[_0x2b52('0xc0')]=null;this[_0x2b52('0xc1')]=![];this['_whisperMode']=null;this['_manualDisposition']=null;this['_rtcpStatsTimer']=null;this[_0x2b52('0xc2')]=null;this[_0x2b52('0xc3')]=0x0;this[_0x2b52('0xc4')]=null;this[_0x2b52('0xc5')]=null;}['newOutboundSession'](number,callParams){this[_0x2b52('0xb2')]=Tools[_0x2b52('0xc6')]();this['log'][_0x2b52('0x16')](_0x2b52('0xc7')+number+'\x20['+this[_0x2b52('0xb2')]+']');this[_0x2b52('0xc8')]=number;let options={'mediaConstraints':{'audio':!![],'video':![]},'pcConfig':{'iceServers':[{'urls':['stun:stun.l.google.com:19302']}]},'extraHeaders':[_0x2b52('0xc9')+this[_0x2b52('0xca')]['options']['callToken'],'X-P-UUID:\x20'+this[_0x2b52('0xb2')],_0x2b52('0xcb')+callParams[_0x2b52('0xcc')]]};if(callParams['explicitCallerId']){options[_0x2b52('0xcd')][_0x2b52('0x74')](_0x2b52('0xce')+callParams[_0x2b52('0xcf')]);}if(callParams['explicitShortCallerId']){options[_0x2b52('0xcd')][_0x2b52('0x74')](_0x2b52('0xd0')+callParams[_0x2b52('0xd1')]);}if(callParams['metaInfo']){options[_0x2b52('0xcd')]['push'](_0x2b52('0xd2')+encodeURI(callParams['metaInfo'][_0x2b52('0xd3')]()[_0x2b52('0xd4')](0x0,0xff)));}if(callParams['record']){if(isNaN(callParams[_0x2b52('0xd5')])){throw new Exceptions[(_0x2b52('0xd6'))]('Record\x20parameter\x20must\x20be\x20a\x20number');}this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0xd7')+callParams[_0x2b52('0xd5')]+_0x2b52('0xd8'));options[_0x2b52('0xcd')]['push'](_0x2b52('0xd9')+callParams[_0x2b52('0xd5')]);this['_isRecording']=!![];}else{this[_0x2b52('0xb7')]=![];}this['_isListenCall']=callParams[_0x2b52('0xc1')];if(callParams[_0x2b52('0xda')]){this[_0x2b52('0x11')][_0x2b52('0x16')]('Requesting\x20specific\x20media\x20switch\x20'+callParams[_0x2b52('0xda')]);options[_0x2b52('0xcd')][_0x2b52('0x74')](_0x2b52('0xdb')+callParams[_0x2b52('0xda')]);}else{const otherSessions=this[_0x2b52('0xdc')]();if(otherSessions[_0x2b52('0x4a')]>0x0){if(otherSessions[0x0]['_mediaSwitch']){this['log'][_0x2b52('0x16')]('Requesting\x20call\x20grouping\x20on\x20media\x20switch\x20'+otherSessions[0x0][_0x2b52('0xc5')]);options[_0x2b52('0xcd')][_0x2b52('0x74')](_0x2b52('0xdd')+otherSessions[0x0][_0x2b52('0xc5')]);}else{this[_0x2b52('0x11')][_0x2b52('0x20')](_0x2b52('0xde'));}}else{this[_0x2b52('0x11')][_0x2b52('0x16')]('No\x20other\x20active\x20calls,\x20no\x20media\x20switch\x20grouping\x20requested');}}const uri='sip:'+number+_0x2b52('0x42');try{this[_0x2b52('0xdf')](this[_0x2b52('0xca')]['_UA'][_0x2b52('0x64')](uri,options));}catch(_0x947053){this['log'][_0x2b52('0x1d')]('Error\x20starting\x20call:',_0x947053);return null;}if(callParams[_0x2b52('0xe0')]){this[_0x2b52('0xe1')](callParams[_0x2b52('0xe0')]);}}[_0x2b52('0x45')](newSessionRequest){this[_0x2b52('0xb2')]=newSessionRequest[_0x2b52('0xe2')][_0x2b52('0xe3')](_0x2b52('0xe4'),0x0);this[_0x2b52('0xbe')]=newSessionRequest[_0x2b52('0xe2')]['getHeader']('X-DID',0x0);this[_0x2b52('0xc0')]=unescape(newSessionRequest[_0x2b52('0xe2')][_0x2b52('0xe3')](_0x2b52('0xe5'),0x0));this['_originName']=newSessionRequest[_0x2b52('0xe2')][_0x2b52('0xe6')]['display_name'];this[_0x2b52('0xbd')]=newSessionRequest['request'][_0x2b52('0xe6')][_0x2b52('0xe7')][_0x2b52('0xe8')];this['log'][_0x2b52('0x19')](_0x2b52('0xe9')+this[_0x2b52('0xbd')]+'\x20['+this[_0x2b52('0xb2')]+']');this[_0x2b52('0x11')][_0x2b52('0x16')](newSessionRequest);this[_0x2b52('0xc5')]=newSessionRequest['request'][_0x2b52('0xe3')](_0x2b52('0xea'));this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0xeb')+this[_0x2b52('0xc5')]);this[_0x2b52('0xdf')](newSessionRequest[_0x2b52('0xec')]);}[_0x2b52('0xdc')](){const allSessions=this[_0x2b52('0xca')][_0x2b52('0xed')];let s=[];for(let key in allSessions){if(allSessions[key]){if(allSessions[key]['__containerId']!==this[_0x2b52('0x97')]){s[_0x2b52('0x74')](allSessions[key]);}}}return s;}['_initWebRTCSession'](webRTCSession){this['_webRTCSession']=webRTCSession;this['_callBeginTime']=Date['now']();const self=this;this[_0x2b52('0xb3')]['on']('icecandidate',function(event){const c=event['candidate'];self[_0x2b52('0x11')][_0x2b52('0x16')]('Got\x20ICE\x20candidate:\x20'+c[_0x2b52('0xee')]);if(c[_0x2b52('0xef')]==='srflx'&&c['relatedAddress']!==null&&c[_0x2b52('0xf0')]!==null){self[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0xf1')+c[_0x2b52('0xee')]);if(self[_0x2b52('0xf2')]!=null)clearTimeout(self[_0x2b52('0xf2')]);event[_0x2b52('0xf3')]();}else{if(self['_iceCandidateTimer']!=null)clearTimeout(self[_0x2b52('0xf2')]);self[_0x2b52('0xf2')]=setTimeout(function(data){self['log'][_0x2b52('0x16')](_0x2b52('0xf4')+self[_0x2b52('0xca')][_0x2b52('0x73')][_0x2b52('0xf5')]+_0x2b52('0xf6'));data['ready']();},self[_0x2b52('0xca')][_0x2b52('0x73')]['iceGatherTimeout'],event);}});this['_webRTCSession']['on'](_0x2b52('0xf7'),function(){self['_startDurationUpdateTimer']();self[_0x2b52('0xf8')]();self[_0x2b52('0x51')]('INITIALIZING');});this[_0x2b52('0xb3')]['on'](_0x2b52('0xf9'),function(){if(self[_0x2b52('0xca')][_0x2b52('0x73')]['playCallInitializedTone']){self['_phone'][_0x2b52('0x47')](ST_CALLINIT);}self[_0x2b52('0x51')](_0x2b52('0xfa'));});this[_0x2b52('0xb3')]['on'](_0x2b52('0xfb'),function(data){if(data[_0x2b52('0xfc')]==='remote'){self[_0x2b52('0x51')](_0x2b52('0xfd'),{'code':data[_0x2b52('0xfe')][_0x2b52('0xff')]});self[_0x2b52('0xca')][_0x2b52('0x8c')]();if(data[_0x2b52('0xfe')][_0x2b52('0xff')]===0xb4){self[_0x2b52('0xca')][_0x2b52('0x47')](ST_RINGBACK);}if(self[_0x2b52('0xc3')]){self['_answerCallTimer']=setTimeout(function(){self[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x100')+self[_0x2b52('0xc3')]+'\x20seconds');try{self['hangup']();}catch(_0x37f186){self['log'][_0x2b52('0x19')]('No\x20active\x20session,\x20ignoring\x20answer\x20call\x20timeout');}},self[_0x2b52('0xc3')]*0x3e8);}}});this['_webRTCSession']['on'](_0x2b52('0x101'),function(data){self[_0x2b52('0xca')][_0x2b52('0x8c')]();self[_0x2b52('0xba')]=Date['now']();if(self[_0x2b52('0xc3')]){clearTimeout(self[_0x2b52('0xc4')]);self[_0x2b52('0xc3')]=0x0;}if(data['originator']==='remote'){const recState=data[_0x2b52('0xfe')]['getHeader'](_0x2b52('0x102'));if(recState==='true'){self[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x103'));}else{self[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x104'));}self[_0x2b52('0xc5')]=data[_0x2b52('0xfe')][_0x2b52('0xe3')](_0x2b52('0xea'));self[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0xeb')+self['_mediaSwitch']);}});this[_0x2b52('0xb3')]['on']('confirmed',function(){self[_0x2b52('0x51')](_0x2b52('0x95'));});this[_0x2b52('0xb3')]['on'](_0x2b52('0x105'),function(){self[_0x2b52('0xca')]['_endRepeatTone']();self[_0x2b52('0xbb')]=Date[_0x2b52('0x106')]();if(self[_0x2b52('0xc3')]){clearTimeout(self[_0x2b52('0xc4')]);}self[_0x2b52('0x51')](_0x2b52('0x107'));});this[_0x2b52('0xb3')]['on'](_0x2b52('0x108'),function(data){self[_0x2b52('0xca')][_0x2b52('0x8c')]();self[_0x2b52('0xbb')]=Date[_0x2b52('0x106')]();if(self[_0x2b52('0xc3')]){clearTimeout(self['_answerCallTimer']);}let m;if(data[_0x2b52('0x109')]){m=data['message'][_0x2b52('0xff')]+'\x20'+data['message'][_0x2b52('0x10a')];}else{m='';}self['_setSessionState'](_0x2b52('0x10b'),{'cause':data[_0x2b52('0x10c')],'message':m});});this[_0x2b52('0xb3')]['on'](_0x2b52('0x10d'),function(data){self[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x10e'),data);});this[_0x2b52('0xb3')]['on'](_0x2b52('0x10f'),function(data){self['log'][_0x2b52('0x16')](_0x2b52('0x110'),data);});this[_0x2b52('0xb3')]['on']('hold',function(){self['_isOnHold']=!![];self[_0x2b52('0x111')]();self['_setSessionState'](_0x2b52('0x112'));});this['_webRTCSession']['on'](_0x2b52('0x113'),function(){self['_isOnHold']=![];self[_0x2b52('0x111')]();self[_0x2b52('0x51')](_0x2b52('0x95'));});this[_0x2b52('0xb3')]['on'](_0x2b52('0x114'),function(data){self['log']['debug'](_0x2b52('0x115'),data);self[_0x2b52('0xb6')]=!![];self[_0x2b52('0x116')]();});this['_webRTCSession']['on'](_0x2b52('0x117'),function(data){self[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x118'),data);self[_0x2b52('0xb6')]=![];self[_0x2b52('0x116')]();});this['_webRTCSession']['on'](_0x2b52('0x119'),function(data){self[_0x2b52('0x11')]['debug'](_0x2b52('0x11a'),data);});this[_0x2b52('0xb3')]['on']('update',function(data){self['log']['debug'](_0x2b52('0x11b'),data);});this['_webRTCSession']['on'](_0x2b52('0x11c'),function(data){self[_0x2b52('0x11')]['error'](_0x2b52('0x11d'),data);});if(self[_0x2b52('0xb3')][_0x2b52('0x11e')]){self[_0x2b52('0x11f')](self[_0x2b52('0xb3')]);}this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x120'));this[_0x2b52('0x11')][_0x2b52('0x16')](this);}[_0x2b52('0x121')](disposition=null){if(!disposition){this['log'][_0x2b52('0x19')](_0x2b52('0x122'));this['_webRTCSession'][_0x2b52('0x123')]();}else{this[_0x2b52('0x11')]['info'](_0x2b52('0x124')+disposition);this[_0x2b52('0x125')]=disposition;this['_webRTCSession'][_0x2b52('0x123')]({'extraHeaders':[_0x2b52('0x126')+disposition]});}}[_0x2b52('0x127')](metaInfo=null){let options={'mediaConstraints':{'audio':!![],'video':![]},'pcConfig':{'iceServers':[{'urls':[_0x2b52('0x128')]}]},'extraHeaders':[_0x2b52('0xc9')+this[_0x2b52('0xca')][_0x2b52('0x73')][_0x2b52('0x32')]]};if(metaInfo){options['extraHeaders'][_0x2b52('0x74')](_0x2b52('0xd2')+encodeURI(metaInfo['toString']()[_0x2b52('0xd4')](0x0,0xff)));}this['_webRTCSession']['answer'](options);this['_handleRemoteAudio'](this[_0x2b52('0xb3')]);}[_0x2b52('0x4e')](statusCode=0x25b,reasonPhrase=_0x2b52('0x129')){this['log'][_0x2b52('0x19')](_0x2b52('0x12a'));this['_webRTCSession']['terminate']({'status_code':statusCode,'reason_phrase':reasonPhrase});}get[_0x2b52('0x4c')](){return this[_0x2b52('0xb2')];}get[_0x2b52('0xc8')](){return this[_0x2b52('0xbe')];}get['localNumberName'](){return this[_0x2b52('0xc0')];}get['originatingNumber'](){return this[_0x2b52('0xbd')];}set[_0x2b52('0xc8')](number){this['log'][_0x2b52('0x16')]('Setting\x20destination\x20number\x20to:\x20'+number);this[_0x2b52('0xbe')]=number;}get[_0x2b52('0x94')](){return this[_0x2b52('0xb4')];}get[_0x2b52('0x12b')](){if(this[_0x2b52('0xc1')]){this[_0x2b52('0x11')][_0x2b52('0x16')]('Call\x20direction\x20is\x20LISTEN');return _0x2b52('0x12c');}else if(this[_0x2b52('0xb3')]['direction']===_0x2b52('0x12d')){this['log'][_0x2b52('0x16')]('Call\x20direction\x20is\x20INBOUND');return _0x2b52('0x12e');}else if(this['_webRTCSession']['direction']==='outgoing'){this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x12f'));return _0x2b52('0x130');}else{this[_0x2b52('0x11')][_0x2b52('0x1d')](_0x2b52('0x131')+this[_0x2b52('0xb3')][_0x2b52('0x12b')]);return'UNKNOWN';}}[_0x2b52('0x132')](){const opt={'extraHeaders':[_0x2b52('0x133')]};this[_0x2b52('0x11')][_0x2b52('0x16')](_0x2b52('0x134'));const self=this;this[_0x2b52('0xb3')][_0x2b52('0x135')](_0x2b52('0x10f'),data=>{if(data[_0x2b52('0xfc')]==='local'){data[_0x2b52('0x19')]['on'](_0x2b52('0x136'),function(){self[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x137'));self['_isRecording']=!![];try{self[_0x2b52('0x9a')]('recordingStateChange',{'state':!![],'error':null});}catch(_0x542ae6){self[_0x2b52('0x11')][_0x2b52('0x1d')]('Exception\x20in\x20recordingStateChange\x20event:\x20'+_0x542ae6);}});data[_0x2b52('0x19')]['on']('failed',function(data){self[_0x2b52('0xb8')]=data['response'][_0x2b52('0x10a')];self[_0x2b52('0x11')]['error'](_0x2b52('0x138')+self[_0x2b52('0xb8')]);self['_fireRecordingStateEvent']();});}});this[_0x2b52('0xb3')][_0x2b52('0x139')](_0x2b52('0x13a'),null,opt);}[_0x2b52('0x13b')](){const opt={'extraHeaders':[_0x2b52('0x13c')]};this[_0x2b52('0x11')]['debug'](_0x2b52('0x13d'));const self=this;this['_webRTCSession']['once'](_0x2b52('0x10f'),data=>{data['info']['on'](_0x2b52('0x136'),function(){self[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x13e'));self[_0x2b52('0xb7')]=![];try{self[_0x2b52('0x9a')]('recordingStateChange',{'state':![],'error':null});}catch(_0x5d2fdc){self['log'][_0x2b52('0x1d')](_0x2b52('0x13f')+_0x5d2fdc);}});data['info']['on'](_0x2b52('0x108'),function(data){self[_0x2b52('0x11')][_0x2b52('0x1d')]('Recording\x20stopped\x20failed:\x20'+data[_0x2b52('0xfe')][_0x2b52('0x10a')]);try{self[_0x2b52('0x9a')](_0x2b52('0x140'),{'state':self['_isRecording'],'error':data[_0x2b52('0xfe')][_0x2b52('0x10a')]});}catch(_0x37fc8f){self[_0x2b52('0x11')][_0x2b52('0x1d')]('Exception\x20in\x20recordingStateChange\x20event:\x20'+_0x37fc8f);}});});this['_webRTCSession'][_0x2b52('0x139')]('application/info',null,opt);}['toggleRecording'](){if(!this[_0x2b52('0xb7')]){this[_0x2b52('0x132')]();return!![];}else{this[_0x2b52('0x13b')]();return![];}}get[_0x2b52('0x141')](){return this[_0x2b52('0xb7')];}[_0x2b52('0x142')](){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x143'));this['_webRTCSession'][_0x2b52('0x144')]();}[_0x2b52('0x145')](){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x146'));this[_0x2b52('0xb3')][_0x2b52('0x147')]();}['toggleMute'](){if(!this[_0x2b52('0xb6')]){this[_0x2b52('0x142')]();}else{this[_0x2b52('0x145')]();}}get[_0x2b52('0x148')](){return this[_0x2b52('0xb6')];}[_0x2b52('0x96')](){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x149'));this[_0x2b52('0xb3')][_0x2b52('0x96')]();}[_0x2b52('0x113')](){this[_0x2b52('0x11')][_0x2b52('0x19')]('Uncall\x20call');this[_0x2b52('0xca')][_0x2b52('0x68')]();this[_0x2b52('0xb3')][_0x2b52('0x113')]();}['toggleHold'](){if(!this['_isOnHold']){this[_0x2b52('0x96')]();}else{this['unhold']();}}get[_0x2b52('0x14a')](){return this['_isOnHold'];}[_0x2b52('0x14b')](code,playLocal=!![]){if(!(code in DTMF_FREQUENCY_TABLE)){throw new Exceptions[(_0x2b52('0xd6'))](_0x2b52('0x14c'));}this[_0x2b52('0x11')]['info'](_0x2b52('0x14d')+code);this[_0x2b52('0xb3')][_0x2b52('0x14b')](code);if(playLocal){const f=DTMF_FREQUENCY_TABLE[code];if(this[_0x2b52('0xb6')]){this['log'][_0x2b52('0x16')](_0x2b52('0x14e'));this[_0x2b52('0xca')][_0x2b52('0x7c')](0x1f4,f[0x0],f[0x1]);}else{this[_0x2b52('0x11')]['debug'](_0x2b52('0x14f'));this[_0x2b52('0xb3')][_0x2b52('0x144')]();const self=this;this[_0x2b52('0xca')]['playTone'](0x1f4,f[0x0],f[0x1],function(){self[_0x2b52('0x11')]['debug'](_0x2b52('0x150'));self['_webRTCSession'][_0x2b52('0x147')]();});}}}[_0x2b52('0x151')](dstSession){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x152')+this[_0x2b52('0x4c')]+_0x2b52('0x153')+dstSession[_0x2b52('0x4c')]);const referSubscriber=this[_0x2b52('0xb3')][_0x2b52('0x154')](this[_0x2b52('0xb3')]['_request']['ruri'],{'replaces':dstSession[_0x2b52('0xb3')]});const self=this;referSubscriber['on'](_0x2b52('0x155'),function(){self[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x156'));});referSubscriber['on'](_0x2b52('0x157'),function(cause){self[_0x2b52('0x11')]['error'](_0x2b52('0x158')+cause);});referSubscriber['on'](_0x2b52('0x108'),function(cause){self['log'][_0x2b52('0x1d')](_0x2b52('0x159')+cause);});}[_0x2b52('0x15a')](media_file_id,hangup_after=![]){if(!this[_0x2b52('0xca')]['_options'][_0x2b52('0x35')]){throw new Exceptions[(_0x2b52('0x66'))](_0x2b52('0x15b'));}this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x15c')+media_file_id+_0x2b52('0x15d')+hangup_after);const p=this[_0x2b52('0xca')][_0x2b52('0x5')]['fireEvent'](_0x2b52('0x15e'),{'call_uuid':this[_0x2b52('0x4c')],'call_command':_0x2b52('0x15a'),'media_file_id':media_file_id,'hangup_after':hangup_after});if(hangup_after){this['_phone'][_0x2b52('0x9')][_0x2b52('0x91')]=null;p[_0x2b52('0x1c')](()=>{this['_setSessionState'](_0x2b52('0x15f'));});}return p;}[_0x2b52('0x160')](mode=0x0){if(!this[_0x2b52('0x12b')]==='LISTEN'){throw new Exceptions[(_0x2b52('0x66'))](_0x2b52('0x161'));}if(mode<0x0||mode>0x2){throw new Exceptions['InvalidOptions'](_0x2b52('0x162'));}let t_dtmf_mode;if(mode===0x0){t_dtmf_mode=0x0;}if(mode===0x1){t_dtmf_mode=0x2;}if(mode===0x2){t_dtmf_mode=0x3;}this['sendDTMF'](t_dtmf_mode,![]);this['_whisperMode']=mode;this[_0x2b52('0x163')]();}[_0x2b52('0x164')](){const self=this;if(!this['_durationUpdTimerObj']){this[_0x2b52('0xbc')]=setInterval(function(){const activeDuration=self[_0x2b52('0xba')]?Date[_0x2b52('0x106')]()-self[_0x2b52('0xba')]:null;const e={'uuid':self[_0x2b52('0xb2')],'beginTime':self['_callBeginTime'],'answerTime':self[_0x2b52('0xba')],'endTime':self[_0x2b52('0xbb')],'duration':Date[_0x2b52('0x106')]()-self[_0x2b52('0xb9')],'durationStr':Tools[_0x2b52('0xab')](Date[_0x2b52('0x106')]()-self[_0x2b52('0xb9')]),'activeDuration':activeDuration,'activeDurationStr':activeDuration?Tools[_0x2b52('0xab')](activeDuration):''};try{self['emit']('callDurationUpdate',e);}catch(_0x84d80f){self[_0x2b52('0x11')][_0x2b52('0x1d')](_0x2b52('0x165')+_0x84d80f);}},0x3e8);}}[_0x2b52('0xf8')](){if(!this[_0x2b52('0x166')]){const emptyReport={'outboundPacketsSent':0x0,'outboundBytesSent':0x0,'outboundPacketsLost':0x0,'outboundJitter':0x0,'inboundPacketsReceived':0x0,'inboundBytesReceived':0x0,'inboundPacketsLost':0x0,'inboundJitter':0x0,'roundTripTime':0x0};this[_0x2b52('0xc2')]=Object['assign']({},emptyReport);this['_rtcpStatsTimer']=setInterval(()=>{this[_0x2b52('0xb3')]['_connection'][_0x2b52('0x167')]()[_0x2b52('0x1c')](data=>{let totalReport=Object[_0x2b52('0x23')]({},emptyReport);let deltaReport=Object[_0x2b52('0x23')]({},emptyReport);for(let report of data[_0x2b52('0x168')]()){switch(report[_0x2b52('0xef')]){case _0x2b52('0x169'):totalReport[_0x2b52('0x16a')]=report[_0x2b52('0x16b')];deltaReport['outboundPacketsSent']=report[_0x2b52('0x16b')]-this['_currentReport'][_0x2b52('0x16a')];totalReport[_0x2b52('0x16c')]=report[_0x2b52('0x16d')];deltaReport['outboundBytesSent']=report[_0x2b52('0x16d')]-this[_0x2b52('0xc2')][_0x2b52('0x16c')];break;case _0x2b52('0x16e'):totalReport[_0x2b52('0x16f')]=report['packetsReceived'];deltaReport[_0x2b52('0x16f')]=report[_0x2b52('0x170')]-this[_0x2b52('0xc2')][_0x2b52('0x16f')];totalReport['inboundBytesReceived']=report[_0x2b52('0x171')];deltaReport[_0x2b52('0x172')]=report[_0x2b52('0x171')]-this[_0x2b52('0xc2')][_0x2b52('0x172')];totalReport[_0x2b52('0x173')]=report[_0x2b52('0x174')];deltaReport[_0x2b52('0x173')]=report[_0x2b52('0x174')]-this[_0x2b52('0xc2')]['inboundPacketsLost'];totalReport[_0x2b52('0x175')]=report[_0x2b52('0x176')]*0x3e8;deltaReport['inboundJitter']=report[_0x2b52('0x176')]*0x3e8;break;case _0x2b52('0x177'):totalReport[_0x2b52('0x178')]=report[_0x2b52('0x174')];deltaReport[_0x2b52('0x178')]=report[_0x2b52('0x174')]-this[_0x2b52('0xc2')][_0x2b52('0x178')];totalReport[_0x2b52('0x179')]=report[_0x2b52('0x176')]*0x3e8;deltaReport['outboundJitter']=report[_0x2b52('0x176')]*0x3e8;totalReport[_0x2b52('0x17a')]=report[_0x2b52('0x17a')]*0x3e8;deltaReport[_0x2b52('0x17a')]=report[_0x2b52('0x17a')]*0x3e8;break;default:break;}}this[_0x2b52('0xc2')]=this[_0x2b52('0x17b')](totalReport);if(totalReport[_0x2b52('0x17a')]){const finalReport={'total':this[_0x2b52('0xc2')],'delta':this[_0x2b52('0x17b')](deltaReport)};try{this[_0x2b52('0x9a')](_0x2b52('0x17c'),finalReport);}catch(_0x5a116e){this[_0x2b52('0x11')]['error'](_0x2b52('0x17d')+_0x5a116e);}}});},0x1388);}}[_0x2b52('0x17b')](report){report[_0x2b52('0x17e')]=report['outboundPacketsLost']/report[_0x2b52('0x16a')];report[_0x2b52('0x17f')]=report['inboundPacketsLost']/report[_0x2b52('0x16f')];report[_0x2b52('0x180')]=report[_0x2b52('0x17a')]+(report[_0x2b52('0x175')]+report[_0x2b52('0x179')])+0xa;const lossRate=(report[_0x2b52('0x17e')]+report[_0x2b52('0x17f')])*0x64;const lossEffect=0x5f*lossRate/(lossRate+0xa);const latencyEffect=report[_0x2b52('0x180')]*0.1;report[_0x2b52('0x181')]=Math['max'](0x0,0x64-lossEffect-latencyEffect);report['mos']=0x1+0.035*report['rFactor']+0.000007*report[_0x2b52('0x181')]*(report['rFactor']-0x3c)*(0x64-report[_0x2b52('0x181')]);switch(!![]){case report['rFactor']<0x32:report['qualityString']=_0x2b52('0x182');break;case report['rFactor']<0x46:report[_0x2b52('0x183')]='Poor';break;case report[_0x2b52('0x181')]<0x50:report['qualityString']=_0x2b52('0x184');break;case report[_0x2b52('0x181')]<0x5a:report[_0x2b52('0x183')]=_0x2b52('0x185');break;case report[_0x2b52('0x181')]<=0x64:report[_0x2b52('0x183')]=_0x2b52('0x186');break;default:report[_0x2b52('0x183')]=_0x2b52('0x187');}return report;}[_0x2b52('0x51')](state,info=null){this['log'][_0x2b52('0x16')](_0x2b52('0x188')+state);if(info){this[_0x2b52('0x11')][_0x2b52('0x16')](info);}this['_sessionState']=state;try{this[_0x2b52('0x9a')](_0x2b52('0x189'),Object[_0x2b52('0x23')]({'state':state,'uuid':this['_callUUID']},info));}catch(_0x57aa89){this[_0x2b52('0x11')][_0x2b52('0x1d')]('Exception\x20in\x20sessionStateChange\x20event:'+_0x57aa89);}if(state===_0x2b52('0x107')){this[_0x2b52('0xbf')]=this['_manualDisposition']||_0x2b52('0x18a');this[_0x2b52('0x18b')]();}if(state==='FAILED'){if(info['cause']===_0x2b52('0x18c')){this[_0x2b52('0xbf')]=_0x2b52('0x18d');if(this[_0x2b52('0xca')][_0x2b52('0x73')][_0x2b52('0x18e')]){this[_0x2b52('0xca')]['_startRepeatTone'](ST_TEMP_UNAVAIL);}}if(info['cause']==='Not\x20Found'){this['_callDisposition']=_0x2b52('0x18f');if(this['_phone']['options'][_0x2b52('0x18e')]){this[_0x2b52('0xca')]['_startRepeatTone'](ST_INVALID_NUMBER);}}if(info['cause']===_0x2b52('0x190')){this[_0x2b52('0xbf')]=this[_0x2b52('0x125')]||_0x2b52('0x191');}if(info['cause']===_0x2b52('0x192')){if(this['direction']==='INBOUND'){this[_0x2b52('0xbf')]=_0x2b52('0x193');}else{this[_0x2b52('0xbf')]=_0x2b52('0x194');}}if(info[_0x2b52('0x10c')]===_0x2b52('0x4f')){this[_0x2b52('0xbf')]=_0x2b52('0x195');if(this['_phone'][_0x2b52('0x73')][_0x2b52('0x18e')]){this[_0x2b52('0xca')]['_startRepeatTone'](ST_BUSY);}}if(this['_webRTCSession'][_0x2b52('0x12b')]===_0x2b52('0x12d')){}this[_0x2b52('0x18b')]();}}['_callFinished'](){this[_0x2b52('0x11')][_0x2b52('0x19')](_0x2b52('0x196'));this[_0x2b52('0x197')]();clearInterval(this[_0x2b52('0xbc')]);clearInterval(this['_rtcpStatsTimer']);this['_phone'][_0x2b52('0x198')](this);}[_0x2b52('0xe1')](timeout){this['log']['debug'](_0x2b52('0x199')+timeout);this[_0x2b52('0xc3')]=timeout;}['_fireRecordingStateEvent'](){try{this[_0x2b52('0x9a')](_0x2b52('0x140'),{'state':this[_0x2b52('0xb7')],'error':this[_0x2b52('0xb8')]});}catch(_0x4eaf6e){this[_0x2b52('0x11')][_0x2b52('0x1d')]('Exception\x20in\x20recording\x20state\x20change\x20event:\x20'+_0x4eaf6e);}}['_fireMuteStateEvent'](){try{this['emit'](_0x2b52('0x19a'),{'state':this[_0x2b52('0xb6')]});}catch(_0x1288e8){this[_0x2b52('0x11')][_0x2b52('0x1d')]('Exception\x20in\x20mute\x20state\x20change\x20event:\x20'+_0x1288e8);}}[_0x2b52('0x111')](){try{this['emit'](_0x2b52('0x19b'),{'state':this[_0x2b52('0xb5')]});}catch(_0x2fc4e0){this['log'][_0x2b52('0x1d')](_0x2b52('0x19c')+_0x2fc4e0);}}[_0x2b52('0x163')](){try{this[_0x2b52('0x9a')](_0x2b52('0x19d'),{'mode':this['_whisperMode']});}catch(_0x1cc8a1){this['log'][_0x2b52('0x1d')](_0x2b52('0x19e')+_0x1cc8a1);}}[_0x2b52('0x197')](){let e;e={'uuid':this[_0x2b52('0xb2')],'direction':this[_0x2b52('0x12b')],'disposition':this[_0x2b52('0xbf')],'originatingNumber':this[_0x2b52('0xbd')],'destinationNumber':this[_0x2b52('0xbe')],'duration':this[_0x2b52('0xbb')]-this[_0x2b52('0xb9')],'answerDuration':this[_0x2b52('0xba')]?this[_0x2b52('0xba')]-this[_0x2b52('0xb9')]:null,'activeDuration':this[_0x2b52('0xba')]?this[_0x2b52('0xbb')]-this[_0x2b52('0xba')]:null,'startTime':new Date(this[_0x2b52('0xb9')])['toISOString'](),'endTime':new Date(this[_0x2b52('0xbb')])[_0x2b52('0x19f')](),'answerTime':this['_callAnswerTime']?new Date(this[_0x2b52('0xba')])[_0x2b52('0x19f')]():null};e['durationStr']=Tools['createDurationString'](e['duration']);e[_0x2b52('0xad')]=e[_0x2b52('0xa9')]?Tools['createDurationString'](e[_0x2b52('0xa9')]):'';e[_0x2b52('0xae')]=e[_0x2b52('0xaf')]?Tools['createDurationString'](e[_0x2b52('0xaf')]):'';e[_0x2b52('0x1a0')]=this['_currentReport'];try{this['emit'](_0x2b52('0x1a1'),e);}catch(_0x5dc5dd){this[_0x2b52('0x11')]['error'](_0x2b52('0x1a2')+_0x5dc5dd);}}['_handleRemoteAudio'](session){this[_0x2b52('0xca')][_0x2b52('0x8c')]();const self=this;session[_0x2b52('0x11e')][_0x2b52('0x1a3')]=function(event){self[_0x2b52('0x11')]['debug'](_0x2b52('0x1a4'));self['log'][_0x2b52('0x16')](event);self[_0x2b52('0xca')][_0x2b52('0x9')][_0x2b52('0x91')]=event['streams'][0x0];};}}
package/webpack.config.js DELETED
@@ -1,39 +0,0 @@
1
- const path = require('path');
2
-
3
- const config = {
4
- entry: {
5
- main: __dirname + '/src/index.js',
6
- },
7
-
8
- output: {
9
- path: __dirname + '/browser',
10
- filename: 'telegenta.min.js',
11
- library: 'Telegenta',
12
- libraryTarget: 'umd',
13
- umdNamedDefine: false
14
- },
15
-
16
- module: {
17
- rules: [
18
- {
19
- test: /(\.js)$/,
20
- loader: 'babel-loader',
21
- // Don't transpile node modules, but include camelcase lib (which has no es5 version)
22
- exclude: /node_modules\/(?!(camelcase|camelcase-keys)\/).*/
23
- }
24
- ]
25
- },
26
-
27
- resolve: {
28
- modules: [path.resolve('./node_modules'), path.resolve('./src')],
29
- extensions: ['.json', '.js']
30
- },
31
-
32
- plugins: [],
33
-
34
- performance: { hints: false },
35
-
36
- mode: 'production'
37
- };
38
-
39
- module.exports = config;