Built motion from commit ddca4d0d.|2.5.47
[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 _0x3d26=['updateRealtime','_rr','map','prototype','loggedIn','paused','length','faxPause','available','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x55e276,_0x58a6c9){var _0x1fb18b=function(_0x61337){while(--_0x61337){_0x55e276['push'](_0x55e276['shift']());}};_0x1fb18b(++_0x58a6c9);}(_0x3d26,0x178));var _0x63d2=function(_0x2b9348,_0x234efa){_0x2b9348=_0x2b9348-0x0;var _0xe63f6c=_0x3d26[_0x2b9348];return _0xe63f6c;};'use strict';var _=require(_0x63d2('0x0'));var md5=require(_0x63d2('0x1'));var util=require(_0x63d2('0x2'));var Redis=require(_0x63d2('0x3'));var config=require(_0x63d2('0x4'));config['redis']=_[_0x63d2('0x5')](config[_0x63d2('0x6')],{'host':_0x63d2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x63d2('0x6')]));function FaxQueue(_0x21b4cd){this['id']=_0x21b4cd['id']||0x0;this[_0x63d2('0x8')]=_0x21b4cd[_0x63d2('0x8')]||'';this[_0x63d2('0x9')]=_0x21b4cd[_0x63d2('0x9')]||0xa;this['strategy']=_0x21b4cd[_0x63d2('0xa')]||_0x63d2('0xb');this[_0x63d2('0xc')]=_0x21b4cd['Agents'];this[_0x63d2('0xd')]={};this[_0x63d2('0xe')]=0x0;this[_0x63d2('0x1')]='';this[_0x63d2('0xf')]();this[_0x63d2('0x10')]();}FaxQueue['prototype'][_0x63d2('0xf')]=function(){var _0x2f442c=this['mapAgentsId'][_0x63d2('0x11')];this['mapAgentsId']=_[_0x63d2('0x12')](this[_0x63d2('0xc')],'id');this[_0x63d2('0xd')][_0x63d2('0x11')]=_0x2f442c;};FaxQueue[_0x63d2('0x13')][_0x63d2('0x10')]=function(){this[_0x63d2('0x14')]=0x0;this[_0x63d2('0x15')]=0x0;for(var _0x431da9=0x0;_0x431da9<this[_0x63d2('0xc')][_0x63d2('0x16')];_0x431da9+=0x1){if(this[_0x63d2('0xc')][_0x431da9]['online']){this[_0x63d2('0x14')]+=0x1;}if(this[_0x63d2('0xc')][_0x431da9][_0x63d2('0x17')]){this['paused']+=0x1;}}this[_0x63d2('0x18')]=this[_0x63d2('0x14')]-this['paused'];this[_0x63d2('0x18')]=this[_0x63d2('0x18')]>=0x0?this[_0x63d2('0x18')]:0x0;var _0x529a59={'id':this['id'],'available':this[_0x63d2('0x18')],'loggedIn':this[_0x63d2('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x178257=md5(JSON['stringify'](_0x529a59));if(this[_0x63d2('0x1')]!==_0x178257){this[_0x63d2('0x1')]=_0x178257;io['to'](util['format'](_0x63d2('0x19'),_0x529a59[_0x63d2('0x8')]))[_0x63d2('0x1a')](_0x63d2('0x1b'),_0x529a59);}};module['exports']=FaxQueue;