Built motion from commit 97153652.|2.6.26
[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 _0x556b=['active','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','booked','keys','length','queue','dialer','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','inUse','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','talking','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk'];(function(_0x5bd044,_0xafd5fa){var _0x582fd7=function(_0x1accb9){while(--_0x1accb9){_0x5bd044['push'](_0x5bd044['shift']());}};_0x582fd7(++_0xafd5fa);}(_0x556b,0x1d7));var _0xb556=function(_0x5120f2,_0x2223e2){_0x5120f2=_0x5120f2-0x0;var _0x2cbf40=_0x556b[_0x5120f2];return _0x2cbf40;};'use strict';var INBOUND_COUNTERS=[_0xb556('0x0'),_0xb556('0x1'),_0xb556('0x2'),_0xb556('0x3'),_0xb556('0x4'),'talking',_0xb556('0x5')];var OUTBOUND_COUNTERS=[_0xb556('0x0'),_0xb556('0x6'),_0xb556('0x7'),_0xb556('0x1'),'loggedInDb','originated','outboundAbandonedCallsDay',_0xb556('0x8'),_0xb556('0x9'),_0xb556('0xa'),_0xb556('0xb'),_0xb556('0xc'),_0xb556('0xd'),_0xb556('0xe'),_0xb556('0xf'),'outboundUnknownCallsDay','paused',_0xb556('0x10'),'talking',_0xb556('0x11'),_0xb556('0x12'),'total','waiting'];function VoiceQueueSummary(_0x19ea2f){this['id']=_0x19ea2f['id'];this[_0xb556('0x13')]=_0x19ea2f[_0xb556('0x13')];this[_0xb556('0x14')]=_0x19ea2f[_0xb556('0x14')];this[_0xb556('0x15')]=_0x19ea2f['abandoned']||0x0;this['answered']=_0x19ea2f[_0xb556('0x6')]||0x0;this['available']=_0x19ea2f[_0xb556('0x0')]||0x0;this[_0xb556('0x16')]=_0x19ea2f['busy']||0x0;this['inUse']=_0x19ea2f[_0xb556('0x7')]||0x0;this[_0xb556('0x17')]=_0x19ea2f[_0xb556('0x17')]||0x0;this[_0xb556('0x1')]=_0x19ea2f[_0xb556('0x1')]||0x0;this[_0xb556('0x2')]=_0x19ea2f[_0xb556('0x2')]||0x0;this[_0xb556('0x18')]=_0x19ea2f[_0xb556('0x18')]||0x0;this['notInUse']=_0x19ea2f[_0xb556('0x19')]||0x0;this[_0xb556('0x3')]=_0x19ea2f[_0xb556('0x3')]||0x0;this[_0xb556('0x4')]=_0x19ea2f['ringing']||0x0;this[_0xb556('0x1a')]=_0x19ea2f[_0xb556('0x1a')];this[_0xb556('0x11')]=_0x19ea2f[_0xb556('0x11')];this['sumDuration']=_0x19ea2f[_0xb556('0x12')];this[_0xb556('0x1b')]=_0x19ea2f[_0xb556('0x1b')]||0x0;this[_0xb556('0x1c')]=_0x19ea2f['talking']||0x0;this[_0xb556('0x1d')]=_0x19ea2f[_0xb556('0x1d')]||0x0;this[_0xb556('0x1e')]=_0x19ea2f[_0xb556('0x1e')];this[_0xb556('0x1f')]=_0x19ea2f[_0xb556('0x1f')]||0x0;this[_0xb556('0x20')]=_0x19ea2f[_0xb556('0x20')]||0x0;this[_0xb556('0x21')]=_0x19ea2f[_0xb556('0x21')]||0x0;this[_0xb556('0x5')]=_0x19ea2f[_0xb556('0x5')]||0x0;if(_0x19ea2f[_0xb556('0x1e')]===_0xb556('0x22')){this[_0xb556('0x10')]=_0x19ea2f[_0xb556('0x10')]||0x0;this[_0xb556('0x23')]=_0x19ea2f[_0xb556('0x23')];this[_0xb556('0x24')]=_0x19ea2f[_0xb556('0x24')];this[_0xb556('0x25')]=_0x19ea2f[_0xb556('0x25')];this['dialOriginateCallerIdNumber']=_0x19ea2f[_0xb556('0x26')];this['dialOriginateTimeout']=_0x19ea2f['dialOriginateTimeout'];this['dialPrefix']=_0x19ea2f[_0xb556('0x27')];this[_0xb556('0x28')]=_0x19ea2f[_0xb556('0x28')];this['outboundAnswerAgiCallsDay']=_0x19ea2f[_0xb556('0x29')];this[_0xb556('0x8')]=_0x19ea2f['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x19ea2f['outboundBlacklistCallsDay'];this[_0xb556('0xa')]=_0x19ea2f[_0xb556('0xa')];this['outboundCongestionCallsDay']=_0x19ea2f['outboundCongestionCallsDay'];this[_0xb556('0x2a')]=_0x19ea2f['outboundDropCallsDayACS'];this[_0xb556('0x2b')]=_0x19ea2f['outboundDropCallsDayCallersExit'];this[_0xb556('0x2c')]=_0x19ea2f['outboundDropCallsDayTimeout'];this[_0xb556('0xc')]=_0x19ea2f[_0xb556('0xc')];this['outboundNoSuchCallsDay']=_0x19ea2f['outboundNoSuchCallsDay'];this[_0xb556('0x2d')]=_0x19ea2f[_0xb556('0x2d')];this[_0xb556('0xe')]=_0x19ea2f['outboundReCallsDay'];this[_0xb556('0xf')]=_0x19ea2f[_0xb556('0xf')];this[_0xb556('0x2e')]=_0x19ea2f[_0xb556('0x2e')];this['predictiveIntervalAnsweredCalls']=_0x19ea2f[_0xb556('0x2f')];this[_0xb556('0x30')]=_0x19ea2f['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x19ea2f[_0xb556('0x31')];this[_0xb556('0x32')]=_0x19ea2f[_0xb556('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x19ea2f[_0xb556('0x33')];this[_0xb556('0x34')]=_0x19ea2f['predictiveIntervalErlangCalls'];this[_0xb556('0x35')]=_0x19ea2f[_0xb556('0x35')];this[_0xb556('0x36')]=_0x19ea2f['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x19ea2f[_0xb556('0x37')];this[_0xb556('0x38')]=_0x19ea2f[_0xb556('0x38')];this['predictiveIntervalAvailable']=_0x19ea2f[_0xb556('0x39')];this[_0xb556('0x3a')]=_0x19ea2f['predictiveIntervalTotalCalls'];this['originated']=_0x19ea2f[_0xb556('0x3b')];this[_0xb556('0x3c')]=_0x19ea2f['erlangCalls'];this['erlangCallToSecond']=_0x19ea2f[_0xb556('0x3d')];this[_0xb556('0x3e')]=_0x19ea2f[_0xb556('0x3e')];this[_0xb556('0x3f')]=_0x19ea2f['erlangBusyFactor'];this[_0xb556('0x40')]=_0x19ea2f['startPredictive'];this['startProgressive']=_0x19ea2f[_0xb556('0x41')];this[_0xb556('0x42')]=_0x19ea2f[_0xb556('0x42')];this[_0xb556('0x43')]=_0x19ea2f[_0xb556('0x43')];}if(_0x19ea2f[_0xb556('0x44')]){this['Trunk']={'id':_0x19ea2f[_0xb556('0x44')]['id'],'name':_0x19ea2f[_0xb556('0x44')][_0xb556('0x13')],'active':_0x19ea2f[_0xb556('0x44')][_0xb556('0x45')],'callerid':_0x19ea2f['Trunk'][_0xb556('0x46')]};}}VoiceQueueSummary[_0xb556('0x47')]['createReport']=function(_0x107746,_0x1d48b5,_0x3a194d,_0x18842a){this[_0xb556('0x2')]=0x0;this[_0xb556('0x1c')]=0x0;this[_0xb556('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xb556('0x7')]=0x0;this[_0xb556('0x16')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this[_0xb556('0x4')]=0x0;this[_0xb556('0x1a')]=0x0;this[_0xb556('0x18')]=0x0;if(_0x3a194d){if(_0x3a194d['available']){this[_0xb556('0x0')]=Number(_0x3a194d['available']);}if(_0x3a194d[_0xb556('0x48')]){this[_0xb556('0x1')]=Number(_0x3a194d[_0xb556('0x48')]);}if(_0x3a194d[_0xb556('0x49')]){this['waiting']=Number(_0x3a194d[_0xb556('0x49')]);}}for(var _0x141b73=0x0;_0x141b73<_0x107746['length'];_0x141b73++){var _0x2fa740=_0x1d48b5[_0xb556('0x4a')+_0x107746[_0x141b73][_0xb556('0x13')]];if(_0x2fa740&&_0x2fa740[_0xb556('0x4b')]){this['loggedInDb']+=0x1;}if(_0x107746[_0x141b73][_0xb556('0x4c')]==='1'){this[_0xb556('0x1c')]+=0x1;}if(_0x107746[_0x141b73][_0xb556('0x3')]==='1'&&!['2','7','8'][_0xb556('0x4d')](_0x107746[_0x141b73]['status'])){this['paused']+=0x1;}switch(_0x107746[_0x141b73][_0xb556('0x4e')]){case'0':this[_0xb556('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xb556('0x7')]+=0x1;break;case'3':this[_0xb556('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xb556('0x1f')]+=0x1;break;case'6':this[_0xb556('0x4')]+=0x1;break;case'7':this[_0xb556('0x1a')]+=0x1;break;case'8':this[_0xb556('0x18')]+=0x1;break;}}if(this[_0xb556('0x24')]===_0xb556('0x4f')){var _0x100555=Object[_0xb556('0x50')](_0x18842a);for(var _0x221df8=0x0;_0x221df8<_0x100555[_0xb556('0x51')];_0x221df8++){var _0x1e222a=_0x100555[_0x221df8];var _0x3862ef=_0x18842a[_0x1e222a];if(_0x3862ef[_0xb556('0x52')]===this[_0xb556('0x13')]&&_0x3862ef[_0xb556('0x1e')]===_0xb556('0x53')&&_0x3862ef['exten']===_0xb556('0x54')){this[_0xb556('0x1c')]+=0x1;}}if(this['talking']>this['inUse']){this[_0xb556('0x1c')]=this[_0xb556('0x7')];}this[_0xb556('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xb556('0x47')]['compareToInboundQueue']=function(_0x51d063){var _0x11dac3=![];if(_0x51d063){_0x11dac3=INBOUND_COUNTERS[_0xb556('0x55')](function(_0x43e195){return this[_0x43e195]!==_0x51d063[_0x43e195];},this);}return _0x11dac3;};VoiceQueueSummary[_0xb556('0x47')][_0xb556('0x56')]=function(_0xa12085){var _0x42945b=![];var _0x10f3d6=![];var _0x211c04=![];if(_0xa12085){_0x42945b=this['dialMethod']!==_0xa12085[_0xb556('0x24')]||this['dialActive']!==_0xa12085['dialActive']||this[_0xb556('0x42')]!==_0xa12085[_0xb556('0x42')]||this[_0xb556('0x43')]!==_0xa12085[_0xb556('0x43')];_0x10f3d6=OUTBOUND_COUNTERS['some'](function(_0x143bcf){return this[_0x143bcf]!==_0xa12085[_0x143bcf];},this);if(this[_0xb556('0x44')]&&_0xa12085[_0xb556('0x44')]){_0x211c04=this[_0xb556('0x44')][_0xb556('0x13')]!==_0xa12085[_0xb556('0x44')]['name']||this[_0xb556('0x44')][_0xb556('0x45')]!==_0xa12085[_0xb556('0x44')]['active'];}}return _0x42945b||_0x10f3d6||_0x211c04;};VoiceQueueSummary['prototype'][_0xb556('0x57')]=function(_0x12ffec){this['answered']=_0x12ffec[_0xb556('0x6')];this[_0xb556('0x42')]=_0x12ffec[_0xb556('0x42')];this[_0xb556('0x43')]=_0x12ffec['statusMessage'];this[_0xb556('0x3b')]=_0x12ffec[_0xb556('0x3b')];this['outboundAbandonedCallsDay']=_0x12ffec[_0xb556('0x58')];this[_0xb556('0x8')]=_0x12ffec['outboundAnswerCallsDay'];this[_0xb556('0x9')]=_0x12ffec[_0xb556('0x9')];this[_0xb556('0xa')]=_0x12ffec[_0xb556('0xa')];this[_0xb556('0xb')]=_0x12ffec[_0xb556('0xb')];this['outboundNoAnswerCallsDay']=_0x12ffec[_0xb556('0xc')];this['outboundNoSuchCallsDay']=_0x12ffec[_0xb556('0xd')];this['outboundReCallsDay']=_0x12ffec[_0xb556('0xe')];this[_0xb556('0xf')]=_0x12ffec[_0xb556('0xf')];this['outboundUnknownCallsDay']=_0x12ffec[_0xb556('0x2e')];this[_0xb556('0x11')]=_0x12ffec[_0xb556('0x11')];this[_0xb556('0x12')]=_0x12ffec['sumDuration'];this[_0xb556('0x1d')]=_0x12ffec[_0xb556('0x1d')];if(this[_0xb556('0x24')]===_0xb556('0x59')){this[_0xb556('0x10')]=_0x12ffec[_0xb556('0x10')];}};module['exports']=VoiceQueueSummary;