Built motion from commit b0a9a629.|2.6.33
[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 _0xbcc7=['ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','talking','loggedin','callers','length','online','incall','status','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','updateReportFromOutboundQueue','preview','available','loggedIn','paused','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing'];(function(_0x19b052,_0x377aaf){var _0x47e39f=function(_0x221b30){while(--_0x221b30){_0x19b052['push'](_0x19b052['shift']());}};_0x47e39f(++_0x377aaf);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x46ab39,_0x231cb6){_0x46ab39=_0x46ab39-0x0;var _0x459b2e=_0xbcc7[_0x46ab39];return _0x459b2e;};'use strict';var INBOUND_COUNTERS=[_0x7bcc('0x0'),_0x7bcc('0x1'),'loggedInDb',_0x7bcc('0x2'),'ringing','talking',_0x7bcc('0x3')];var OUTBOUND_COUNTERS=['available',_0x7bcc('0x4'),_0x7bcc('0x5'),'loggedIn',_0x7bcc('0x6'),_0x7bcc('0x7'),_0x7bcc('0x8'),_0x7bcc('0x9'),_0x7bcc('0xa'),_0x7bcc('0xb'),'outboundCongestionCallsDay',_0x7bcc('0xc'),'outboundNoSuchCallsDay',_0x7bcc('0xd'),_0x7bcc('0xe'),'outboundUnknownCallsDay',_0x7bcc('0x2'),'pTalking','talking','sumBillable',_0x7bcc('0xf'),_0x7bcc('0x10'),_0x7bcc('0x3')];function VoiceQueueSummary(_0x1121d1){this['id']=_0x1121d1['id'];this[_0x7bcc('0x11')]=_0x1121d1[_0x7bcc('0x11')];this[_0x7bcc('0x12')]=_0x1121d1['strategy'];this[_0x7bcc('0x13')]=_0x1121d1[_0x7bcc('0x13')]||0x0;this[_0x7bcc('0x4')]=_0x1121d1[_0x7bcc('0x4')]||0x0;this[_0x7bcc('0x0')]=_0x1121d1[_0x7bcc('0x0')]||0x0;this['busy']=_0x1121d1[_0x7bcc('0x14')]||0x0;this[_0x7bcc('0x5')]=_0x1121d1[_0x7bcc('0x5')]||0x0;this[_0x7bcc('0x15')]=_0x1121d1[_0x7bcc('0x15')]||0x0;this[_0x7bcc('0x1')]=_0x1121d1[_0x7bcc('0x1')]||0x0;this['loggedInDb']=_0x1121d1[_0x7bcc('0x6')]||0x0;this['onHold']=_0x1121d1[_0x7bcc('0x16')]||0x0;this[_0x7bcc('0x17')]=_0x1121d1[_0x7bcc('0x17')]||0x0;this[_0x7bcc('0x2')]=_0x1121d1['paused']||0x0;this['ringing']=_0x1121d1[_0x7bcc('0x18')]||0x0;this[_0x7bcc('0x19')]=_0x1121d1[_0x7bcc('0x19')];this[_0x7bcc('0x1a')]=_0x1121d1[_0x7bcc('0x1a')];this[_0x7bcc('0xf')]=_0x1121d1[_0x7bcc('0xf')];this[_0x7bcc('0x1b')]=_0x1121d1[_0x7bcc('0x1b')]||0x0;this['talking']=_0x1121d1['talking']||0x0;this[_0x7bcc('0x10')]=_0x1121d1[_0x7bcc('0x10')]||0x0;this[_0x7bcc('0x1c')]=_0x1121d1[_0x7bcc('0x1c')];this[_0x7bcc('0x1d')]=_0x1121d1[_0x7bcc('0x1d')]||0x0;this[_0x7bcc('0x1e')]=_0x1121d1[_0x7bcc('0x1e')]||0x0;this[_0x7bcc('0x1f')]=_0x1121d1['unmanaged']||0x0;this[_0x7bcc('0x3')]=_0x1121d1[_0x7bcc('0x3')]||0x0;if(_0x1121d1[_0x7bcc('0x1c')]===_0x7bcc('0x20')){this[_0x7bcc('0x21')]=_0x1121d1[_0x7bcc('0x21')]||0x0;this['dialActive']=_0x1121d1['dialActive'];this[_0x7bcc('0x22')]=_0x1121d1['dialMethod'];this['dialOriginateCallerIdName']=_0x1121d1[_0x7bcc('0x23')];this['dialOriginateCallerIdNumber']=_0x1121d1[_0x7bcc('0x24')];this[_0x7bcc('0x25')]=_0x1121d1[_0x7bcc('0x25')];this['dialPrefix']=_0x1121d1[_0x7bcc('0x26')];this[_0x7bcc('0x27')]=_0x1121d1[_0x7bcc('0x27')];this[_0x7bcc('0x28')]=_0x1121d1[_0x7bcc('0x28')];this[_0x7bcc('0x9')]=_0x1121d1[_0x7bcc('0x9')];this['outboundBlacklistCallsDay']=_0x1121d1[_0x7bcc('0xa')];this[_0x7bcc('0xb')]=_0x1121d1['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x1121d1[_0x7bcc('0x29')];this['outboundDropCallsDayACS']=_0x1121d1[_0x7bcc('0x2a')];this[_0x7bcc('0x2b')]=_0x1121d1[_0x7bcc('0x2b')];this[_0x7bcc('0x2c')]=_0x1121d1['outboundDropCallsDayTimeout'];this[_0x7bcc('0xc')]=_0x1121d1[_0x7bcc('0xc')];this[_0x7bcc('0x2d')]=_0x1121d1['outboundNoSuchCallsDay'];this[_0x7bcc('0x2e')]=_0x1121d1[_0x7bcc('0x2e')];this[_0x7bcc('0xd')]=_0x1121d1[_0x7bcc('0xd')];this[_0x7bcc('0xe')]=_0x1121d1[_0x7bcc('0xe')];this[_0x7bcc('0x2f')]=_0x1121d1[_0x7bcc('0x2f')];this[_0x7bcc('0x30')]=_0x1121d1[_0x7bcc('0x30')];this[_0x7bcc('0x31')]=_0x1121d1['predictiveIntervalAvgHoldtime'];this[_0x7bcc('0x32')]=_0x1121d1[_0x7bcc('0x32')];this[_0x7bcc('0x33')]=_0x1121d1['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x1121d1[_0x7bcc('0x34')];this[_0x7bcc('0x35')]=_0x1121d1[_0x7bcc('0x35')];this[_0x7bcc('0x36')]=_0x1121d1[_0x7bcc('0x36')];this[_0x7bcc('0x37')]=_0x1121d1[_0x7bcc('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x1121d1['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x1121d1['predictiveIntervalPauses'];this[_0x7bcc('0x38')]=_0x1121d1[_0x7bcc('0x38')];this[_0x7bcc('0x39')]=_0x1121d1['predictiveIntervalTotalCalls'];this[_0x7bcc('0x7')]=_0x1121d1[_0x7bcc('0x7')];this[_0x7bcc('0x3a')]=_0x1121d1['erlangCalls'];this['erlangCallToSecond']=_0x1121d1[_0x7bcc('0x3b')];this[_0x7bcc('0x3c')]=_0x1121d1[_0x7bcc('0x3c')];this['erlangBusyFactor']=_0x1121d1['erlangBusyFactor'];this[_0x7bcc('0x3d')]=_0x1121d1[_0x7bcc('0x3d')];this[_0x7bcc('0x3e')]=_0x1121d1['startProgressive'];this[_0x7bcc('0x3f')]=_0x1121d1[_0x7bcc('0x3f')];this[_0x7bcc('0x40')]=_0x1121d1[_0x7bcc('0x40')];}if(_0x1121d1[_0x7bcc('0x41')]){this[_0x7bcc('0x41')]={'id':_0x1121d1['Trunk']['id'],'name':_0x1121d1[_0x7bcc('0x41')][_0x7bcc('0x11')],'active':_0x1121d1['Trunk'][_0x7bcc('0x42')],'callerid':_0x1121d1[_0x7bcc('0x41')][_0x7bcc('0x43')]};}}VoiceQueueSummary[_0x7bcc('0x44')][_0x7bcc('0x45')]=function(_0x1b4d75,_0x632cff,_0xeaeac5,_0x5d67a0){this[_0x7bcc('0x6')]=0x0;this[_0x7bcc('0x46')]=0x0;this[_0x7bcc('0x2')]=0x0;this[_0x7bcc('0x1e')]=0x0;this[_0x7bcc('0x17')]=0x0;this[_0x7bcc('0x5')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x7bcc('0x1d')]=0x0;this[_0x7bcc('0x18')]=0x0;this['ringInUse']=0x0;this[_0x7bcc('0x16')]=0x0;if(_0xeaeac5){if(_0xeaeac5[_0x7bcc('0x0')]){this[_0x7bcc('0x0')]=Number(_0xeaeac5[_0x7bcc('0x0')]);}if(_0xeaeac5[_0x7bcc('0x47')]){this[_0x7bcc('0x1')]=Number(_0xeaeac5[_0x7bcc('0x47')]);}if(_0xeaeac5['callers']){this[_0x7bcc('0x3')]=Number(_0xeaeac5[_0x7bcc('0x48')]);}}for(var _0x2a490d=0x0;_0x2a490d<_0x1b4d75[_0x7bcc('0x49')];_0x2a490d++){var _0x144510=_0x632cff['SIP/'+_0x1b4d75[_0x2a490d][_0x7bcc('0x11')]];if(_0x144510&&_0x144510[_0x7bcc('0x4a')]){this['loggedInDb']+=0x1;}if(_0x1b4d75[_0x2a490d][_0x7bcc('0x4b')]==='1'){this[_0x7bcc('0x46')]+=0x1;}if(_0x1b4d75[_0x2a490d][_0x7bcc('0x2')]==='1'&&!['2','7','8']['includes'](_0x1b4d75[_0x2a490d][_0x7bcc('0x4c')])){this[_0x7bcc('0x2')]+=0x1;}switch(_0x1b4d75[_0x2a490d]['status']){case'0':this[_0x7bcc('0x1e')]+=0x1;break;case'1':this[_0x7bcc('0x17')]+=0x1;break;case'2':this[_0x7bcc('0x5')]+=0x1;break;case'3':this[_0x7bcc('0x14')]+=0x1;break;case'4':this[_0x7bcc('0x15')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x7bcc('0x18')]+=0x1;break;case'7':this[_0x7bcc('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x7bcc('0x22')]==='booked'){var _0x415de9=Object['keys'](_0x5d67a0);for(var _0x29cb88=0x0;_0x29cb88<_0x415de9['length'];_0x29cb88++){var _0x5748ca=_0x415de9[_0x29cb88];var _0x11dec2=_0x5d67a0[_0x5748ca];if(_0x11dec2[_0x7bcc('0x4d')]===this[_0x7bcc('0x11')]&&_0x11dec2[_0x7bcc('0x1c')]===_0x7bcc('0x4e')&&_0x11dec2[_0x7bcc('0x4f')]===_0x7bcc('0x50')){this[_0x7bcc('0x46')]+=0x1;}}if(this[_0x7bcc('0x46')]>this[_0x7bcc('0x5')]){this[_0x7bcc('0x46')]=this[_0x7bcc('0x5')];}this[_0x7bcc('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x7bcc('0x44')][_0x7bcc('0x51')]=function(_0x4c12f2){var _0x281c21=![];if(_0x4c12f2){_0x281c21=INBOUND_COUNTERS[_0x7bcc('0x52')](function(_0x54bb61){return this[_0x54bb61]!==_0x4c12f2[_0x54bb61];},this);}return _0x281c21;};VoiceQueueSummary['prototype'][_0x7bcc('0x53')]=function(_0x38240d){var _0x55deaf=![];var _0x5cf572=![];var _0x5268f2=![];if(_0x38240d){_0x55deaf=this['dialMethod']!==_0x38240d['dialMethod']||this[_0x7bcc('0x54')]!==_0x38240d[_0x7bcc('0x54')]||this['message']!==_0x38240d['message']||this[_0x7bcc('0x40')]!==_0x38240d[_0x7bcc('0x40')];_0x5cf572=OUTBOUND_COUNTERS[_0x7bcc('0x52')](function(_0x33c052){return this[_0x33c052]!==_0x38240d[_0x33c052];},this);if(this[_0x7bcc('0x41')]&&_0x38240d[_0x7bcc('0x41')]){_0x5268f2=this['Trunk']['name']!==_0x38240d[_0x7bcc('0x41')][_0x7bcc('0x11')]||this[_0x7bcc('0x41')][_0x7bcc('0x42')]!==_0x38240d['Trunk']['active'];}}return _0x55deaf||_0x5cf572||_0x5268f2;};VoiceQueueSummary['prototype'][_0x7bcc('0x55')]=function(_0x583592){this[_0x7bcc('0x4')]=_0x583592[_0x7bcc('0x4')];this[_0x7bcc('0x3f')]=_0x583592['message'];this[_0x7bcc('0x40')]=_0x583592['statusMessage'];this['originated']=_0x583592[_0x7bcc('0x7')];this[_0x7bcc('0x8')]=_0x583592[_0x7bcc('0x8')];this[_0x7bcc('0x9')]=_0x583592[_0x7bcc('0x9')];this[_0x7bcc('0xa')]=_0x583592[_0x7bcc('0xa')];this[_0x7bcc('0xb')]=_0x583592[_0x7bcc('0xb')];this['outboundCongestionCallsDay']=_0x583592[_0x7bcc('0x29')];this[_0x7bcc('0xc')]=_0x583592[_0x7bcc('0xc')];this['outboundNoSuchCallsDay']=_0x583592[_0x7bcc('0x2d')];this[_0x7bcc('0xd')]=_0x583592[_0x7bcc('0xd')];this[_0x7bcc('0xe')]=_0x583592[_0x7bcc('0xe')];this[_0x7bcc('0x2f')]=_0x583592[_0x7bcc('0x2f')];this[_0x7bcc('0x1a')]=_0x583592[_0x7bcc('0x1a')];this[_0x7bcc('0xf')]=_0x583592['sumDuration'];this[_0x7bcc('0x10')]=_0x583592[_0x7bcc('0x10')];if(this['dialMethod']===_0x7bcc('0x56')){this[_0x7bcc('0x21')]=_0x583592[_0x7bcc('0x21')];}};module['exports']=VoiceQueueSummary;