d9a19980396fa02c2c8ba18dd1049a0e782ed629
[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 _0x08d9=['startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','createReport','busy','callers','length','SIP/','online','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','exports','available','loggedInDb','ringing','talking','waiting','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','strategy','abandoned','answered','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x48b122,_0x2e66d2){var _0x5f573a=function(_0x3b0901){while(--_0x3b0901){_0x48b122['push'](_0x48b122['shift']());}};_0x5f573a(++_0x2e66d2);}(_0x08d9,0xc2));var _0x908d=function(_0x2af191,_0x243faa){_0x2af191=_0x2af191-0x0;var _0x4fe5af=_0x08d9[_0x2af191];return _0x4fe5af;};'use strict';var INBOUND_COUNTERS=[_0x908d('0x0'),'loggedIn',_0x908d('0x1'),'paused',_0x908d('0x2'),_0x908d('0x3'),_0x908d('0x4')];var OUTBOUND_COUNTERS=['available','answered',_0x908d('0x5'),_0x908d('0x6'),_0x908d('0x1'),_0x908d('0x7'),_0x908d('0x8'),'outboundAnswerCallsDay',_0x908d('0x9'),_0x908d('0xa'),_0x908d('0xb'),_0x908d('0xc'),_0x908d('0xd'),_0x908d('0xe'),_0x908d('0xf'),_0x908d('0x10'),_0x908d('0x11'),_0x908d('0x12'),'talking',_0x908d('0x13'),_0x908d('0x14'),_0x908d('0x15'),_0x908d('0x4')];function VoiceQueueSummary(_0xf39c48){this['id']=_0xf39c48['id'];this['name']=_0xf39c48['name'];this['strategy']=_0xf39c48[_0x908d('0x16')];this[_0x908d('0x17')]=_0xf39c48[_0x908d('0x17')]||0x0;this[_0x908d('0x18')]=_0xf39c48[_0x908d('0x18')]||0x0;this[_0x908d('0x0')]=_0xf39c48[_0x908d('0x0')]||0x0;this['busy']=_0xf39c48['busy']||0x0;this[_0x908d('0x5')]=_0xf39c48[_0x908d('0x5')]||0x0;this[_0x908d('0x19')]=_0xf39c48[_0x908d('0x19')]||0x0;this['loggedIn']=_0xf39c48['loggedIn']||0x0;this[_0x908d('0x1')]=_0xf39c48[_0x908d('0x1')]||0x0;this[_0x908d('0x1a')]=_0xf39c48[_0x908d('0x1a')]||0x0;this['notInUse']=_0xf39c48[_0x908d('0x1b')]||0x0;this[_0x908d('0x11')]=_0xf39c48[_0x908d('0x11')]||0x0;this[_0x908d('0x2')]=_0xf39c48[_0x908d('0x2')]||0x0;this[_0x908d('0x1c')]=_0xf39c48[_0x908d('0x1c')];this['sumBillable']=_0xf39c48[_0x908d('0x13')];this[_0x908d('0x14')]=_0xf39c48[_0x908d('0x14')];this['sumHoldTime']=_0xf39c48[_0x908d('0x1d')]||0x0;this[_0x908d('0x3')]=_0xf39c48[_0x908d('0x3')]||0x0;this[_0x908d('0x15')]=_0xf39c48[_0x908d('0x15')]||0x0;this['type']=_0xf39c48[_0x908d('0x1e')];this['unavailable']=_0xf39c48[_0x908d('0x1f')]||0x0;this[_0x908d('0x20')]=_0xf39c48[_0x908d('0x20')]||0x0;this[_0x908d('0x21')]=_0xf39c48[_0x908d('0x21')]||0x0;this[_0x908d('0x4')]=_0xf39c48[_0x908d('0x4')]||0x0;if(_0xf39c48[_0x908d('0x1e')]==='outbound'){this[_0x908d('0x12')]=_0xf39c48[_0x908d('0x12')]||0x0;this[_0x908d('0x22')]=_0xf39c48[_0x908d('0x22')];this[_0x908d('0x23')]=_0xf39c48['dialMethod'];this['dialOriginateCallerIdName']=_0xf39c48[_0x908d('0x24')];this[_0x908d('0x25')]=_0xf39c48[_0x908d('0x25')];this[_0x908d('0x26')]=_0xf39c48[_0x908d('0x26')];this['dialPrefix']=_0xf39c48[_0x908d('0x27')];this[_0x908d('0x28')]=_0xf39c48['temp'];this[_0x908d('0x29')]=_0xf39c48[_0x908d('0x29')];this[_0x908d('0x2a')]=_0xf39c48[_0x908d('0x2a')];this[_0x908d('0x9')]=_0xf39c48[_0x908d('0x9')];this[_0x908d('0xa')]=_0xf39c48[_0x908d('0xa')];this[_0x908d('0xb')]=_0xf39c48[_0x908d('0xb')];this[_0x908d('0x2b')]=_0xf39c48['outboundDropCallsDayACS'];this[_0x908d('0x2c')]=_0xf39c48[_0x908d('0x2c')];this[_0x908d('0x2d')]=_0xf39c48[_0x908d('0x2d')];this['outboundNoAnswerCallsDay']=_0xf39c48[_0x908d('0xc')];this[_0x908d('0xd')]=_0xf39c48[_0x908d('0xd')];this[_0x908d('0x2e')]=_0xf39c48[_0x908d('0x2e')];this[_0x908d('0xe')]=_0xf39c48[_0x908d('0xe')];this[_0x908d('0xf')]=_0xf39c48[_0x908d('0xf')];this[_0x908d('0x10')]=_0xf39c48[_0x908d('0x10')];this['predictiveIntervalAnsweredCalls']=_0xf39c48['predictiveIntervalAnsweredCalls'];this[_0x908d('0x2f')]=_0xf39c48[_0x908d('0x2f')];this['predictiveIntervalAvgTalktime']=_0xf39c48['predictiveIntervalAvgTalktime'];this[_0x908d('0x30')]=_0xf39c48[_0x908d('0x30')];this[_0x908d('0x31')]=_0xf39c48[_0x908d('0x31')];this[_0x908d('0x32')]=_0xf39c48['predictiveIntervalErlangCalls'];this[_0x908d('0x33')]=_0xf39c48[_0x908d('0x33')];this[_0x908d('0x34')]=_0xf39c48[_0x908d('0x34')];this[_0x908d('0x35')]=_0xf39c48['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0xf39c48[_0x908d('0x36')];this['predictiveIntervalAvailable']=_0xf39c48[_0x908d('0x37')];this[_0x908d('0x38')]=_0xf39c48[_0x908d('0x38')];this[_0x908d('0x7')]=_0xf39c48[_0x908d('0x7')];this[_0x908d('0x39')]=_0xf39c48[_0x908d('0x39')];this[_0x908d('0x3a')]=_0xf39c48['erlangCallToSecond'];this['erlangAbandonmentRate']=_0xf39c48[_0x908d('0x3b')];this[_0x908d('0x3c')]=_0xf39c48[_0x908d('0x3c')];this['startPredictive']=_0xf39c48['startPredictive'];this['startProgressive']=_0xf39c48[_0x908d('0x3d')];this['message']=_0xf39c48[_0x908d('0x3e')];this[_0x908d('0x3f')]=_0xf39c48[_0x908d('0x3f')];}if(_0xf39c48['Trunk']){this['Trunk']={'id':_0xf39c48['Trunk']['id'],'name':_0xf39c48[_0x908d('0x40')][_0x908d('0x41')],'active':_0xf39c48['Trunk'][_0x908d('0x42')],'callerid':_0xf39c48['Trunk'][_0x908d('0x43')]};}}VoiceQueueSummary[_0x908d('0x44')][_0x908d('0x45')]=function(_0x5bf839,_0x24dc93,_0x375d21,_0xd48ecd){this[_0x908d('0x1')]=0x0;this['talking']=0x0;this[_0x908d('0x11')]=0x0;this[_0x908d('0x20')]=0x0;this[_0x908d('0x1b')]=0x0;this[_0x908d('0x5')]=0x0;this[_0x908d('0x46')]=0x0;this['invalid']=0x0;this[_0x908d('0x1f')]=0x0;this[_0x908d('0x2')]=0x0;this[_0x908d('0x1c')]=0x0;this[_0x908d('0x1a')]=0x0;if(_0x375d21){if(_0x375d21[_0x908d('0x0')]){this[_0x908d('0x0')]=Number(_0x375d21['available']);}if(_0x375d21['loggedin']){this[_0x908d('0x6')]=Number(_0x375d21['loggedin']);}if(_0x375d21[_0x908d('0x47')]){this[_0x908d('0x4')]=Number(_0x375d21['callers']);}}for(var _0xe527c1=0x0;_0xe527c1<_0x5bf839[_0x908d('0x48')];_0xe527c1++){var _0x53dccb=_0x24dc93[_0x908d('0x49')+_0x5bf839[_0xe527c1][_0x908d('0x41')]];if(_0x53dccb&&_0x53dccb[_0x908d('0x4a')]){this[_0x908d('0x1')]+=0x1;}if(_0x5bf839[_0xe527c1]['incall']==='1'){this[_0x908d('0x3')]+=0x1;}if(_0x5bf839[_0xe527c1]['paused']==='1'&&!['2','7','8'][_0x908d('0x4b')](_0x5bf839[_0xe527c1][_0x908d('0x4c')])){this['paused']+=0x1;}switch(_0x5bf839[_0xe527c1][_0x908d('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x908d('0x5')]+=0x1;break;case'3':this[_0x908d('0x46')]+=0x1;break;case'4':this[_0x908d('0x19')]+=0x1;break;case'5':this[_0x908d('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x908d('0x23')]===_0x908d('0x4d')){var _0x41c502=Object[_0x908d('0x4e')](_0xd48ecd);for(var _0x44d091=0x0;_0x44d091<_0x41c502[_0x908d('0x48')];_0x44d091++){var _0x3f5d4f=_0x41c502[_0x44d091];var _0x32ee94=_0xd48ecd[_0x3f5d4f];if(_0x32ee94['queue']===this[_0x908d('0x41')]&&_0x32ee94['type']===_0x908d('0x4f')&&_0x32ee94[_0x908d('0x50')]===_0x908d('0x51')){this[_0x908d('0x3')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x908d('0x3')]=this[_0x908d('0x5')];}this[_0x908d('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x908d('0x44')][_0x908d('0x52')]=function(_0x32404b){var _0x27f91a=![];if(_0x32404b){_0x27f91a=INBOUND_COUNTERS[_0x908d('0x53')](function(_0x176039){return this[_0x176039]!==_0x32404b[_0x176039];},this);}return _0x27f91a;};VoiceQueueSummary[_0x908d('0x44')]['compareToOutboundQueue']=function(_0x160a65){var _0x3a357f=![];var _0x4d8abe=![];var _0x5d98f8=![];if(_0x160a65){_0x3a357f=this[_0x908d('0x23')]!==_0x160a65['dialMethod']||this[_0x908d('0x22')]!==_0x160a65[_0x908d('0x22')]||this['message']!==_0x160a65['message']||this[_0x908d('0x3f')]!==_0x160a65[_0x908d('0x3f')];_0x4d8abe=OUTBOUND_COUNTERS['some'](function(_0x38936d){return this[_0x38936d]!==_0x160a65[_0x38936d];},this);if(this[_0x908d('0x40')]&&_0x160a65[_0x908d('0x40')]){_0x5d98f8=this[_0x908d('0x40')][_0x908d('0x41')]!==_0x160a65[_0x908d('0x40')][_0x908d('0x41')]||this[_0x908d('0x40')][_0x908d('0x42')]!==_0x160a65[_0x908d('0x40')][_0x908d('0x42')];}}return _0x3a357f||_0x4d8abe||_0x5d98f8;};VoiceQueueSummary[_0x908d('0x44')]['updateReportFromOutboundQueue']=function(_0x501fc7){this[_0x908d('0x18')]=_0x501fc7['answered'];this[_0x908d('0x3e')]=_0x501fc7[_0x908d('0x3e')];this[_0x908d('0x3f')]=_0x501fc7[_0x908d('0x3f')];this[_0x908d('0x7')]=_0x501fc7[_0x908d('0x7')];this[_0x908d('0x8')]=_0x501fc7[_0x908d('0x8')];this[_0x908d('0x2a')]=_0x501fc7[_0x908d('0x2a')];this['outboundBlacklistCallsDay']=_0x501fc7[_0x908d('0x9')];this[_0x908d('0xa')]=_0x501fc7[_0x908d('0xa')];this[_0x908d('0xb')]=_0x501fc7[_0x908d('0xb')];this[_0x908d('0xc')]=_0x501fc7['outboundNoAnswerCallsDay'];this[_0x908d('0xd')]=_0x501fc7['outboundNoSuchCallsDay'];this[_0x908d('0xe')]=_0x501fc7[_0x908d('0xe')];this[_0x908d('0xf')]=_0x501fc7[_0x908d('0xf')];this[_0x908d('0x10')]=_0x501fc7[_0x908d('0x10')];this['sumBillable']=_0x501fc7[_0x908d('0x13')];this[_0x908d('0x14')]=_0x501fc7[_0x908d('0x14')];this[_0x908d('0x15')]=_0x501fc7[_0x908d('0x15')];if(this[_0x908d('0x23')]==='preview'){this[_0x908d('0x12')]=_0x501fc7[_0x908d('0x12')];}};module[_0x908d('0x54')]=VoiceQueueSummary;