Built motion from commit (unavailable).|2.0.74
[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 _0x4ab1=['stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','loggedIn','openchannelPause','available'];(function(_0x527627,_0x11810d){var _0x448dbc=function(_0x24295e){while(--_0x24295e){_0x527627['push'](_0x527627['shift']());}};_0x448dbc(++_0x11810d);}(_0x4ab1,0x6d));var _0x14ab=function(_0x2a49e9,_0x5b0194){_0x2a49e9=_0x2a49e9-0x0;var _0x383ab4=_0x4ab1[_0x2a49e9];return _0x383ab4;};'use strict';var _=require(_0x14ab('0x0'));var md5=require(_0x14ab('0x1'));var util=require('util');var io=require(_0x14ab('0x2'))({'host':_0x14ab('0x3'),'port':0x18eb});function OpenchannelQueue(_0x5da392){this['id']=_0x5da392['id']||0x0;this[_0x14ab('0x4')]=_0x5da392[_0x14ab('0x4')]||'';this[_0x14ab('0x5')]=_0x5da392[_0x14ab('0x5')]||0xa;this[_0x14ab('0x6')]=_0x5da392[_0x14ab('0x6')]||_0x14ab('0x7');this[_0x14ab('0x8')]=_0x5da392[_0x14ab('0x8')];this[_0x14ab('0x9')]={};this['waiting']=0x0;this[_0x14ab('0x1')]='';this['updateRouting']();this[_0x14ab('0xa')]();}OpenchannelQueue[_0x14ab('0xb')][_0x14ab('0xc')]=function(){var _0x34a68e=this[_0x14ab('0x9')][_0x14ab('0xd')];this[_0x14ab('0x9')]=_[_0x14ab('0xe')](this[_0x14ab('0x8')],'id');this['mapAgentsId'][_0x14ab('0xd')]=_0x34a68e;};OpenchannelQueue['prototype'][_0x14ab('0xa')]=function(){this['loggedIn']=0x0;this[_0x14ab('0xf')]=0x0;for(var _0x405ed4=0x0;_0x405ed4<this[_0x14ab('0x8')][_0x14ab('0x10')];_0x405ed4+=0x1){if(this[_0x14ab('0x8')][_0x405ed4][_0x14ab('0x11')]){this[_0x14ab('0x12')]+=0x1;}if(this[_0x14ab('0x8')][_0x405ed4][_0x14ab('0x13')]){this[_0x14ab('0xf')]+=0x1;}}this[_0x14ab('0x14')]=this[_0x14ab('0x12')]-this[_0x14ab('0xf')];this[_0x14ab('0x14')]=this['available']>=0x0?this[_0x14ab('0x14')]:0x0;var _0x5bb519={'id':this['id'],'available':this['available'],'loggedIn':this[_0x14ab('0x12')],'name':this[_0x14ab('0x4')],'paused':this[_0x14ab('0xf')],'waiting':this['waiting']};var _0x40b6d2=md5(JSON[_0x14ab('0x15')](_0x5bb519));if(this[_0x14ab('0x1')]!==_0x40b6d2){this[_0x14ab('0x1')]=_0x40b6d2;io['to'](util[_0x14ab('0x16')](_0x14ab('0x17'),_0x5bb519[_0x14ab('0x4')]))['emit'](_0x14ab('0x18'),_0x5bb519);}};module[_0x14ab('0x19')]=OpenchannelQueue;