Built motion from commit 3e059bc2.|2.5.32
[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 _0x5833=['faxPause','available','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','updateRealtime','loggedIn','paused','online'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0x5833,0x1b9));var _0x3583=function(_0x4bb335,_0x3e53dc){_0x4bb335=_0x4bb335-0x0;var _0x2f02f9=_0x5833[_0x4bb335];return _0x2f02f9;};'use strict';var _=require(_0x3583('0x0'));var md5=require(_0x3583('0x1'));var util=require(_0x3583('0x2'));var Redis=require(_0x3583('0x3'));var config=require(_0x3583('0x4'));config[_0x3583('0x5')]=_[_0x3583('0x6')](config[_0x3583('0x5')],{'host':_0x3583('0x7'),'port':0x18eb});var io=require(_0x3583('0x8'))(new Redis(config[_0x3583('0x5')]));function FaxQueue(_0x3808b7){this['id']=_0x3808b7['id']||0x0;this[_0x3583('0x9')]=_0x3808b7[_0x3583('0x9')]||'';this[_0x3583('0xa')]=_0x3808b7[_0x3583('0xa')]||0xa;this[_0x3583('0xb')]=_0x3808b7[_0x3583('0xb')]||_0x3583('0xc');this['Agents']=_0x3808b7[_0x3583('0xd')];this[_0x3583('0xe')]={};this[_0x3583('0xf')]=0x0;this['md5']='';this[_0x3583('0x10')]();this['updateRealtime']();}FaxQueue['prototype'][_0x3583('0x10')]=function(){var _0x310233=this[_0x3583('0xe')][_0x3583('0x11')];this['mapAgentsId']=_[_0x3583('0x12')](this[_0x3583('0xd')],'id');this[_0x3583('0xe')][_0x3583('0x11')]=_0x310233;};FaxQueue['prototype'][_0x3583('0x13')]=function(){this[_0x3583('0x14')]=0x0;this[_0x3583('0x15')]=0x0;for(var _0x137935=0x0;_0x137935<this[_0x3583('0xd')]['length'];_0x137935+=0x1){if(this[_0x3583('0xd')][_0x137935][_0x3583('0x16')]){this['loggedIn']+=0x1;}if(this[_0x3583('0xd')][_0x137935][_0x3583('0x17')]){this[_0x3583('0x15')]+=0x1;}}this[_0x3583('0x18')]=this[_0x3583('0x14')]-this['paused'];this[_0x3583('0x18')]=this['available']>=0x0?this['available']:0x0;var _0x522857={'id':this['id'],'available':this[_0x3583('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x3583('0x15')],'waiting':this[_0x3583('0xf')]};var _0x52e109=md5(JSON['stringify'](_0x522857));if(this[_0x3583('0x1')]!==_0x52e109){this[_0x3583('0x1')]=_0x52e109;io['to'](util[_0x3583('0x19')](_0x3583('0x1a'),_0x522857[_0x3583('0x9')]))[_0x3583('0x1b')](_0x3583('0x1c'),_0x522857);}};module['exports']=FaxQueue;