Built motion from commit d1eab355.|2.6.28
[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 _0x0f4d=['predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','invalid','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','active','outboundAbandonedCallsDay','preview','exports','paused','talking','waiting','available','answered','inUse','loggedIn','loggedInDb','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','total','name','strategy','abandoned','busy','onHold','notInUse','ringing','ringInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses'];(function(_0xc1bee0,_0x1ba3ab){var _0x5e15cf=function(_0x268159){while(--_0x268159){_0xc1bee0['push'](_0xc1bee0['shift']());}};_0x5e15cf(++_0x1ba3ab);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x416d7a,_0x508c1c){_0x416d7a=_0x416d7a-0x0;var _0x3a403b=_0x0f4d[_0x416d7a];return _0x3a403b;};'use strict';var INBOUND_COUNTERS=['available','loggedIn','loggedInDb',_0xd0f4('0x0'),'ringing',_0xd0f4('0x1'),_0xd0f4('0x2')];var OUTBOUND_COUNTERS=[_0xd0f4('0x3'),_0xd0f4('0x4'),_0xd0f4('0x5'),_0xd0f4('0x6'),_0xd0f4('0x7'),_0xd0f4('0x8'),'outboundAbandonedCallsDay',_0xd0f4('0x9'),_0xd0f4('0xa'),'outboundBusyCallsDay',_0xd0f4('0xb'),_0xd0f4('0xc'),'outboundNoSuchCallsDay',_0xd0f4('0xd'),_0xd0f4('0xe'),'outboundUnknownCallsDay',_0xd0f4('0x0'),_0xd0f4('0xf'),_0xd0f4('0x1'),'sumBillable','sumDuration',_0xd0f4('0x10'),_0xd0f4('0x2')];function VoiceQueueSummary(_0x288388){this['id']=_0x288388['id'];this[_0xd0f4('0x11')]=_0x288388[_0xd0f4('0x11')];this[_0xd0f4('0x12')]=_0x288388[_0xd0f4('0x12')];this['abandoned']=_0x288388[_0xd0f4('0x13')]||0x0;this[_0xd0f4('0x4')]=_0x288388['answered']||0x0;this[_0xd0f4('0x3')]=_0x288388['available']||0x0;this[_0xd0f4('0x14')]=_0x288388['busy']||0x0;this[_0xd0f4('0x5')]=_0x288388['inUse']||0x0;this['invalid']=_0x288388['invalid']||0x0;this[_0xd0f4('0x6')]=_0x288388[_0xd0f4('0x6')]||0x0;this[_0xd0f4('0x7')]=_0x288388[_0xd0f4('0x7')]||0x0;this[_0xd0f4('0x15')]=_0x288388[_0xd0f4('0x15')]||0x0;this[_0xd0f4('0x16')]=_0x288388[_0xd0f4('0x16')]||0x0;this[_0xd0f4('0x0')]=_0x288388['paused']||0x0;this[_0xd0f4('0x17')]=_0x288388[_0xd0f4('0x17')]||0x0;this[_0xd0f4('0x18')]=_0x288388[_0xd0f4('0x18')];this['sumBillable']=_0x288388[_0xd0f4('0x19')];this[_0xd0f4('0x1a')]=_0x288388[_0xd0f4('0x1a')];this[_0xd0f4('0x1b')]=_0x288388['sumHoldTime']||0x0;this[_0xd0f4('0x1')]=_0x288388[_0xd0f4('0x1')]||0x0;this[_0xd0f4('0x10')]=_0x288388[_0xd0f4('0x10')]||0x0;this[_0xd0f4('0x1c')]=_0x288388[_0xd0f4('0x1c')];this[_0xd0f4('0x1d')]=_0x288388['unavailable']||0x0;this[_0xd0f4('0x1e')]=_0x288388[_0xd0f4('0x1e')]||0x0;this[_0xd0f4('0x1f')]=_0x288388[_0xd0f4('0x1f')]||0x0;this['waiting']=_0x288388[_0xd0f4('0x2')]||0x0;if(_0x288388['type']===_0xd0f4('0x20')){this[_0xd0f4('0xf')]=_0x288388[_0xd0f4('0xf')]||0x0;this['dialActive']=_0x288388[_0xd0f4('0x21')];this[_0xd0f4('0x22')]=_0x288388[_0xd0f4('0x22')];this[_0xd0f4('0x23')]=_0x288388[_0xd0f4('0x23')];this['dialOriginateCallerIdNumber']=_0x288388[_0xd0f4('0x24')];this[_0xd0f4('0x25')]=_0x288388[_0xd0f4('0x25')];this[_0xd0f4('0x26')]=_0x288388[_0xd0f4('0x26')];this[_0xd0f4('0x27')]=_0x288388[_0xd0f4('0x27')];this[_0xd0f4('0x28')]=_0x288388[_0xd0f4('0x28')];this['outboundAnswerCallsDay']=_0x288388[_0xd0f4('0x9')];this[_0xd0f4('0xa')]=_0x288388[_0xd0f4('0xa')];this[_0xd0f4('0x29')]=_0x288388['outboundBusyCallsDay'];this[_0xd0f4('0xb')]=_0x288388['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x288388['outboundDropCallsDayACS'];this[_0xd0f4('0x2a')]=_0x288388[_0xd0f4('0x2a')];this[_0xd0f4('0x2b')]=_0x288388[_0xd0f4('0x2b')];this[_0xd0f4('0xc')]=_0x288388[_0xd0f4('0xc')];this[_0xd0f4('0x2c')]=_0x288388[_0xd0f4('0x2c')];this['outboundOriginateFailureCallsDay']=_0x288388[_0xd0f4('0x2d')];this['outboundReCallsDay']=_0x288388[_0xd0f4('0xd')];this[_0xd0f4('0xe')]=_0x288388['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x288388[_0xd0f4('0x2e')];this['predictiveIntervalAnsweredCalls']=_0x288388[_0xd0f4('0x2f')];this[_0xd0f4('0x30')]=_0x288388['predictiveIntervalAvgHoldtime'];this[_0xd0f4('0x31')]=_0x288388[_0xd0f4('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x288388['predictiveIntervalDroppedCallsCallersExit'];this[_0xd0f4('0x32')]=_0x288388[_0xd0f4('0x32')];this['predictiveIntervalErlangCalls']=_0x288388[_0xd0f4('0x33')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x288388[_0xd0f4('0x34')];this[_0xd0f4('0x35')]=_0x288388['predictiveIntervalHitRate'];this[_0xd0f4('0x36')]=_0x288388[_0xd0f4('0x36')];this[_0xd0f4('0x37')]=_0x288388[_0xd0f4('0x37')];this[_0xd0f4('0x38')]=_0x288388['predictiveIntervalAvailable'];this[_0xd0f4('0x39')]=_0x288388[_0xd0f4('0x39')];this[_0xd0f4('0x8')]=_0x288388[_0xd0f4('0x8')];this['erlangCalls']=_0x288388[_0xd0f4('0x3a')];this[_0xd0f4('0x3b')]=_0x288388[_0xd0f4('0x3b')];this[_0xd0f4('0x3c')]=_0x288388[_0xd0f4('0x3c')];this[_0xd0f4('0x3d')]=_0x288388['erlangBusyFactor'];this[_0xd0f4('0x3e')]=_0x288388[_0xd0f4('0x3e')];this[_0xd0f4('0x3f')]=_0x288388['startProgressive'];this[_0xd0f4('0x40')]=_0x288388[_0xd0f4('0x40')];this['statusMessage']=_0x288388[_0xd0f4('0x41')];}if(_0x288388[_0xd0f4('0x42')]){this['Trunk']={'id':_0x288388['Trunk']['id'],'name':_0x288388[_0xd0f4('0x42')][_0xd0f4('0x11')],'active':_0x288388[_0xd0f4('0x42')]['active'],'callerid':_0x288388[_0xd0f4('0x42')]['callerid']};}}VoiceQueueSummary[_0xd0f4('0x43')]['createReport']=function(_0x29439d,_0x3f411e,_0x4492d1,_0x403a45){this['loggedInDb']=0x0;this[_0xd0f4('0x1')]=0x0;this[_0xd0f4('0x0')]=0x0;this[_0xd0f4('0x1e')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xd0f4('0x14')]=0x0;this[_0xd0f4('0x44')]=0x0;this[_0xd0f4('0x1d')]=0x0;this[_0xd0f4('0x17')]=0x0;this[_0xd0f4('0x18')]=0x0;this[_0xd0f4('0x15')]=0x0;if(_0x4492d1){if(_0x4492d1[_0xd0f4('0x3')]){this[_0xd0f4('0x3')]=Number(_0x4492d1[_0xd0f4('0x3')]);}if(_0x4492d1[_0xd0f4('0x45')]){this[_0xd0f4('0x6')]=Number(_0x4492d1[_0xd0f4('0x45')]);}if(_0x4492d1['callers']){this[_0xd0f4('0x2')]=Number(_0x4492d1[_0xd0f4('0x46')]);}}for(var _0x4dc71c=0x0;_0x4dc71c<_0x29439d[_0xd0f4('0x47')];_0x4dc71c++){var _0xfcecb0=_0x3f411e[_0xd0f4('0x48')+_0x29439d[_0x4dc71c][_0xd0f4('0x11')]];if(_0xfcecb0&&_0xfcecb0[_0xd0f4('0x49')]){this[_0xd0f4('0x7')]+=0x1;}if(_0x29439d[_0x4dc71c][_0xd0f4('0x4a')]==='1'){this['talking']+=0x1;}if(_0x29439d[_0x4dc71c][_0xd0f4('0x0')]==='1'&&!['2','7','8'][_0xd0f4('0x4b')](_0x29439d[_0x4dc71c][_0xd0f4('0x4c')])){this['paused']+=0x1;}switch(_0x29439d[_0x4dc71c][_0xd0f4('0x4c')]){case'0':this[_0xd0f4('0x1e')]+=0x1;break;case'1':this[_0xd0f4('0x16')]+=0x1;break;case'2':this[_0xd0f4('0x5')]+=0x1;break;case'3':this[_0xd0f4('0x14')]+=0x1;break;case'4':this[_0xd0f4('0x44')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xd0f4('0x18')]+=0x1;break;case'8':this[_0xd0f4('0x15')]+=0x1;break;}}if(this[_0xd0f4('0x22')]===_0xd0f4('0x4d')){var _0x5da831=Object[_0xd0f4('0x4e')](_0x403a45);for(var _0x1b1baa=0x0;_0x1b1baa<_0x5da831['length'];_0x1b1baa++){var _0x5c9549=_0x5da831[_0x1b1baa];var _0xc452d0=_0x403a45[_0x5c9549];if(_0xc452d0[_0xd0f4('0x4f')]===this[_0xd0f4('0x11')]&&_0xc452d0[_0xd0f4('0x1c')]===_0xd0f4('0x50')&&_0xc452d0[_0xd0f4('0x51')]===_0xd0f4('0x52')){this[_0xd0f4('0x1')]+=0x1;}}if(this[_0xd0f4('0x1')]>this[_0xd0f4('0x5')]){this[_0xd0f4('0x1')]=this[_0xd0f4('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xd0f4('0x43')][_0xd0f4('0x53')]=function(_0x94b945){var _0x52fb3d=![];if(_0x94b945){_0x52fb3d=INBOUND_COUNTERS[_0xd0f4('0x54')](function(_0x3f8bcc){return this[_0x3f8bcc]!==_0x94b945[_0x3f8bcc];},this);}return _0x52fb3d;};VoiceQueueSummary[_0xd0f4('0x43')]['compareToOutboundQueue']=function(_0x1f14bd){var _0x582449=![];var _0x3bc6e7=![];var _0x4fdddb=![];if(_0x1f14bd){_0x582449=this['dialMethod']!==_0x1f14bd[_0xd0f4('0x22')]||this[_0xd0f4('0x21')]!==_0x1f14bd[_0xd0f4('0x21')]||this[_0xd0f4('0x40')]!==_0x1f14bd[_0xd0f4('0x40')]||this[_0xd0f4('0x41')]!==_0x1f14bd['statusMessage'];_0x3bc6e7=OUTBOUND_COUNTERS[_0xd0f4('0x54')](function(_0xfa6554){return this[_0xfa6554]!==_0x1f14bd[_0xfa6554];},this);if(this[_0xd0f4('0x42')]&&_0x1f14bd[_0xd0f4('0x42')]){_0x4fdddb=this[_0xd0f4('0x42')][_0xd0f4('0x11')]!==_0x1f14bd['Trunk'][_0xd0f4('0x11')]||this['Trunk']['active']!==_0x1f14bd[_0xd0f4('0x42')][_0xd0f4('0x55')];}}return _0x582449||_0x3bc6e7||_0x4fdddb;};VoiceQueueSummary[_0xd0f4('0x43')]['updateReportFromOutboundQueue']=function(_0x1ccf7a){this[_0xd0f4('0x4')]=_0x1ccf7a[_0xd0f4('0x4')];this[_0xd0f4('0x40')]=_0x1ccf7a[_0xd0f4('0x40')];this[_0xd0f4('0x41')]=_0x1ccf7a[_0xd0f4('0x41')];this[_0xd0f4('0x8')]=_0x1ccf7a[_0xd0f4('0x8')];this[_0xd0f4('0x56')]=_0x1ccf7a['outboundAbandonedCallsDay'];this[_0xd0f4('0x9')]=_0x1ccf7a[_0xd0f4('0x9')];this[_0xd0f4('0xa')]=_0x1ccf7a[_0xd0f4('0xa')];this['outboundBusyCallsDay']=_0x1ccf7a[_0xd0f4('0x29')];this[_0xd0f4('0xb')]=_0x1ccf7a[_0xd0f4('0xb')];this[_0xd0f4('0xc')]=_0x1ccf7a[_0xd0f4('0xc')];this[_0xd0f4('0x2c')]=_0x1ccf7a['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1ccf7a[_0xd0f4('0xd')];this[_0xd0f4('0xe')]=_0x1ccf7a[_0xd0f4('0xe')];this[_0xd0f4('0x2e')]=_0x1ccf7a[_0xd0f4('0x2e')];this[_0xd0f4('0x19')]=_0x1ccf7a['sumBillable'];this[_0xd0f4('0x1a')]=_0x1ccf7a[_0xd0f4('0x1a')];this[_0xd0f4('0x10')]=_0x1ccf7a['total'];if(this[_0xd0f4('0x22')]===_0xd0f4('0x57')){this['pTalking']=_0x1ccf7a['pTalking'];}};module[_0xd0f4('0x58')]=VoiceQueueSummary;