0995c0591eab3ed65fa0de0f06c74ae2e83186a1
[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 _0x2cfb=['UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x2cfb,0x1b2));var _0xb2cf=function(_0x3cef2a,_0x48bc9d){_0x3cef2a=_0x3cef2a-0x0;var _0x4a303b=_0x2cfb[_0x3cef2a];return _0x4a303b;};'use strict';var _=require(_0xb2cf('0x0'));var util=require(_0xb2cf('0x1'));var moment=require('moment');var BPromise=require(_0xb2cf('0x2'));var rs=require(_0xb2cf('0x3'));var fs=require('fs');var Redis=require(_0xb2cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2cf('0x5'));var logger=require('../../config/logger')(_0xb2cf('0x6'));var config=require(_0xb2cf('0x7'));var jayson=require(_0xb2cf('0x8'));var client=jayson['client'][_0xb2cf('0x9')]({'port':0x232a});config[_0xb2cf('0xa')]=_[_0xb2cf('0xb')](config[_0xb2cf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2cf('0xc'))(new Redis(config[_0xb2cf('0xa')]));require('./userVoiceQueueRt.socket')[_0xb2cf('0xd')](socket);function respondWithRpcPromise(_0x471869,_0x1282aa,_0xec4a15){return new BPromise(function(_0x4dcb54,_0x3af6a6){return client[_0xb2cf('0xe')](_0x471869,_0xec4a15)[_0xb2cf('0xf')](function(_0x4fb6bf){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1282aa,_0xb2cf('0x10'));logger[_0xb2cf('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1282aa,_0xb2cf('0x10'),JSON[_0xb2cf('0x12')](_0x4fb6bf));if(_0x4fb6bf[_0xb2cf('0x13')]){if(_0x4fb6bf[_0xb2cf('0x13')][_0xb2cf('0x14')]===0x1f4){logger[_0xb2cf('0x13')](_0xb2cf('0x15'),_0x1282aa,_0x4fb6bf[_0xb2cf('0x13')][_0xb2cf('0x16')]);return _0x3af6a6(_0x4fb6bf[_0xb2cf('0x13')][_0xb2cf('0x16')]);}logger[_0xb2cf('0x13')](_0xb2cf('0x15'),_0x1282aa,_0x4fb6bf[_0xb2cf('0x13')][_0xb2cf('0x16')]);return _0x4dcb54(_0x4fb6bf['error'][_0xb2cf('0x16')]);}else{logger[_0xb2cf('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1282aa,'request\x20sent');_0x4dcb54(_0x4fb6bf[_0xb2cf('0x18')][_0xb2cf('0x16')]);}})['catch'](function(_0x3d3383){logger[_0xb2cf('0x13')](_0xb2cf('0x15'),_0x1282aa,_0x3d3383);_0x3af6a6(_0x3d3383);});});}exports[_0xb2cf('0x19')]=function(_0x423ba4){var _0xead233=this;return new Promise(function(_0x4f4891,_0xb33b9d){return db[_0xb2cf('0x1a')][_0xb2cf('0x1b')]({'raw':_0x423ba4[_0xb2cf('0x1c')]?_0x423ba4[_0xb2cf('0x1c')][_0xb2cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x423ba4[_0xb2cf('0x1c')]?_0x423ba4['options'][_0xb2cf('0x1e')]||null:null,'attributes':[[db[_0xb2cf('0x1f')]['fn'](_0xb2cf('0x20'),db[_0xb2cf('0x1f')]['fn']('IF',db[_0xb2cf('0x1f')]['literal'](_0xb2cf('0x21')))),_0xb2cf('0x22')]]})[_0xb2cf('0xf')](function(_0x34f0ec){logger[_0xb2cf('0x17')](_0xb2cf('0x19'),_0x423ba4);logger[_0xb2cf('0x11')](_0xb2cf('0x19'),_0x423ba4,JSON['stringify'](_0x34f0ec));_0x4f4891(_0x34f0ec);})['catch'](function(_0x3e9b19){logger[_0xb2cf('0x13')]('GetVoiceQueueRtPauses',_0x3e9b19['message'],_0x423ba4);_0xb33b9d(_0xead233[_0xb2cf('0x13')](0x1f4,_0x3e9b19[_0xb2cf('0x16')]));});});};