Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / services / ami / model / voiceQueueSummary.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x2eb2=['dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','callerid','createReport','invalid','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','prototype','compareToOutboundQueue','active','updateReportFromOutboundQueue','total','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','strategy','abandoned','available','busy','inUse','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x2eb2[_0x4fc9e6];return _0x551d28;};'use strict';var INBOUND_COUNTERS=['available',_0x22eb('0x0'),_0x22eb('0x1'),_0x22eb('0x2'),_0x22eb('0x3'),_0x22eb('0x4'),_0x22eb('0x5')];var OUTBOUND_COUNTERS=['available',_0x22eb('0x6'),'inUse','loggedIn',_0x22eb('0x1'),_0x22eb('0x7'),_0x22eb('0x8'),_0x22eb('0x9'),_0x22eb('0xa'),_0x22eb('0xb'),_0x22eb('0xc'),_0x22eb('0xd'),_0x22eb('0xe'),_0x22eb('0xf'),_0x22eb('0x10'),_0x22eb('0x11'),'paused',_0x22eb('0x12'),'talking','sumBillable',_0x22eb('0x13'),'total',_0x22eb('0x5')];function VoiceQueueSummary(_0x28c587){this['id']=_0x28c587['id'];this['name']=_0x28c587['name'];this[_0x22eb('0x14')]=_0x28c587[_0x22eb('0x14')];this[_0x22eb('0x15')]=_0x28c587[_0x22eb('0x15')]||0x0;this[_0x22eb('0x6')]=_0x28c587['answered']||0x0;this[_0x22eb('0x16')]=_0x28c587['available']||0x0;this[_0x22eb('0x17')]=_0x28c587['busy']||0x0;this[_0x22eb('0x18')]=_0x28c587[_0x22eb('0x18')]||0x0;this['invalid']=_0x28c587['invalid']||0x0;this['loggedIn']=_0x28c587[_0x22eb('0x0')]||0x0;this['loggedInDb']=_0x28c587['loggedInDb']||0x0;this[_0x22eb('0x19')]=_0x28c587['onHold']||0x0;this['notInUse']=_0x28c587[_0x22eb('0x1a')]||0x0;this[_0x22eb('0x2')]=_0x28c587[_0x22eb('0x2')]||0x0;this[_0x22eb('0x3')]=_0x28c587[_0x22eb('0x3')]||0x0;this['ringInUse']=_0x28c587[_0x22eb('0x1b')];this[_0x22eb('0x1c')]=_0x28c587[_0x22eb('0x1c')];this[_0x22eb('0x13')]=_0x28c587[_0x22eb('0x13')];this['sumHoldTime']=_0x28c587[_0x22eb('0x1d')]||0x0;this[_0x22eb('0x4')]=_0x28c587[_0x22eb('0x4')]||0x0;this['total']=_0x28c587['total']||0x0;this[_0x22eb('0x1e')]=_0x28c587[_0x22eb('0x1e')];this[_0x22eb('0x1f')]=_0x28c587[_0x22eb('0x1f')]||0x0;this[_0x22eb('0x20')]=_0x28c587[_0x22eb('0x20')]||0x0;this[_0x22eb('0x21')]=_0x28c587['unmanaged']||0x0;this[_0x22eb('0x5')]=_0x28c587[_0x22eb('0x5')]||0x0;if(_0x28c587[_0x22eb('0x1e')]===_0x22eb('0x22')){this[_0x22eb('0x12')]=_0x28c587['pTalking']||0x0;this[_0x22eb('0x23')]=_0x28c587[_0x22eb('0x23')];this[_0x22eb('0x24')]=_0x28c587['dialMethod'];this[_0x22eb('0x25')]=_0x28c587[_0x22eb('0x25')];this['dialOriginateCallerIdNumber']=_0x28c587[_0x22eb('0x26')];this[_0x22eb('0x27')]=_0x28c587[_0x22eb('0x27')];this[_0x22eb('0x28')]=_0x28c587[_0x22eb('0x28')];this['temp']=_0x28c587['temp'];this[_0x22eb('0x29')]=_0x28c587[_0x22eb('0x29')];this[_0x22eb('0x9')]=_0x28c587[_0x22eb('0x9')];this[_0x22eb('0xa')]=_0x28c587[_0x22eb('0xa')];this[_0x22eb('0xb')]=_0x28c587[_0x22eb('0xb')];this[_0x22eb('0xc')]=_0x28c587[_0x22eb('0xc')];this[_0x22eb('0x2a')]=_0x28c587[_0x22eb('0x2a')];this['outboundDropCallsDayCallersExit']=_0x28c587[_0x22eb('0x2b')];this['outboundDropCallsDayTimeout']=_0x28c587[_0x22eb('0x2c')];this[_0x22eb('0xd')]=_0x28c587[_0x22eb('0xd')];this[_0x22eb('0xe')]=_0x28c587[_0x22eb('0xe')];this[_0x22eb('0x2d')]=_0x28c587[_0x22eb('0x2d')];this[_0x22eb('0xf')]=_0x28c587[_0x22eb('0xf')];this[_0x22eb('0x10')]=_0x28c587['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x28c587[_0x22eb('0x11')];this['predictiveIntervalAnsweredCalls']=_0x28c587['predictiveIntervalAnsweredCalls'];this[_0x22eb('0x2e')]=_0x28c587[_0x22eb('0x2e')];this[_0x22eb('0x2f')]=_0x28c587[_0x22eb('0x2f')];this[_0x22eb('0x30')]=_0x28c587[_0x22eb('0x30')];this[_0x22eb('0x31')]=_0x28c587[_0x22eb('0x31')];this[_0x22eb('0x32')]=_0x28c587[_0x22eb('0x32')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x28c587[_0x22eb('0x33')];this['predictiveIntervalHitRate']=_0x28c587['predictiveIntervalHitRate'];this[_0x22eb('0x34')]=_0x28c587[_0x22eb('0x34')];this['predictiveIntervalPauses']=_0x28c587[_0x22eb('0x35')];this[_0x22eb('0x36')]=_0x28c587[_0x22eb('0x36')];this[_0x22eb('0x37')]=_0x28c587[_0x22eb('0x37')];this['originated']=_0x28c587[_0x22eb('0x7')];this[_0x22eb('0x38')]=_0x28c587['erlangCalls'];this[_0x22eb('0x39')]=_0x28c587[_0x22eb('0x39')];this[_0x22eb('0x3a')]=_0x28c587[_0x22eb('0x3a')];this[_0x22eb('0x3b')]=_0x28c587['erlangBusyFactor'];this['startPredictive']=_0x28c587[_0x22eb('0x3c')];this[_0x22eb('0x3d')]=_0x28c587['startProgressive'];this[_0x22eb('0x3e')]=_0x28c587[_0x22eb('0x3e')];this[_0x22eb('0x3f')]=_0x28c587['statusMessage'];}if(_0x28c587[_0x22eb('0x40')]){this[_0x22eb('0x40')]={'id':_0x28c587[_0x22eb('0x40')]['id'],'name':_0x28c587[_0x22eb('0x40')][_0x22eb('0x41')],'active':_0x28c587[_0x22eb('0x40')]['active'],'callerid':_0x28c587[_0x22eb('0x40')][_0x22eb('0x42')]};}}VoiceQueueSummary['prototype'][_0x22eb('0x43')]=function(_0x44d39f,_0x204092,_0x30cb10,_0x18c6ed){this[_0x22eb('0x1')]=0x0;this[_0x22eb('0x4')]=0x0;this[_0x22eb('0x2')]=0x0;this[_0x22eb('0x20')]=0x0;this[_0x22eb('0x1a')]=0x0;this[_0x22eb('0x18')]=0x0;this[_0x22eb('0x17')]=0x0;this[_0x22eb('0x44')]=0x0;this[_0x22eb('0x1f')]=0x0;this[_0x22eb('0x3')]=0x0;this[_0x22eb('0x1b')]=0x0;this[_0x22eb('0x19')]=0x0;if(_0x30cb10){if(_0x30cb10[_0x22eb('0x16')]){this['available']=Number(_0x30cb10[_0x22eb('0x16')]);}if(_0x30cb10[_0x22eb('0x45')]){this['loggedIn']=Number(_0x30cb10[_0x22eb('0x45')]);}if(_0x30cb10[_0x22eb('0x46')]){this['waiting']=Number(_0x30cb10['callers']);}}for(var _0x5c18d1=0x0;_0x5c18d1<_0x44d39f[_0x22eb('0x47')];_0x5c18d1++){var _0x1efc65=_0x204092['SIP/'+_0x44d39f[_0x5c18d1]['name']];if(_0x1efc65&&_0x1efc65[_0x22eb('0x48')]){this[_0x22eb('0x1')]+=0x1;}if(_0x44d39f[_0x5c18d1][_0x22eb('0x49')]==='1'){this[_0x22eb('0x4')]+=0x1;}if(_0x44d39f[_0x5c18d1][_0x22eb('0x2')]==='1'&&!['2','7','8'][_0x22eb('0x4a')](_0x44d39f[_0x5c18d1][_0x22eb('0x4b')])){this[_0x22eb('0x2')]+=0x1;}switch(_0x44d39f[_0x5c18d1]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x22eb('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x22eb('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x22eb('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x22eb('0x4c')){var _0x4b5c03=Object[_0x22eb('0x4d')](_0x18c6ed);for(var _0x3b35c6=0x0;_0x3b35c6<_0x4b5c03['length'];_0x3b35c6++){var _0x24e6ba=_0x4b5c03[_0x3b35c6];var _0x5df756=_0x18c6ed[_0x24e6ba];if(_0x5df756[_0x22eb('0x4e')]===this[_0x22eb('0x41')]&&_0x5df756[_0x22eb('0x1e')]===_0x22eb('0x4f')&&_0x5df756[_0x22eb('0x50')]===_0x22eb('0x51')){this[_0x22eb('0x4')]+=0x1;}}if(this[_0x22eb('0x4')]>this[_0x22eb('0x18')]){this['talking']=this[_0x22eb('0x18')];}this[_0x22eb('0x12')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x22eb('0x52')]=function(_0x2f0242){var _0x4da671=![];if(_0x2f0242){_0x4da671=INBOUND_COUNTERS[_0x22eb('0x53')](function(_0x4fee5c){return this[_0x4fee5c]!==_0x2f0242[_0x4fee5c];},this);}return _0x4da671;};VoiceQueueSummary[_0x22eb('0x54')][_0x22eb('0x55')]=function(_0x3b1cd2){var _0x3e3fae=![];var _0x447177=![];var _0x10393b=![];if(_0x3b1cd2){_0x3e3fae=this['dialMethod']!==_0x3b1cd2[_0x22eb('0x24')]||this['dialActive']!==_0x3b1cd2[_0x22eb('0x23')]||this['message']!==_0x3b1cd2[_0x22eb('0x3e')]||this[_0x22eb('0x3f')]!==_0x3b1cd2[_0x22eb('0x3f')];_0x447177=OUTBOUND_COUNTERS[_0x22eb('0x53')](function(_0x3f03df){return this[_0x3f03df]!==_0x3b1cd2[_0x3f03df];},this);if(this['Trunk']&&_0x3b1cd2['Trunk']){_0x10393b=this[_0x22eb('0x40')][_0x22eb('0x41')]!==_0x3b1cd2['Trunk'][_0x22eb('0x41')]||this[_0x22eb('0x40')][_0x22eb('0x56')]!==_0x3b1cd2[_0x22eb('0x40')][_0x22eb('0x56')];}}return _0x3e3fae||_0x447177||_0x10393b;};VoiceQueueSummary[_0x22eb('0x54')][_0x22eb('0x57')]=function(_0x35c997){this[_0x22eb('0x6')]=_0x35c997[_0x22eb('0x6')];this[_0x22eb('0x3e')]=_0x35c997['message'];this[_0x22eb('0x3f')]=_0x35c997[_0x22eb('0x3f')];this[_0x22eb('0x7')]=_0x35c997[_0x22eb('0x7')];this[_0x22eb('0x8')]=_0x35c997[_0x22eb('0x8')];this[_0x22eb('0x9')]=_0x35c997[_0x22eb('0x9')];this[_0x22eb('0xa')]=_0x35c997[_0x22eb('0xa')];this[_0x22eb('0xb')]=_0x35c997[_0x22eb('0xb')];this[_0x22eb('0xc')]=_0x35c997[_0x22eb('0xc')];this['outboundNoAnswerCallsDay']=_0x35c997['outboundNoAnswerCallsDay'];this[_0x22eb('0xe')]=_0x35c997[_0x22eb('0xe')];this[_0x22eb('0xf')]=_0x35c997[_0x22eb('0xf')];this[_0x22eb('0x10')]=_0x35c997['outboundRejectCallsDay'];this[_0x22eb('0x11')]=_0x35c997[_0x22eb('0x11')];this['sumBillable']=_0x35c997['sumBillable'];this[_0x22eb('0x13')]=_0x35c997[_0x22eb('0x13')];this[_0x22eb('0x58')]=_0x35c997[_0x22eb('0x58')];if(this[_0x22eb('0x24')]===_0x22eb('0x59')){this[_0x22eb('0x12')]=_0x35c997[_0x22eb('0x12')];}};module[_0x22eb('0x5a')]=VoiceQueueSummary;