Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / routing / model / openchannelQueue.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 _0x5bfd=['waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x5df1c2,_0x36604c){var _0x1fa485=function(_0x2fc768){while(--_0x2fc768){_0x5df1c2['push'](_0x5df1c2['shift']());}};_0x1fa485(++_0x36604c);}(_0x5bfd,0x15a));var _0xd5bf=function(_0x31656c,_0x5303c4){_0x31656c=_0x31656c-0x0;var _0xf38b55=_0x5bfd[_0x31656c];return _0xf38b55;};'use strict';var _=require(_0xd5bf('0x0'));var md5=require(_0xd5bf('0x1'));var util=require('util');var Redis=require(_0xd5bf('0x2'));var config=require(_0xd5bf('0x3'));config[_0xd5bf('0x4')]=_[_0xd5bf('0x5')](config[_0xd5bf('0x4')],{'host':_0xd5bf('0x6'),'port':0x18eb});var io=require(_0xd5bf('0x7'))(new Redis(config[_0xd5bf('0x4')]));function OpenchannelQueue(_0x46dc0c){this['id']=_0x46dc0c['id']||0x0;this['name']=_0x46dc0c[_0xd5bf('0x8')]||'';this[_0xd5bf('0x9')]=_0x46dc0c[_0xd5bf('0x9')]||0xa;this[_0xd5bf('0xa')]=_0x46dc0c[_0xd5bf('0xa')]||_0xd5bf('0xb');this['Agents']=_0x46dc0c[_0xd5bf('0xc')];this[_0xd5bf('0xd')]={};this[_0xd5bf('0xe')]=0x0;this[_0xd5bf('0x1')]='';this[_0xd5bf('0xf')]();this[_0xd5bf('0x10')]();}OpenchannelQueue['prototype'][_0xd5bf('0xf')]=function(){var _0x580e90=this['mapAgentsId'][_0xd5bf('0x11')];this[_0xd5bf('0xd')]=_[_0xd5bf('0x12')](this[_0xd5bf('0xc')],'id');this['mapAgentsId'][_0xd5bf('0x11')]=_0x580e90;};OpenchannelQueue['prototype'][_0xd5bf('0x10')]=function(){this[_0xd5bf('0x13')]=0x0;this[_0xd5bf('0x14')]=0x0;for(var _0x17f4d5=0x0;_0x17f4d5<this[_0xd5bf('0xc')][_0xd5bf('0x15')];_0x17f4d5+=0x1){if(this[_0xd5bf('0xc')][_0x17f4d5][_0xd5bf('0x16')]){this['loggedIn']+=0x1;}if(this[_0xd5bf('0xc')][_0x17f4d5][_0xd5bf('0x17')]){this[_0xd5bf('0x14')]+=0x1;}}this[_0xd5bf('0x18')]=this[_0xd5bf('0x13')]-this[_0xd5bf('0x14')];this['available']=this[_0xd5bf('0x18')]>=0x0?this[_0xd5bf('0x18')]:0x0;var _0x5c7118={'id':this['id'],'available':this[_0xd5bf('0x18')],'loggedIn':this[_0xd5bf('0x13')],'name':this[_0xd5bf('0x8')],'paused':this[_0xd5bf('0x14')],'waiting':this[_0xd5bf('0xe')]};var _0x261055=md5(JSON[_0xd5bf('0x19')](_0x5c7118));if(this[_0xd5bf('0x1')]!==_0x261055){this[_0xd5bf('0x1')]=_0x261055;io['to'](util[_0xd5bf('0x1a')](_0xd5bf('0x1b'),_0x5c7118[_0xd5bf('0x8')]))[_0xd5bf('0x1c')]('openchannel_queue:save',_0x5c7118);}};module[_0xd5bf('0x1d')]=OpenchannelQueue;