e2180af1eee9d636dc1f99ce64ba90ad23cb25fa
[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 _0x99fb=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','includes','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','exports','available','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x4a5a53,_0x59be05){var _0x3100a1=function(_0x2c5de1){while(--_0x2c5de1){_0x4a5a53['push'](_0x4a5a53['shift']());}};_0x3100a1(++_0x59be05);}(_0x99fb,0x92));var _0xb99f=function(_0x2938bb,_0x316028){_0x2938bb=_0x2938bb-0x0;var _0xcef328=_0x99fb[_0x2938bb];return _0xcef328;};'use strict';var INBOUND_COUNTERS=[_0xb99f('0x0'),'loggedIn',_0xb99f('0x1'),_0xb99f('0x2'),_0xb99f('0x3'),_0xb99f('0x4'),_0xb99f('0x5')];var OUTBOUND_COUNTERS=['available',_0xb99f('0x6'),_0xb99f('0x7'),'loggedIn',_0xb99f('0x1'),_0xb99f('0x8'),_0xb99f('0x9'),'outboundAnswerCallsDay',_0xb99f('0xa'),'outboundBusyCallsDay',_0xb99f('0xb'),'outboundNoAnswerCallsDay',_0xb99f('0xc'),_0xb99f('0xd'),'outboundRejectCallsDay',_0xb99f('0xe'),_0xb99f('0x2'),_0xb99f('0xf'),_0xb99f('0x4'),_0xb99f('0x10'),_0xb99f('0x11'),_0xb99f('0x12'),'waiting'];function VoiceQueueSummary(_0x315fe2){this['id']=_0x315fe2['id'];this['name']=_0x315fe2['name'];this[_0xb99f('0x13')]=_0x315fe2[_0xb99f('0x13')];this[_0xb99f('0x14')]=_0x315fe2[_0xb99f('0x14')]||0x0;this[_0xb99f('0x6')]=_0x315fe2['answered']||0x0;this[_0xb99f('0x0')]=_0x315fe2['available']||0x0;this[_0xb99f('0x15')]=_0x315fe2[_0xb99f('0x15')]||0x0;this['inUse']=_0x315fe2[_0xb99f('0x7')]||0x0;this['invalid']=_0x315fe2[_0xb99f('0x16')]||0x0;this['loggedIn']=_0x315fe2[_0xb99f('0x17')]||0x0;this['loggedInDb']=_0x315fe2[_0xb99f('0x1')]||0x0;this['onHold']=_0x315fe2[_0xb99f('0x18')]||0x0;this[_0xb99f('0x19')]=_0x315fe2[_0xb99f('0x19')]||0x0;this[_0xb99f('0x2')]=_0x315fe2[_0xb99f('0x2')]||0x0;this[_0xb99f('0x3')]=_0x315fe2[_0xb99f('0x3')]||0x0;this[_0xb99f('0x1a')]=_0x315fe2[_0xb99f('0x1a')];this[_0xb99f('0x10')]=_0x315fe2[_0xb99f('0x10')];this[_0xb99f('0x11')]=_0x315fe2[_0xb99f('0x11')];this[_0xb99f('0x1b')]=_0x315fe2['sumHoldTime']||0x0;this['talking']=_0x315fe2[_0xb99f('0x4')]||0x0;this[_0xb99f('0x12')]=_0x315fe2[_0xb99f('0x12')]||0x0;this[_0xb99f('0x1c')]=_0x315fe2[_0xb99f('0x1c')];this[_0xb99f('0x1d')]=_0x315fe2[_0xb99f('0x1d')]||0x0;this[_0xb99f('0x1e')]=_0x315fe2[_0xb99f('0x1e')]||0x0;this[_0xb99f('0x1f')]=_0x315fe2[_0xb99f('0x1f')]||0x0;this['waiting']=_0x315fe2[_0xb99f('0x5')]||0x0;if(_0x315fe2[_0xb99f('0x1c')]===_0xb99f('0x20')){this[_0xb99f('0xf')]=_0x315fe2['pTalking']||0x0;this['dialActive']=_0x315fe2[_0xb99f('0x21')];this[_0xb99f('0x22')]=_0x315fe2['dialMethod'];this[_0xb99f('0x23')]=_0x315fe2[_0xb99f('0x23')];this[_0xb99f('0x24')]=_0x315fe2[_0xb99f('0x24')];this[_0xb99f('0x25')]=_0x315fe2[_0xb99f('0x25')];this[_0xb99f('0x26')]=_0x315fe2[_0xb99f('0x26')];this['temp']=_0x315fe2[_0xb99f('0x27')];this['outboundAnswerAgiCallsDay']=_0x315fe2[_0xb99f('0x28')];this[_0xb99f('0x29')]=_0x315fe2[_0xb99f('0x29')];this[_0xb99f('0xa')]=_0x315fe2[_0xb99f('0xa')];this[_0xb99f('0x2a')]=_0x315fe2[_0xb99f('0x2a')];this[_0xb99f('0xb')]=_0x315fe2['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x315fe2[_0xb99f('0x2b')];this[_0xb99f('0x2c')]=_0x315fe2[_0xb99f('0x2c')];this[_0xb99f('0x2d')]=_0x315fe2['outboundDropCallsDayTimeout'];this[_0xb99f('0x2e')]=_0x315fe2[_0xb99f('0x2e')];this[_0xb99f('0xc')]=_0x315fe2['outboundNoSuchCallsDay'];this[_0xb99f('0x2f')]=_0x315fe2[_0xb99f('0x2f')];this[_0xb99f('0xd')]=_0x315fe2[_0xb99f('0xd')];this[_0xb99f('0x30')]=_0x315fe2[_0xb99f('0x30')];this['outboundUnknownCallsDay']=_0x315fe2[_0xb99f('0xe')];this[_0xb99f('0x31')]=_0x315fe2[_0xb99f('0x31')];this[_0xb99f('0x32')]=_0x315fe2[_0xb99f('0x32')];this['predictiveIntervalAvgTalktime']=_0x315fe2[_0xb99f('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x315fe2[_0xb99f('0x34')];this[_0xb99f('0x35')]=_0x315fe2['predictiveIntervalDroppedCallsTimeout'];this[_0xb99f('0x36')]=_0x315fe2[_0xb99f('0x36')];this[_0xb99f('0x37')]=_0x315fe2[_0xb99f('0x37')];this[_0xb99f('0x38')]=_0x315fe2[_0xb99f('0x38')];this[_0xb99f('0x39')]=_0x315fe2['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x315fe2['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x315fe2[_0xb99f('0x3a')];this[_0xb99f('0x3b')]=_0x315fe2[_0xb99f('0x3b')];this['originated']=_0x315fe2[_0xb99f('0x8')];this['erlangCalls']=_0x315fe2[_0xb99f('0x3c')];this[_0xb99f('0x3d')]=_0x315fe2[_0xb99f('0x3d')];this['erlangAbandonmentRate']=_0x315fe2[_0xb99f('0x3e')];this[_0xb99f('0x3f')]=_0x315fe2[_0xb99f('0x3f')];this[_0xb99f('0x40')]=_0x315fe2[_0xb99f('0x40')];this[_0xb99f('0x41')]=_0x315fe2[_0xb99f('0x41')];this[_0xb99f('0x42')]=_0x315fe2[_0xb99f('0x42')];this['statusMessage']=_0x315fe2[_0xb99f('0x43')];}if(_0x315fe2[_0xb99f('0x44')]){this[_0xb99f('0x44')]={'id':_0x315fe2[_0xb99f('0x44')]['id'],'name':_0x315fe2[_0xb99f('0x44')][_0xb99f('0x45')],'active':_0x315fe2[_0xb99f('0x44')][_0xb99f('0x46')],'callerid':_0x315fe2[_0xb99f('0x44')][_0xb99f('0x47')]};}}VoiceQueueSummary[_0xb99f('0x48')][_0xb99f('0x49')]=function(_0xde4a32,_0x3796f8,_0x566b61,_0x5cf441){this[_0xb99f('0x1')]=0x0;this[_0xb99f('0x4')]=0x0;this['paused']=0x0;this[_0xb99f('0x1e')]=0x0;this[_0xb99f('0x19')]=0x0;this['inUse']=0x0;this[_0xb99f('0x15')]=0x0;this[_0xb99f('0x16')]=0x0;this[_0xb99f('0x1d')]=0x0;this[_0xb99f('0x3')]=0x0;this['ringInUse']=0x0;this[_0xb99f('0x18')]=0x0;if(_0x566b61){if(_0x566b61[_0xb99f('0x0')]){this['available']=Number(_0x566b61[_0xb99f('0x0')]);}if(_0x566b61[_0xb99f('0x4a')]){this[_0xb99f('0x17')]=Number(_0x566b61[_0xb99f('0x4a')]);}if(_0x566b61[_0xb99f('0x4b')]){this['waiting']=Number(_0x566b61[_0xb99f('0x4b')]);}}for(var _0x73757b=0x0;_0x73757b<_0xde4a32[_0xb99f('0x4c')];_0x73757b++){var _0x12dcac=_0x3796f8[_0xb99f('0x4d')+_0xde4a32[_0x73757b][_0xb99f('0x45')]];if(_0x12dcac&&_0x12dcac[_0xb99f('0x4e')]){this['loggedInDb']+=0x1;}if(_0xde4a32[_0x73757b]['incall']==='1'){this[_0xb99f('0x4')]+=0x1;}if(_0xde4a32[_0x73757b][_0xb99f('0x2')]==='1'&&!['2','7','8'][_0xb99f('0x4f')](_0xde4a32[_0x73757b]['status'])){this[_0xb99f('0x2')]+=0x1;}switch(_0xde4a32[_0x73757b]['status']){case'0':this[_0xb99f('0x1e')]+=0x1;break;case'1':this[_0xb99f('0x19')]+=0x1;break;case'2':this[_0xb99f('0x7')]+=0x1;break;case'3':this[_0xb99f('0x15')]+=0x1;break;case'4':this[_0xb99f('0x16')]+=0x1;break;case'5':this[_0xb99f('0x1d')]+=0x1;break;case'6':this[_0xb99f('0x3')]+=0x1;break;case'7':this[_0xb99f('0x1a')]+=0x1;break;case'8':this[_0xb99f('0x18')]+=0x1;break;}}if(this[_0xb99f('0x22')]===_0xb99f('0x50')){var _0x3e875c=Object[_0xb99f('0x51')](_0x5cf441);for(var _0x5eda52=0x0;_0x5eda52<_0x3e875c[_0xb99f('0x4c')];_0x5eda52++){var _0x2a29ff=_0x3e875c[_0x5eda52];var _0x2ff6cc=_0x5cf441[_0x2a29ff];if(_0x2ff6cc[_0xb99f('0x52')]===this['name']&&_0x2ff6cc['type']===_0xb99f('0x53')&&_0x2ff6cc[_0xb99f('0x54')]===_0xb99f('0x55')){this['talking']+=0x1;}}if(this['talking']>this[_0xb99f('0x7')]){this[_0xb99f('0x4')]=this[_0xb99f('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xb99f('0x48')][_0xb99f('0x56')]=function(_0x57558b){var _0x43c0aa=![];if(_0x57558b){_0x43c0aa=INBOUND_COUNTERS[_0xb99f('0x57')](function(_0x572bca){return this[_0x572bca]!==_0x57558b[_0x572bca];},this);}return _0x43c0aa;};VoiceQueueSummary[_0xb99f('0x48')][_0xb99f('0x58')]=function(_0x3c9cd1){var _0x56b92b=![];var _0x571d66=![];var _0x58cb6e=![];if(_0x3c9cd1){_0x56b92b=this[_0xb99f('0x22')]!==_0x3c9cd1['dialMethod']||this[_0xb99f('0x21')]!==_0x3c9cd1[_0xb99f('0x21')]||this[_0xb99f('0x42')]!==_0x3c9cd1[_0xb99f('0x42')]||this[_0xb99f('0x43')]!==_0x3c9cd1[_0xb99f('0x43')];_0x571d66=OUTBOUND_COUNTERS[_0xb99f('0x57')](function(_0x5d1649){return this[_0x5d1649]!==_0x3c9cd1[_0x5d1649];},this);if(this['Trunk']&&_0x3c9cd1[_0xb99f('0x44')]){_0x58cb6e=this['Trunk']['name']!==_0x3c9cd1[_0xb99f('0x44')][_0xb99f('0x45')]||this[_0xb99f('0x44')][_0xb99f('0x46')]!==_0x3c9cd1[_0xb99f('0x44')][_0xb99f('0x46')];}}return _0x56b92b||_0x571d66||_0x58cb6e;};VoiceQueueSummary['prototype'][_0xb99f('0x59')]=function(_0x1a144a){this[_0xb99f('0x6')]=_0x1a144a['answered'];this[_0xb99f('0x42')]=_0x1a144a[_0xb99f('0x42')];this[_0xb99f('0x43')]=_0x1a144a[_0xb99f('0x43')];this[_0xb99f('0x8')]=_0x1a144a[_0xb99f('0x8')];this[_0xb99f('0x9')]=_0x1a144a[_0xb99f('0x9')];this[_0xb99f('0x29')]=_0x1a144a[_0xb99f('0x29')];this[_0xb99f('0xa')]=_0x1a144a[_0xb99f('0xa')];this['outboundBusyCallsDay']=_0x1a144a[_0xb99f('0x2a')];this['outboundCongestionCallsDay']=_0x1a144a[_0xb99f('0xb')];this[_0xb99f('0x2e')]=_0x1a144a[_0xb99f('0x2e')];this['outboundNoSuchCallsDay']=_0x1a144a[_0xb99f('0xc')];this['outboundReCallsDay']=_0x1a144a[_0xb99f('0xd')];this[_0xb99f('0x30')]=_0x1a144a[_0xb99f('0x30')];this[_0xb99f('0xe')]=_0x1a144a['outboundUnknownCallsDay'];this['sumBillable']=_0x1a144a[_0xb99f('0x10')];this[_0xb99f('0x11')]=_0x1a144a[_0xb99f('0x11')];this[_0xb99f('0x12')]=_0x1a144a[_0xb99f('0x12')];if(this[_0xb99f('0x22')]==='preview'){this[_0xb99f('0xf')]=_0x1a144a[_0xb99f('0xf')];}};module[_0xb99f('0x5a')]=VoiceQueueSummary;