1549eec8a111f83d915a5ea30ae9a8215bb3ac80
[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 _0xf13b=['type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','busy','loggedin','callers','length','SIP/','online','includes','status','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','available','ringing','talking','waiting','loggedIn','loggedInDb','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','answered','inUse','invalid','onHold','notInUse','paused','ringInUse','sumDuration','sumHoldTime','unavailable','unknown','unmanaged'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xf13b,0x1f0));var _0xbf13=function(_0xdf9f34,_0x1536ee){_0xdf9f34=_0xdf9f34-0x0;var _0x1a5b1f=_0xf13b[_0xdf9f34];return _0x1a5b1f;};'use strict';var INBOUND_COUNTERS=[_0xbf13('0x0'),'loggedIn','loggedInDb','paused',_0xbf13('0x1'),_0xbf13('0x2'),_0xbf13('0x3')];var OUTBOUND_COUNTERS=[_0xbf13('0x0'),'answered','inUse',_0xbf13('0x4'),_0xbf13('0x5'),'originated',_0xbf13('0x6'),_0xbf13('0x7'),'outboundBlacklistCallsDay',_0xbf13('0x8'),_0xbf13('0x9'),'outboundNoAnswerCallsDay',_0xbf13('0xa'),_0xbf13('0xb'),_0xbf13('0xc'),_0xbf13('0xd'),'paused',_0xbf13('0xe'),'talking',_0xbf13('0xf'),'sumDuration',_0xbf13('0x10'),_0xbf13('0x3')];function VoiceQueueSummary(_0x4812e3){this['id']=_0x4812e3['id'];this[_0xbf13('0x11')]=_0x4812e3[_0xbf13('0x11')];this[_0xbf13('0x12')]=_0x4812e3[_0xbf13('0x12')];this['abandoned']=_0x4812e3[_0xbf13('0x13')]||0x0;this[_0xbf13('0x14')]=_0x4812e3[_0xbf13('0x14')]||0x0;this[_0xbf13('0x0')]=_0x4812e3['available']||0x0;this['busy']=_0x4812e3['busy']||0x0;this[_0xbf13('0x15')]=_0x4812e3[_0xbf13('0x15')]||0x0;this[_0xbf13('0x16')]=_0x4812e3[_0xbf13('0x16')]||0x0;this[_0xbf13('0x4')]=_0x4812e3[_0xbf13('0x4')]||0x0;this[_0xbf13('0x5')]=_0x4812e3[_0xbf13('0x5')]||0x0;this['onHold']=_0x4812e3[_0xbf13('0x17')]||0x0;this[_0xbf13('0x18')]=_0x4812e3[_0xbf13('0x18')]||0x0;this[_0xbf13('0x19')]=_0x4812e3[_0xbf13('0x19')]||0x0;this[_0xbf13('0x1')]=_0x4812e3['ringing']||0x0;this['ringInUse']=_0x4812e3[_0xbf13('0x1a')];this[_0xbf13('0xf')]=_0x4812e3[_0xbf13('0xf')];this[_0xbf13('0x1b')]=_0x4812e3['sumDuration'];this['sumHoldTime']=_0x4812e3[_0xbf13('0x1c')]||0x0;this[_0xbf13('0x2')]=_0x4812e3[_0xbf13('0x2')]||0x0;this['total']=_0x4812e3[_0xbf13('0x10')]||0x0;this['type']=_0x4812e3['type'];this[_0xbf13('0x1d')]=_0x4812e3[_0xbf13('0x1d')]||0x0;this[_0xbf13('0x1e')]=_0x4812e3[_0xbf13('0x1e')]||0x0;this[_0xbf13('0x1f')]=_0x4812e3[_0xbf13('0x1f')]||0x0;this[_0xbf13('0x3')]=_0x4812e3[_0xbf13('0x3')]||0x0;if(_0x4812e3[_0xbf13('0x20')]==='outbound'){this[_0xbf13('0xe')]=_0x4812e3[_0xbf13('0xe')]||0x0;this[_0xbf13('0x21')]=_0x4812e3[_0xbf13('0x21')];this[_0xbf13('0x22')]=_0x4812e3[_0xbf13('0x22')];this[_0xbf13('0x23')]=_0x4812e3['dialOriginateCallerIdName'];this[_0xbf13('0x24')]=_0x4812e3[_0xbf13('0x24')];this[_0xbf13('0x25')]=_0x4812e3[_0xbf13('0x25')];this[_0xbf13('0x26')]=_0x4812e3[_0xbf13('0x26')];this['temp']=_0x4812e3[_0xbf13('0x27')];this[_0xbf13('0x28')]=_0x4812e3['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x4812e3[_0xbf13('0x7')];this[_0xbf13('0x29')]=_0x4812e3[_0xbf13('0x29')];this['outboundBusyCallsDay']=_0x4812e3[_0xbf13('0x8')];this[_0xbf13('0x9')]=_0x4812e3[_0xbf13('0x9')];this[_0xbf13('0x2a')]=_0x4812e3[_0xbf13('0x2a')];this[_0xbf13('0x2b')]=_0x4812e3[_0xbf13('0x2b')];this['outboundDropCallsDayTimeout']=_0x4812e3['outboundDropCallsDayTimeout'];this[_0xbf13('0x2c')]=_0x4812e3[_0xbf13('0x2c')];this['outboundNoSuchCallsDay']=_0x4812e3['outboundNoSuchCallsDay'];this[_0xbf13('0x2d')]=_0x4812e3[_0xbf13('0x2d')];this[_0xbf13('0xb')]=_0x4812e3[_0xbf13('0xb')];this[_0xbf13('0xc')]=_0x4812e3[_0xbf13('0xc')];this[_0xbf13('0xd')]=_0x4812e3[_0xbf13('0xd')];this['predictiveIntervalAnsweredCalls']=_0x4812e3[_0xbf13('0x2e')];this[_0xbf13('0x2f')]=_0x4812e3['predictiveIntervalAvgHoldtime'];this[_0xbf13('0x30')]=_0x4812e3[_0xbf13('0x30')];this[_0xbf13('0x31')]=_0x4812e3['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x4812e3['predictiveIntervalDroppedCallsTimeout'];this[_0xbf13('0x32')]=_0x4812e3['predictiveIntervalErlangCalls'];this[_0xbf13('0x33')]=_0x4812e3[_0xbf13('0x33')];this['predictiveIntervalHitRate']=_0x4812e3[_0xbf13('0x34')];this[_0xbf13('0x35')]=_0x4812e3[_0xbf13('0x35')];this[_0xbf13('0x36')]=_0x4812e3[_0xbf13('0x36')];this[_0xbf13('0x37')]=_0x4812e3[_0xbf13('0x37')];this[_0xbf13('0x38')]=_0x4812e3[_0xbf13('0x38')];this[_0xbf13('0x39')]=_0x4812e3['originated'];this[_0xbf13('0x3a')]=_0x4812e3[_0xbf13('0x3a')];this[_0xbf13('0x3b')]=_0x4812e3[_0xbf13('0x3b')];this[_0xbf13('0x3c')]=_0x4812e3[_0xbf13('0x3c')];this[_0xbf13('0x3d')]=_0x4812e3[_0xbf13('0x3d')];this[_0xbf13('0x3e')]=_0x4812e3[_0xbf13('0x3e')];this[_0xbf13('0x3f')]=_0x4812e3['startProgressive'];this[_0xbf13('0x40')]=_0x4812e3[_0xbf13('0x40')];this[_0xbf13('0x41')]=_0x4812e3['statusMessage'];}if(_0x4812e3[_0xbf13('0x42')]){this[_0xbf13('0x42')]={'id':_0x4812e3[_0xbf13('0x42')]['id'],'name':_0x4812e3[_0xbf13('0x42')][_0xbf13('0x11')],'active':_0x4812e3[_0xbf13('0x42')]['active'],'callerid':_0x4812e3['Trunk'][_0xbf13('0x43')]};}}VoiceQueueSummary[_0xbf13('0x44')]['createReport']=function(_0x4dec8d,_0x1e9d90,_0x3e6ced,_0x27c599){this['loggedInDb']=0x0;this[_0xbf13('0x2')]=0x0;this[_0xbf13('0x19')]=0x0;this['unknown']=0x0;this[_0xbf13('0x18')]=0x0;this[_0xbf13('0x15')]=0x0;this[_0xbf13('0x45')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0xbf13('0x1a')]=0x0;this[_0xbf13('0x17')]=0x0;if(_0x3e6ced){if(_0x3e6ced[_0xbf13('0x0')]){this[_0xbf13('0x0')]=Number(_0x3e6ced['available']);}if(_0x3e6ced[_0xbf13('0x46')]){this[_0xbf13('0x4')]=Number(_0x3e6ced['loggedin']);}if(_0x3e6ced[_0xbf13('0x47')]){this[_0xbf13('0x3')]=Number(_0x3e6ced[_0xbf13('0x47')]);}}for(var _0x104ec4=0x0;_0x104ec4<_0x4dec8d[_0xbf13('0x48')];_0x104ec4++){var _0x4fb4e0=_0x1e9d90[_0xbf13('0x49')+_0x4dec8d[_0x104ec4]['name']];if(_0x4fb4e0&&_0x4fb4e0[_0xbf13('0x4a')]){this[_0xbf13('0x5')]+=0x1;}if(_0x4dec8d[_0x104ec4]['incall']==='1'){this['talking']+=0x1;}if(_0x4dec8d[_0x104ec4]['paused']==='1'&&!['2','7','8'][_0xbf13('0x4b')](_0x4dec8d[_0x104ec4][_0xbf13('0x4c')])){this[_0xbf13('0x19')]+=0x1;}switch(_0x4dec8d[_0x104ec4][_0xbf13('0x4c')]){case'0':this[_0xbf13('0x1e')]+=0x1;break;case'1':this[_0xbf13('0x18')]+=0x1;break;case'2':this[_0xbf13('0x15')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xbf13('0x16')]+=0x1;break;case'5':this[_0xbf13('0x1d')]+=0x1;break;case'6':this[_0xbf13('0x1')]+=0x1;break;case'7':this[_0xbf13('0x1a')]+=0x1;break;case'8':this[_0xbf13('0x17')]+=0x1;break;}}if(this[_0xbf13('0x22')]==='booked'){var _0x2d9bc5=Object[_0xbf13('0x4d')](_0x27c599);for(var _0xfe9daa=0x0;_0xfe9daa<_0x2d9bc5[_0xbf13('0x48')];_0xfe9daa++){var _0x223573=_0x2d9bc5[_0xfe9daa];var _0xa30e6=_0x27c599[_0x223573];if(_0xa30e6[_0xbf13('0x4e')]===this[_0xbf13('0x11')]&&_0xa30e6['type']===_0xbf13('0x4f')&&_0xa30e6[_0xbf13('0x50')]===_0xbf13('0x51')){this[_0xbf13('0x2')]+=0x1;}}if(this[_0xbf13('0x2')]>this[_0xbf13('0x15')]){this[_0xbf13('0x2')]=this['inUse'];}this[_0xbf13('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xbf13('0x44')][_0xbf13('0x52')]=function(_0x25560f){var _0x38cadb=![];if(_0x25560f){_0x38cadb=INBOUND_COUNTERS[_0xbf13('0x53')](function(_0x43f23b){return this[_0x43f23b]!==_0x25560f[_0x43f23b];},this);}return _0x38cadb;};VoiceQueueSummary[_0xbf13('0x44')][_0xbf13('0x54')]=function(_0x386f81){var _0x2d0d9a=![];var _0x59e609=![];var _0xe03453=![];if(_0x386f81){_0x2d0d9a=this['dialMethod']!==_0x386f81[_0xbf13('0x22')]||this[_0xbf13('0x21')]!==_0x386f81[_0xbf13('0x21')]||this['message']!==_0x386f81[_0xbf13('0x40')]||this['statusMessage']!==_0x386f81['statusMessage'];_0x59e609=OUTBOUND_COUNTERS['some'](function(_0x401200){return this[_0x401200]!==_0x386f81[_0x401200];},this);if(this[_0xbf13('0x42')]&&_0x386f81['Trunk']){_0xe03453=this[_0xbf13('0x42')]['name']!==_0x386f81['Trunk'][_0xbf13('0x11')]||this[_0xbf13('0x42')][_0xbf13('0x55')]!==_0x386f81[_0xbf13('0x42')]['active'];}}return _0x2d0d9a||_0x59e609||_0xe03453;};VoiceQueueSummary[_0xbf13('0x44')][_0xbf13('0x56')]=function(_0x34b345){this[_0xbf13('0x14')]=_0x34b345['answered'];this[_0xbf13('0x40')]=_0x34b345[_0xbf13('0x40')];this['statusMessage']=_0x34b345['statusMessage'];this[_0xbf13('0x39')]=_0x34b345[_0xbf13('0x39')];this[_0xbf13('0x6')]=_0x34b345[_0xbf13('0x6')];this['outboundAnswerCallsDay']=_0x34b345[_0xbf13('0x7')];this[_0xbf13('0x29')]=_0x34b345['outboundBlacklistCallsDay'];this[_0xbf13('0x8')]=_0x34b345[_0xbf13('0x8')];this[_0xbf13('0x9')]=_0x34b345[_0xbf13('0x9')];this[_0xbf13('0x2c')]=_0x34b345[_0xbf13('0x2c')];this[_0xbf13('0xa')]=_0x34b345[_0xbf13('0xa')];this[_0xbf13('0xb')]=_0x34b345[_0xbf13('0xb')];this[_0xbf13('0xc')]=_0x34b345[_0xbf13('0xc')];this['outboundUnknownCallsDay']=_0x34b345[_0xbf13('0xd')];this[_0xbf13('0xf')]=_0x34b345['sumBillable'];this['sumDuration']=_0x34b345['sumDuration'];this[_0xbf13('0x10')]=_0x34b345[_0xbf13('0x10')];if(this[_0xbf13('0x22')]===_0xbf13('0x57')){this['pTalking']=_0x34b345['pTalking'];}};module['exports']=VoiceQueueSummary;