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 _0x3efc=['lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x5279d9,_0x12ab4b){var _0x52f1cc=function(_0x52ee79){while(--_0x52ee79){_0x5279d9['push'](_0x5279d9['shift']());}};_0x52f1cc(++_0x12ab4b);}(_0x3efc,0x150));var _0xc3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efc[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xc3ef('0x0'));var md5=require(_0xc3ef('0x1'));var util=require(_0xc3ef('0x2'));var Redis=require('ioredis');var config=require(_0xc3ef('0x3'));config[_0xc3ef('0x4')]=_[_0xc3ef('0x5')](config[_0xc3ef('0x4')],{'host':_0xc3ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc3ef('0x4')]));function OpenchannelQueue(_0x2e6e54){this['id']=_0x2e6e54['id']||0x0;this[_0xc3ef('0x7')]=_0x2e6e54[_0xc3ef('0x7')]||'';this[_0xc3ef('0x8')]=_0x2e6e54[_0xc3ef('0x8')]||0xa;this[_0xc3ef('0x9')]=_0x2e6e54['strategy']||_0xc3ef('0xa');this['Agents']=_0x2e6e54[_0xc3ef('0xb')];this['mapAgentsId']={};this[_0xc3ef('0xc')]=0x0;this[_0xc3ef('0x1')]='';this[_0xc3ef('0xd')]();this[_0xc3ef('0xe')]();}OpenchannelQueue[_0xc3ef('0xf')][_0xc3ef('0xd')]=function(){var _0xe5999b=this[_0xc3ef('0x10')][_0xc3ef('0x11')];this['mapAgentsId']=_[_0xc3ef('0x12')](this[_0xc3ef('0xb')],'id');this[_0xc3ef('0x10')]['_rr']=_0xe5999b;};OpenchannelQueue['prototype'][_0xc3ef('0xe')]=function(){this[_0xc3ef('0x13')]=0x0;this[_0xc3ef('0x14')]=0x0;for(var _0x53a59a=0x0;_0x53a59a<this[_0xc3ef('0xb')]['length'];_0x53a59a+=0x1){if(this[_0xc3ef('0xb')][_0x53a59a][_0xc3ef('0x15')]){this[_0xc3ef('0x13')]+=0x1;}if(this[_0xc3ef('0xb')][_0x53a59a][_0xc3ef('0x16')]){this[_0xc3ef('0x14')]+=0x1;}}this[_0xc3ef('0x17')]=this[_0xc3ef('0x13')]-this[_0xc3ef('0x14')];this[_0xc3ef('0x17')]=this[_0xc3ef('0x17')]>=0x0?this['available']:0x0;var _0x52c35c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc3ef('0x7')],'paused':this[_0xc3ef('0x14')],'waiting':this[_0xc3ef('0xc')]};var _0x5306a2=md5(JSON[_0xc3ef('0x18')](_0x52c35c));if(this[_0xc3ef('0x1')]!==_0x5306a2){this[_0xc3ef('0x1')]=_0x5306a2;io['to'](util['format'](_0xc3ef('0x19'),_0x52c35c[_0xc3ef('0x7')]))[_0xc3ef('0x1a')](_0xc3ef('0x1b'),_0x52c35c);}};module['exports']=OpenchannelQueue;