Built motion from commit 1efd3d96.|2.6.31
[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 _0x1dee=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1dee,0x147));var _0xe1de=function(_0x396832,_0x3ccff6){_0x396832=_0x396832-0x0;var _0x560da3=_0x1dee[_0x396832];return _0x560da3;};'use strict';var _=require(_0xe1de('0x0'));var md5=require(_0xe1de('0x1'));var util=require(_0xe1de('0x2'));var Redis=require(_0xe1de('0x3'));var config=require(_0xe1de('0x4'));config[_0xe1de('0x5')]=_[_0xe1de('0x6')](config['redis'],{'host':_0xe1de('0x7'),'port':0x18eb});var io=require(_0xe1de('0x8'))(new Redis(config['redis']));function FaxQueue(_0x5b9730){this['id']=_0x5b9730['id']||0x0;this[_0xe1de('0x9')]=_0x5b9730[_0xe1de('0x9')]||'';this[_0xe1de('0xa')]=_0x5b9730[_0xe1de('0xa')]||0xa;this['strategy']=_0x5b9730['strategy']||_0xe1de('0xb');this['Agents']=_0x5b9730[_0xe1de('0xc')];this[_0xe1de('0xd')]={};this[_0xe1de('0xe')]=0x0;this['md5']='';this[_0xe1de('0xf')]();this[_0xe1de('0x10')]();}FaxQueue[_0xe1de('0x11')][_0xe1de('0xf')]=function(){var _0x3564a3=this[_0xe1de('0xd')][_0xe1de('0x12')];this[_0xe1de('0xd')]=_['map'](this[_0xe1de('0xc')],'id');this[_0xe1de('0xd')]['_rr']=_0x3564a3;};FaxQueue[_0xe1de('0x11')]['updateRealtime']=function(){this[_0xe1de('0x13')]=0x0;this['paused']=0x0;for(var _0x4ef591=0x0;_0x4ef591<this[_0xe1de('0xc')][_0xe1de('0x14')];_0x4ef591+=0x1){if(this['Agents'][_0x4ef591]['online']){this['loggedIn']+=0x1;}if(this['Agents'][_0x4ef591][_0xe1de('0x15')]){this[_0xe1de('0x16')]+=0x1;}}this[_0xe1de('0x17')]=this[_0xe1de('0x13')]-this[_0xe1de('0x16')];this['available']=this[_0xe1de('0x17')]>=0x0?this[_0xe1de('0x17')]:0x0;var _0x18a4cf={'id':this['id'],'available':this[_0xe1de('0x17')],'loggedIn':this[_0xe1de('0x13')],'name':this[_0xe1de('0x9')],'paused':this[_0xe1de('0x16')],'waiting':this[_0xe1de('0xe')]};var _0x8561f2=md5(JSON[_0xe1de('0x18')](_0x18a4cf));if(this[_0xe1de('0x1')]!==_0x8561f2){this['md5']=_0x8561f2;io['to'](util[_0xe1de('0x19')](_0xe1de('0x1a'),_0x18a4cf[_0xe1de('0x9')]))[_0xe1de('0x1b')](_0xe1de('0x1c'),_0x18a4cf);}};module[_0xe1de('0x1d')]=FaxQueue;