Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / api / userVoiceQueueRt / userVoiceQueueRt.rpc.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 _0x7a6a=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x886693,_0x541621){var _0x8d7e2f=function(_0x271650){while(--_0x271650){_0x886693['push'](_0x886693['shift']());}};_0x8d7e2f(++_0x541621);}(_0x7a6a,0xe4));var _0xa7a6=function(_0x1227c0,_0x5d91ee){_0x1227c0=_0x1227c0-0x0;var _0x557d9d=_0x7a6a[_0x1227c0];return _0x557d9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa7a6('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7a6('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7a6('0x2'));var logger=require(_0xa7a6('0x3'))(_0xa7a6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa7a6('0x5')]['http']({'port':0x232a});config[_0xa7a6('0x6')]=_[_0xa7a6('0x7')](config[_0xa7a6('0x6')],{'host':_0xa7a6('0x8'),'port':0x18eb});var socket=require(_0xa7a6('0x9'))(new Redis(config[_0xa7a6('0x6')]));require(_0xa7a6('0xa'))[_0xa7a6('0xb')](socket);function respondWithRpcPromise(_0x52ef83,_0x20c0d6,_0x51c078){return new BPromise(function(_0x5c9b29,_0x800b70){return client[_0xa7a6('0xc')](_0x52ef83,_0x51c078)[_0xa7a6('0xd')](function(_0x3a3bc6){logger[_0xa7a6('0xe')](_0xa7a6('0xf'),_0x20c0d6,_0xa7a6('0x10'));logger[_0xa7a6('0x11')](_0xa7a6('0x12'),_0x20c0d6,_0xa7a6('0x10'),JSON[_0xa7a6('0x13')](_0x3a3bc6));if(_0x3a3bc6[_0xa7a6('0x14')]){if(_0x3a3bc6['error'][_0xa7a6('0x15')]===0x1f4){logger['error'](_0xa7a6('0xf'),_0x20c0d6,_0x3a3bc6[_0xa7a6('0x14')][_0xa7a6('0x16')]);return _0x800b70(_0x3a3bc6['error'][_0xa7a6('0x16')]);}logger['error'](_0xa7a6('0xf'),_0x20c0d6,_0x3a3bc6[_0xa7a6('0x14')]['message']);return _0x5c9b29(_0x3a3bc6[_0xa7a6('0x14')]['message']);}else{logger[_0xa7a6('0xe')](_0xa7a6('0xf'),_0x20c0d6,'request\x20sent');_0x5c9b29(_0x3a3bc6[_0xa7a6('0x17')]['message']);}})[_0xa7a6('0x18')](function(_0xfc0cc5){logger[_0xa7a6('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x20c0d6,_0xfc0cc5);_0x800b70(_0xfc0cc5);});});}exports[_0xa7a6('0x19')]=function(_0x577ac2){var _0x14d58f=this;return new Promise(function(_0x531490,_0x9bd1c9){return db[_0xa7a6('0x1a')][_0xa7a6('0x1b')]({'raw':_0x577ac2[_0xa7a6('0x1c')]?_0x577ac2[_0xa7a6('0x1c')][_0xa7a6('0x1d')]===undefined?!![]:![]:!![],'where':_0x577ac2[_0xa7a6('0x1c')]?_0x577ac2[_0xa7a6('0x1c')]['where']||null:null,'attributes':[[db[_0xa7a6('0x1e')]['fn'](_0xa7a6('0x1f'),db[_0xa7a6('0x1e')]['fn']('IF',db[_0xa7a6('0x1e')][_0xa7a6('0x20')](_0xa7a6('0x21')))),_0xa7a6('0x22')]]})[_0xa7a6('0xd')](function(_0x5647ab){logger[_0xa7a6('0xe')]('GetVoiceQueueRtPauses',_0x577ac2);logger[_0xa7a6('0x11')](_0xa7a6('0x19'),_0x577ac2,JSON[_0xa7a6('0x13')](_0x5647ab));_0x531490(_0x5647ab);})[_0xa7a6('0x18')](function(_0x2daf05){logger[_0xa7a6('0x14')](_0xa7a6('0x19'),_0x2daf05[_0xa7a6('0x16')],_0x577ac2);_0x9bd1c9(_0x14d58f['error'](0x1f4,_0x2daf05[_0xa7a6('0x16')]));});});};