Built motion from commit ffdca78c.|2.6.24
[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 _0xa0a1=['updateReportFromOutboundQueue','originated','exports','available','loggedInDb','paused','ringing','answered','loggedIn','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','talking','sumBillable','sumDuration','waiting','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','pTalking','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','length','online','includes','status','booked','keys','queue','dialer','xcally-motion-preview','some','compareToOutboundQueue','dialActive','message'];(function(_0xfb31ee,_0x403d45){var _0xec7390=function(_0x2cadad){while(--_0x2cadad){_0xfb31ee['push'](_0xfb31ee['shift']());}};_0xec7390(++_0x403d45);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x500e56,_0x3ebec5){_0x500e56=_0x500e56-0x0;var _0x1c9c49=_0xa0a1[_0x500e56];return _0x1c9c49;};'use strict';var INBOUND_COUNTERS=[_0x1a0a('0x0'),'loggedIn',_0x1a0a('0x1'),_0x1a0a('0x2'),_0x1a0a('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x1a0a('0x0'),_0x1a0a('0x4'),'inUse',_0x1a0a('0x5'),_0x1a0a('0x1'),'originated',_0x1a0a('0x6'),_0x1a0a('0x7'),_0x1a0a('0x8'),_0x1a0a('0x9'),_0x1a0a('0xa'),'outboundNoAnswerCallsDay',_0x1a0a('0xb'),_0x1a0a('0xc'),_0x1a0a('0xd'),'outboundUnknownCallsDay','paused','pTalking',_0x1a0a('0xe'),_0x1a0a('0xf'),_0x1a0a('0x10'),'total',_0x1a0a('0x11')];function VoiceQueueSummary(_0x4a0eda){this['id']=_0x4a0eda['id'];this[_0x1a0a('0x12')]=_0x4a0eda[_0x1a0a('0x12')];this[_0x1a0a('0x13')]=_0x4a0eda[_0x1a0a('0x13')];this[_0x1a0a('0x14')]=_0x4a0eda[_0x1a0a('0x14')]||0x0;this[_0x1a0a('0x4')]=_0x4a0eda['answered']||0x0;this[_0x1a0a('0x0')]=_0x4a0eda[_0x1a0a('0x0')]||0x0;this[_0x1a0a('0x15')]=_0x4a0eda[_0x1a0a('0x15')]||0x0;this[_0x1a0a('0x16')]=_0x4a0eda['inUse']||0x0;this[_0x1a0a('0x17')]=_0x4a0eda[_0x1a0a('0x17')]||0x0;this[_0x1a0a('0x5')]=_0x4a0eda['loggedIn']||0x0;this[_0x1a0a('0x1')]=_0x4a0eda['loggedInDb']||0x0;this[_0x1a0a('0x18')]=_0x4a0eda['onHold']||0x0;this['notInUse']=_0x4a0eda[_0x1a0a('0x19')]||0x0;this[_0x1a0a('0x2')]=_0x4a0eda[_0x1a0a('0x2')]||0x0;this[_0x1a0a('0x3')]=_0x4a0eda['ringing']||0x0;this['ringInUse']=_0x4a0eda[_0x1a0a('0x1a')];this[_0x1a0a('0xf')]=_0x4a0eda[_0x1a0a('0xf')];this['sumDuration']=_0x4a0eda[_0x1a0a('0x10')];this[_0x1a0a('0x1b')]=_0x4a0eda['sumHoldTime']||0x0;this[_0x1a0a('0xe')]=_0x4a0eda[_0x1a0a('0xe')]||0x0;this[_0x1a0a('0x1c')]=_0x4a0eda['total']||0x0;this[_0x1a0a('0x1d')]=_0x4a0eda[_0x1a0a('0x1d')];this[_0x1a0a('0x1e')]=_0x4a0eda['unavailable']||0x0;this[_0x1a0a('0x1f')]=_0x4a0eda['unknown']||0x0;this[_0x1a0a('0x20')]=_0x4a0eda[_0x1a0a('0x20')]||0x0;this[_0x1a0a('0x11')]=_0x4a0eda[_0x1a0a('0x11')]||0x0;if(_0x4a0eda[_0x1a0a('0x1d')]==='outbound'){this[_0x1a0a('0x21')]=_0x4a0eda[_0x1a0a('0x21')]||0x0;this['dialActive']=_0x4a0eda['dialActive'];this[_0x1a0a('0x22')]=_0x4a0eda[_0x1a0a('0x22')];this[_0x1a0a('0x23')]=_0x4a0eda[_0x1a0a('0x23')];this[_0x1a0a('0x24')]=_0x4a0eda[_0x1a0a('0x24')];this[_0x1a0a('0x25')]=_0x4a0eda[_0x1a0a('0x25')];this[_0x1a0a('0x26')]=_0x4a0eda[_0x1a0a('0x26')];this[_0x1a0a('0x27')]=_0x4a0eda[_0x1a0a('0x27')];this[_0x1a0a('0x28')]=_0x4a0eda[_0x1a0a('0x28')];this[_0x1a0a('0x7')]=_0x4a0eda[_0x1a0a('0x7')];this[_0x1a0a('0x8')]=_0x4a0eda['outboundBlacklistCallsDay'];this[_0x1a0a('0x9')]=_0x4a0eda[_0x1a0a('0x9')];this[_0x1a0a('0xa')]=_0x4a0eda[_0x1a0a('0xa')];this[_0x1a0a('0x29')]=_0x4a0eda[_0x1a0a('0x29')];this[_0x1a0a('0x2a')]=_0x4a0eda[_0x1a0a('0x2a')];this[_0x1a0a('0x2b')]=_0x4a0eda[_0x1a0a('0x2b')];this['outboundNoAnswerCallsDay']=_0x4a0eda[_0x1a0a('0x2c')];this[_0x1a0a('0xb')]=_0x4a0eda['outboundNoSuchCallsDay'];this[_0x1a0a('0x2d')]=_0x4a0eda['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x4a0eda[_0x1a0a('0xc')];this[_0x1a0a('0xd')]=_0x4a0eda['outboundRejectCallsDay'];this[_0x1a0a('0x2e')]=_0x4a0eda[_0x1a0a('0x2e')];this[_0x1a0a('0x2f')]=_0x4a0eda['predictiveIntervalAnsweredCalls'];this[_0x1a0a('0x30')]=_0x4a0eda[_0x1a0a('0x30')];this['predictiveIntervalAvgTalktime']=_0x4a0eda[_0x1a0a('0x31')];this[_0x1a0a('0x32')]=_0x4a0eda['predictiveIntervalDroppedCallsCallersExit'];this[_0x1a0a('0x33')]=_0x4a0eda[_0x1a0a('0x33')];this[_0x1a0a('0x34')]=_0x4a0eda[_0x1a0a('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x4a0eda[_0x1a0a('0x35')];this[_0x1a0a('0x36')]=_0x4a0eda[_0x1a0a('0x36')];this[_0x1a0a('0x37')]=_0x4a0eda[_0x1a0a('0x37')];this[_0x1a0a('0x38')]=_0x4a0eda[_0x1a0a('0x38')];this[_0x1a0a('0x39')]=_0x4a0eda[_0x1a0a('0x39')];this['predictiveIntervalTotalCalls']=_0x4a0eda['predictiveIntervalTotalCalls'];this['originated']=_0x4a0eda['originated'];this[_0x1a0a('0x3a')]=_0x4a0eda['erlangCalls'];this[_0x1a0a('0x3b')]=_0x4a0eda[_0x1a0a('0x3b')];this['erlangAbandonmentRate']=_0x4a0eda['erlangAbandonmentRate'];this[_0x1a0a('0x3c')]=_0x4a0eda[_0x1a0a('0x3c')];this[_0x1a0a('0x3d')]=_0x4a0eda[_0x1a0a('0x3d')];this['startProgressive']=_0x4a0eda[_0x1a0a('0x3e')];this['message']=_0x4a0eda['message'];this['statusMessage']=_0x4a0eda[_0x1a0a('0x3f')];}if(_0x4a0eda[_0x1a0a('0x40')]){this['Trunk']={'id':_0x4a0eda[_0x1a0a('0x40')]['id'],'name':_0x4a0eda[_0x1a0a('0x40')]['name'],'active':_0x4a0eda['Trunk'][_0x1a0a('0x41')],'callerid':_0x4a0eda[_0x1a0a('0x40')]['callerid']};}}VoiceQueueSummary[_0x1a0a('0x42')][_0x1a0a('0x43')]=function(_0x56cfd6,_0x2f3ba1,_0x59bad4,_0x3a80be){this['loggedInDb']=0x0;this[_0x1a0a('0xe')]=0x0;this[_0x1a0a('0x2')]=0x0;this[_0x1a0a('0x1f')]=0x0;this[_0x1a0a('0x19')]=0x0;this['inUse']=0x0;this[_0x1a0a('0x15')]=0x0;this[_0x1a0a('0x17')]=0x0;this[_0x1a0a('0x1e')]=0x0;this[_0x1a0a('0x3')]=0x0;this['ringInUse']=0x0;this[_0x1a0a('0x18')]=0x0;if(_0x59bad4){if(_0x59bad4[_0x1a0a('0x0')]){this['available']=Number(_0x59bad4[_0x1a0a('0x0')]);}if(_0x59bad4[_0x1a0a('0x44')]){this[_0x1a0a('0x5')]=Number(_0x59bad4[_0x1a0a('0x44')]);}if(_0x59bad4[_0x1a0a('0x45')]){this[_0x1a0a('0x11')]=Number(_0x59bad4[_0x1a0a('0x45')]);}}for(var _0xf6df6c=0x0;_0xf6df6c<_0x56cfd6[_0x1a0a('0x46')];_0xf6df6c++){var _0xc1e997=_0x2f3ba1['SIP/'+_0x56cfd6[_0xf6df6c][_0x1a0a('0x12')]];if(_0xc1e997&&_0xc1e997[_0x1a0a('0x47')]){this['loggedInDb']+=0x1;}if(_0x56cfd6[_0xf6df6c]['incall']==='1'){this['talking']+=0x1;}if(_0x56cfd6[_0xf6df6c]['paused']==='1'&&!['2','7','8'][_0x1a0a('0x48')](_0x56cfd6[_0xf6df6c][_0x1a0a('0x49')])){this['paused']+=0x1;}switch(_0x56cfd6[_0xf6df6c]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x1a0a('0x19')]+=0x1;break;case'2':this[_0x1a0a('0x16')]+=0x1;break;case'3':this[_0x1a0a('0x15')]+=0x1;break;case'4':this[_0x1a0a('0x17')]+=0x1;break;case'5':this[_0x1a0a('0x1e')]+=0x1;break;case'6':this[_0x1a0a('0x3')]+=0x1;break;case'7':this[_0x1a0a('0x1a')]+=0x1;break;case'8':this[_0x1a0a('0x18')]+=0x1;break;}}if(this[_0x1a0a('0x22')]===_0x1a0a('0x4a')){var _0x1ed012=Object[_0x1a0a('0x4b')](_0x3a80be);for(var _0x23a985=0x0;_0x23a985<_0x1ed012['length'];_0x23a985++){var _0x3d0c86=_0x1ed012[_0x23a985];var _0x3f4967=_0x3a80be[_0x3d0c86];if(_0x3f4967[_0x1a0a('0x4c')]===this['name']&&_0x3f4967[_0x1a0a('0x1d')]===_0x1a0a('0x4d')&&_0x3f4967['exten']===_0x1a0a('0x4e')){this[_0x1a0a('0xe')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x1a0a('0xe')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x1a0a('0x42')]['compareToInboundQueue']=function(_0x54f016){var _0x217073=![];if(_0x54f016){_0x217073=INBOUND_COUNTERS[_0x1a0a('0x4f')](function(_0x3678c7){return this[_0x3678c7]!==_0x54f016[_0x3678c7];},this);}return _0x217073;};VoiceQueueSummary[_0x1a0a('0x42')][_0x1a0a('0x50')]=function(_0x1adef6){var _0x89d031=![];var _0x2fd9b5=![];var _0x3eb3f8=![];if(_0x1adef6){_0x89d031=this['dialMethod']!==_0x1adef6[_0x1a0a('0x22')]||this['dialActive']!==_0x1adef6[_0x1a0a('0x51')]||this[_0x1a0a('0x52')]!==_0x1adef6['message']||this['statusMessage']!==_0x1adef6[_0x1a0a('0x3f')];_0x2fd9b5=OUTBOUND_COUNTERS[_0x1a0a('0x4f')](function(_0x554907){return this[_0x554907]!==_0x1adef6[_0x554907];},this);if(this['Trunk']&&_0x1adef6[_0x1a0a('0x40')]){_0x3eb3f8=this['Trunk'][_0x1a0a('0x12')]!==_0x1adef6[_0x1a0a('0x40')]['name']||this[_0x1a0a('0x40')]['active']!==_0x1adef6[_0x1a0a('0x40')][_0x1a0a('0x41')];}}return _0x89d031||_0x2fd9b5||_0x3eb3f8;};VoiceQueueSummary['prototype'][_0x1a0a('0x53')]=function(_0x1f1f51){this[_0x1a0a('0x4')]=_0x1f1f51['answered'];this[_0x1a0a('0x52')]=_0x1f1f51[_0x1a0a('0x52')];this['statusMessage']=_0x1f1f51['statusMessage'];this[_0x1a0a('0x54')]=_0x1f1f51[_0x1a0a('0x54')];this[_0x1a0a('0x6')]=_0x1f1f51[_0x1a0a('0x6')];this['outboundAnswerCallsDay']=_0x1f1f51['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x1f1f51[_0x1a0a('0x8')];this['outboundBusyCallsDay']=_0x1f1f51[_0x1a0a('0x9')];this[_0x1a0a('0xa')]=_0x1f1f51[_0x1a0a('0xa')];this[_0x1a0a('0x2c')]=_0x1f1f51[_0x1a0a('0x2c')];this[_0x1a0a('0xb')]=_0x1f1f51[_0x1a0a('0xb')];this[_0x1a0a('0xc')]=_0x1f1f51[_0x1a0a('0xc')];this[_0x1a0a('0xd')]=_0x1f1f51[_0x1a0a('0xd')];this[_0x1a0a('0x2e')]=_0x1f1f51[_0x1a0a('0x2e')];this[_0x1a0a('0xf')]=_0x1f1f51[_0x1a0a('0xf')];this['sumDuration']=_0x1f1f51[_0x1a0a('0x10')];this[_0x1a0a('0x1c')]=_0x1f1f51[_0x1a0a('0x1c')];if(this[_0x1a0a('0x22')]==='preview'){this[_0x1a0a('0x21')]=_0x1f1f51[_0x1a0a('0x21')];}};module[_0x1a0a('0x55')]=VoiceQueueSummary;