Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / services / routing / model / faxQueue.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 _0x441d=['available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','faxPause'];(function(_0x4c9a26,_0x3c3e48){var _0x22e902=function(_0x460cbc){while(--_0x460cbc){_0x4c9a26['push'](_0x4c9a26['shift']());}};_0x22e902(++_0x3c3e48);}(_0x441d,0x1ab));var _0xd441=function(_0x3b868b,_0x4f3bc2){_0x3b868b=_0x3b868b-0x0;var _0x70f540=_0x441d[_0x3b868b];return _0x70f540;};'use strict';var _=require(_0xd441('0x0'));var md5=require(_0xd441('0x1'));var util=require(_0xd441('0x2'));var Redis=require(_0xd441('0x3'));var config=require(_0xd441('0x4'));config[_0xd441('0x5')]=_['defaults'](config[_0xd441('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xd441('0x6'))(new Redis(config[_0xd441('0x5')]));function FaxQueue(_0x3f96b1){this['id']=_0x3f96b1['id']||0x0;this[_0xd441('0x7')]=_0x3f96b1[_0xd441('0x7')]||'';this['timeout']=_0x3f96b1[_0xd441('0x8')]||0xa;this[_0xd441('0x9')]=_0x3f96b1[_0xd441('0x9')]||_0xd441('0xa');this[_0xd441('0xb')]=_0x3f96b1[_0xd441('0xb')];this[_0xd441('0xc')]={};this[_0xd441('0xd')]=0x0;this[_0xd441('0x1')]='';this[_0xd441('0xe')]();this[_0xd441('0xf')]();}FaxQueue['prototype'][_0xd441('0xe')]=function(){var _0x18c24f=this[_0xd441('0xc')][_0xd441('0x10')];this[_0xd441('0xc')]=_[_0xd441('0x11')](this[_0xd441('0xb')],'id');this[_0xd441('0xc')]['_rr']=_0x18c24f;};FaxQueue[_0xd441('0x12')]['updateRealtime']=function(){this[_0xd441('0x13')]=0x0;this[_0xd441('0x14')]=0x0;for(var _0x4ade30=0x0;_0x4ade30<this[_0xd441('0xb')][_0xd441('0x15')];_0x4ade30+=0x1){if(this[_0xd441('0xb')][_0x4ade30]['online']){this[_0xd441('0x13')]+=0x1;}if(this['Agents'][_0x4ade30][_0xd441('0x16')]){this[_0xd441('0x14')]+=0x1;}}this[_0xd441('0x17')]=this[_0xd441('0x13')]-this['paused'];this['available']=this[_0xd441('0x17')]>=0x0?this[_0xd441('0x17')]:0x0;var _0x2f4bd8={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xd441('0x7')],'paused':this[_0xd441('0x14')],'waiting':this['waiting']};var _0x1066a7=md5(JSON[_0xd441('0x18')](_0x2f4bd8));if(this[_0xd441('0x1')]!==_0x1066a7){this[_0xd441('0x1')]=_0x1066a7;io['to'](util[_0xd441('0x19')](_0xd441('0x1a'),_0x2f4bd8[_0xd441('0x7')]))[_0xd441('0x1b')](_0xd441('0x1c'),_0x2f4bd8);}};module[_0xd441('0x1d')]=FaxQueue;