Built motion from commit d5e4af8c.|2.6.23
[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 _0xc492=['dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','status','booked','keys','length','queue','dialer','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','available','loggedIn','loggedInDb','talking','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','sumDuration','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','paused','ringing','ringInUse','sumBillable','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x29563a,_0x393dd5){var _0x33e493=function(_0x13ed52){while(--_0x13ed52){_0x29563a['push'](_0x29563a['shift']());}};_0x33e493(++_0x393dd5);}(_0xc492,0xd7));var _0x2c49=function(_0x3d0d6f,_0x56b492){_0x3d0d6f=_0x3d0d6f-0x0;var _0x3bc103=_0xc492[_0x3d0d6f];return _0x3bc103;};'use strict';var INBOUND_COUNTERS=[_0x2c49('0x0'),_0x2c49('0x1'),_0x2c49('0x2'),'paused','ringing',_0x2c49('0x3'),'waiting'];var OUTBOUND_COUNTERS=['available',_0x2c49('0x4'),_0x2c49('0x5'),'loggedIn',_0x2c49('0x2'),'originated',_0x2c49('0x6'),_0x2c49('0x7'),'outboundBlacklistCallsDay',_0x2c49('0x8'),_0x2c49('0x9'),_0x2c49('0xa'),_0x2c49('0xb'),_0x2c49('0xc'),'outboundRejectCallsDay',_0x2c49('0xd'),'paused','pTalking','talking','sumBillable',_0x2c49('0xe'),'total',_0x2c49('0xf')];function VoiceQueueSummary(_0x2a998e){this['id']=_0x2a998e['id'];this['name']=_0x2a998e[_0x2c49('0x10')];this[_0x2c49('0x11')]=_0x2a998e[_0x2c49('0x11')];this[_0x2c49('0x12')]=_0x2a998e[_0x2c49('0x12')]||0x0;this[_0x2c49('0x4')]=_0x2a998e['answered']||0x0;this[_0x2c49('0x0')]=_0x2a998e[_0x2c49('0x0')]||0x0;this[_0x2c49('0x13')]=_0x2a998e[_0x2c49('0x13')]||0x0;this[_0x2c49('0x5')]=_0x2a998e['inUse']||0x0;this[_0x2c49('0x14')]=_0x2a998e[_0x2c49('0x14')]||0x0;this[_0x2c49('0x1')]=_0x2a998e[_0x2c49('0x1')]||0x0;this[_0x2c49('0x2')]=_0x2a998e[_0x2c49('0x2')]||0x0;this[_0x2c49('0x15')]=_0x2a998e[_0x2c49('0x15')]||0x0;this[_0x2c49('0x16')]=_0x2a998e[_0x2c49('0x16')]||0x0;this['paused']=_0x2a998e[_0x2c49('0x17')]||0x0;this[_0x2c49('0x18')]=_0x2a998e[_0x2c49('0x18')]||0x0;this[_0x2c49('0x19')]=_0x2a998e['ringInUse'];this[_0x2c49('0x1a')]=_0x2a998e['sumBillable'];this[_0x2c49('0xe')]=_0x2a998e[_0x2c49('0xe')];this['sumHoldTime']=_0x2a998e['sumHoldTime']||0x0;this[_0x2c49('0x3')]=_0x2a998e[_0x2c49('0x3')]||0x0;this[_0x2c49('0x1b')]=_0x2a998e[_0x2c49('0x1b')]||0x0;this[_0x2c49('0x1c')]=_0x2a998e[_0x2c49('0x1c')];this[_0x2c49('0x1d')]=_0x2a998e[_0x2c49('0x1d')]||0x0;this[_0x2c49('0x1e')]=_0x2a998e['unknown']||0x0;this[_0x2c49('0x1f')]=_0x2a998e[_0x2c49('0x1f')]||0x0;this[_0x2c49('0xf')]=_0x2a998e[_0x2c49('0xf')]||0x0;if(_0x2a998e['type']===_0x2c49('0x20')){this[_0x2c49('0x21')]=_0x2a998e[_0x2c49('0x21')]||0x0;this[_0x2c49('0x22')]=_0x2a998e['dialActive'];this[_0x2c49('0x23')]=_0x2a998e[_0x2c49('0x23')];this[_0x2c49('0x24')]=_0x2a998e['dialOriginateCallerIdName'];this[_0x2c49('0x25')]=_0x2a998e[_0x2c49('0x25')];this['dialOriginateTimeout']=_0x2a998e[_0x2c49('0x26')];this['dialPrefix']=_0x2a998e['dialPrefix'];this[_0x2c49('0x27')]=_0x2a998e['temp'];this[_0x2c49('0x28')]=_0x2a998e['outboundAnswerAgiCallsDay'];this[_0x2c49('0x7')]=_0x2a998e[_0x2c49('0x7')];this[_0x2c49('0x29')]=_0x2a998e[_0x2c49('0x29')];this[_0x2c49('0x8')]=_0x2a998e[_0x2c49('0x8')];this[_0x2c49('0x9')]=_0x2a998e[_0x2c49('0x9')];this[_0x2c49('0x2a')]=_0x2a998e[_0x2c49('0x2a')];this['outboundDropCallsDayCallersExit']=_0x2a998e[_0x2c49('0x2b')];this['outboundDropCallsDayTimeout']=_0x2a998e[_0x2c49('0x2c')];this[_0x2c49('0xa')]=_0x2a998e[_0x2c49('0xa')];this[_0x2c49('0xb')]=_0x2a998e[_0x2c49('0xb')];this[_0x2c49('0x2d')]=_0x2a998e[_0x2c49('0x2d')];this[_0x2c49('0xc')]=_0x2a998e[_0x2c49('0xc')];this[_0x2c49('0x2e')]=_0x2a998e[_0x2c49('0x2e')];this[_0x2c49('0xd')]=_0x2a998e[_0x2c49('0xd')];this[_0x2c49('0x2f')]=_0x2a998e['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x2a998e[_0x2c49('0x30')];this[_0x2c49('0x31')]=_0x2a998e['predictiveIntervalAvgTalktime'];this[_0x2c49('0x32')]=_0x2a998e[_0x2c49('0x32')];this[_0x2c49('0x33')]=_0x2a998e[_0x2c49('0x33')];this[_0x2c49('0x34')]=_0x2a998e[_0x2c49('0x34')];this[_0x2c49('0x35')]=_0x2a998e[_0x2c49('0x35')];this['predictiveIntervalHitRate']=_0x2a998e[_0x2c49('0x36')];this[_0x2c49('0x37')]=_0x2a998e['predictiveIntervalMultiplicativeFactor'];this[_0x2c49('0x38')]=_0x2a998e[_0x2c49('0x38')];this[_0x2c49('0x39')]=_0x2a998e['predictiveIntervalAvailable'];this[_0x2c49('0x3a')]=_0x2a998e[_0x2c49('0x3a')];this[_0x2c49('0x3b')]=_0x2a998e[_0x2c49('0x3b')];this[_0x2c49('0x3c')]=_0x2a998e[_0x2c49('0x3c')];this['erlangCallToSecond']=_0x2a998e[_0x2c49('0x3d')];this[_0x2c49('0x3e')]=_0x2a998e['erlangAbandonmentRate'];this[_0x2c49('0x3f')]=_0x2a998e[_0x2c49('0x3f')];this['startPredictive']=_0x2a998e[_0x2c49('0x40')];this['startProgressive']=_0x2a998e[_0x2c49('0x41')];this[_0x2c49('0x42')]=_0x2a998e[_0x2c49('0x42')];this['statusMessage']=_0x2a998e[_0x2c49('0x43')];}if(_0x2a998e['Trunk']){this[_0x2c49('0x44')]={'id':_0x2a998e[_0x2c49('0x44')]['id'],'name':_0x2a998e[_0x2c49('0x44')][_0x2c49('0x10')],'active':_0x2a998e[_0x2c49('0x44')]['active'],'callerid':_0x2a998e[_0x2c49('0x44')][_0x2c49('0x45')]};}}VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x47')]=function(_0x251c8d,_0x130410,_0x3c25b6,_0x40f640){this['loggedInDb']=0x0;this[_0x2c49('0x3')]=0x0;this[_0x2c49('0x17')]=0x0;this['unknown']=0x0;this[_0x2c49('0x16')]=0x0;this[_0x2c49('0x5')]=0x0;this['busy']=0x0;this[_0x2c49('0x14')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x3c25b6){if(_0x3c25b6[_0x2c49('0x0')]){this[_0x2c49('0x0')]=Number(_0x3c25b6[_0x2c49('0x0')]);}if(_0x3c25b6[_0x2c49('0x48')]){this[_0x2c49('0x1')]=Number(_0x3c25b6['loggedin']);}if(_0x3c25b6['callers']){this['waiting']=Number(_0x3c25b6['callers']);}}for(var _0x43b5ca=0x0;_0x43b5ca<_0x251c8d['length'];_0x43b5ca++){var _0x341fd6=_0x130410['SIP/'+_0x251c8d[_0x43b5ca]['name']];if(_0x341fd6&&_0x341fd6['online']){this[_0x2c49('0x2')]+=0x1;}if(_0x251c8d[_0x43b5ca]['incall']==='1'){this[_0x2c49('0x3')]+=0x1;}if(_0x251c8d[_0x43b5ca][_0x2c49('0x17')]==='1'&&!['2','7','8']['includes'](_0x251c8d[_0x43b5ca]['status'])){this[_0x2c49('0x17')]+=0x1;}switch(_0x251c8d[_0x43b5ca][_0x2c49('0x49')]){case'0':this[_0x2c49('0x1e')]+=0x1;break;case'1':this[_0x2c49('0x16')]+=0x1;break;case'2':this[_0x2c49('0x5')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x2c49('0x1d')]+=0x1;break;case'6':this[_0x2c49('0x18')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x2c49('0x4a')){var _0x267a32=Object[_0x2c49('0x4b')](_0x40f640);for(var _0x55e4cd=0x0;_0x55e4cd<_0x267a32[_0x2c49('0x4c')];_0x55e4cd++){var _0xea11c4=_0x267a32[_0x55e4cd];var _0x43a7fd=_0x40f640[_0xea11c4];if(_0x43a7fd[_0x2c49('0x4d')]===this[_0x2c49('0x10')]&&_0x43a7fd[_0x2c49('0x1c')]===_0x2c49('0x4e')&&_0x43a7fd['exten']==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0x2c49('0x3')]>this[_0x2c49('0x5')]){this['talking']=this[_0x2c49('0x5')];}this[_0x2c49('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x4f')]=function(_0x199b26){var _0x38d901=![];if(_0x199b26){_0x38d901=INBOUND_COUNTERS[_0x2c49('0x50')](function(_0x11878d){return this[_0x11878d]!==_0x199b26[_0x11878d];},this);}return _0x38d901;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x51')]=function(_0x56d647){var _0x46a0c6=![];var _0xe026bf=![];var _0xfcdbaf=![];if(_0x56d647){_0x46a0c6=this['dialMethod']!==_0x56d647[_0x2c49('0x23')]||this[_0x2c49('0x22')]!==_0x56d647['dialActive']||this[_0x2c49('0x42')]!==_0x56d647[_0x2c49('0x42')]||this[_0x2c49('0x43')]!==_0x56d647[_0x2c49('0x43')];_0xe026bf=OUTBOUND_COUNTERS['some'](function(_0x34e69e){return this[_0x34e69e]!==_0x56d647[_0x34e69e];},this);if(this[_0x2c49('0x44')]&&_0x56d647[_0x2c49('0x44')]){_0xfcdbaf=this[_0x2c49('0x44')]['name']!==_0x56d647[_0x2c49('0x44')][_0x2c49('0x10')]||this[_0x2c49('0x44')][_0x2c49('0x52')]!==_0x56d647[_0x2c49('0x44')][_0x2c49('0x52')];}}return _0x46a0c6||_0xe026bf||_0xfcdbaf;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x53')]=function(_0x3b62ee){this['answered']=_0x3b62ee['answered'];this[_0x2c49('0x42')]=_0x3b62ee[_0x2c49('0x42')];this['statusMessage']=_0x3b62ee[_0x2c49('0x43')];this['originated']=_0x3b62ee[_0x2c49('0x3b')];this[_0x2c49('0x6')]=_0x3b62ee[_0x2c49('0x6')];this[_0x2c49('0x7')]=_0x3b62ee[_0x2c49('0x7')];this['outboundBlacklistCallsDay']=_0x3b62ee[_0x2c49('0x29')];this[_0x2c49('0x8')]=_0x3b62ee[_0x2c49('0x8')];this['outboundCongestionCallsDay']=_0x3b62ee[_0x2c49('0x9')];this[_0x2c49('0xa')]=_0x3b62ee['outboundNoAnswerCallsDay'];this[_0x2c49('0xb')]=_0x3b62ee[_0x2c49('0xb')];this['outboundReCallsDay']=_0x3b62ee[_0x2c49('0xc')];this['outboundRejectCallsDay']=_0x3b62ee[_0x2c49('0x2e')];this[_0x2c49('0xd')]=_0x3b62ee[_0x2c49('0xd')];this[_0x2c49('0x1a')]=_0x3b62ee[_0x2c49('0x1a')];this[_0x2c49('0xe')]=_0x3b62ee['sumDuration'];this[_0x2c49('0x1b')]=_0x3b62ee[_0x2c49('0x1b')];if(this[_0x2c49('0x23')]==='preview'){this[_0x2c49('0x21')]=_0x3b62ee['pTalking'];}};module['exports']=VoiceQueueSummary;