Built motion from commit (unavailable).|2.0.83
[motion2.git] / server / services / routing / model / smsQueue.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 _0x1b88=['smsPause','available','waiting','stringify','format','sms:queue:%s','exports','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x1b88,0x166));var _0x81b8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1b88[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var md5=require(_0x81b8('0x0'));var util=require(_0x81b8('0x1'));var config=require(_0x81b8('0x2'));config[_0x81b8('0x3')]=_['defaults'](config['redis'],{'host':_0x81b8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(config[_0x81b8('0x3')]);function SmsQueue(_0x377944){this['id']=_0x377944['id']||0x0;this['name']=_0x377944[_0x81b8('0x5')]||'';this['timeout']=_0x377944[_0x81b8('0x6')]||0xa;this[_0x81b8('0x7')]=_0x377944[_0x81b8('0x7')]||_0x81b8('0x8');this[_0x81b8('0x9')]=_0x377944['Agents'];this[_0x81b8('0xa')]={};this['waiting']=0x0;this[_0x81b8('0x0')]='';this[_0x81b8('0xb')]();this[_0x81b8('0xc')]();}SmsQueue['prototype'][_0x81b8('0xb')]=function(){var _0x56adb0=this['mapAgentsId'][_0x81b8('0xd')];this[_0x81b8('0xa')]=_[_0x81b8('0xe')](this['Agents'],'id');this['mapAgentsId'][_0x81b8('0xd')]=_0x56adb0;};SmsQueue[_0x81b8('0xf')][_0x81b8('0xc')]=function(){this[_0x81b8('0x10')]=0x0;this[_0x81b8('0x11')]=0x0;for(var _0xd44af3=0x0;_0xd44af3<this[_0x81b8('0x9')][_0x81b8('0x12')];_0xd44af3+=0x1){if(this[_0x81b8('0x9')][_0xd44af3][_0x81b8('0x13')]){this[_0x81b8('0x10')]+=0x1;}if(this[_0x81b8('0x9')][_0xd44af3][_0x81b8('0x14')]){this[_0x81b8('0x11')]+=0x1;}}this[_0x81b8('0x15')]=this[_0x81b8('0x10')]-this['paused'];this[_0x81b8('0x15')]=this[_0x81b8('0x15')]>=0x0?this[_0x81b8('0x15')]:0x0;var _0x149c61={'id':this['id'],'available':this['available'],'loggedIn':this[_0x81b8('0x10')],'name':this[_0x81b8('0x5')],'paused':this['paused'],'waiting':this[_0x81b8('0x16')]};var _0x3f6c96=md5(JSON[_0x81b8('0x17')](_0x149c61));if(this['md5']!==_0x3f6c96){this['md5']=_0x3f6c96;io['to'](util[_0x81b8('0x18')](_0x81b8('0x19'),_0x149c61[_0x81b8('0x5')]))['emit']('sms_queue:save',_0x149c61);}};module[_0x81b8('0x1a')]=SmsQueue;