Built motion from commit c738b9ac.|2.6.25
[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 _0xcc3f=['outboundQueuePauses','GetVoiceQueueRtPauses','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x2d27eb,_0x14ef92){var _0xc31ab0=function(_0x85df6a){while(--_0x85df6a){_0x2d27eb['push'](_0x2d27eb['shift']());}};_0xc31ab0(++_0x14ef92);}(_0xcc3f,0xd1));var _0xfcc3=function(_0x377671,_0x56d64e){_0x377671=_0x377671-0x0;var _0x3c91d3=_0xcc3f[_0x377671];return _0x3c91d3;};'use strict';var _=require(_0xfcc3('0x0'));var util=require(_0xfcc3('0x1'));var moment=require(_0xfcc3('0x2'));var BPromise=require(_0xfcc3('0x3'));var rs=require(_0xfcc3('0x4'));var fs=require('fs');var Redis=require(_0xfcc3('0x5'));var db=require(_0xfcc3('0x6'))['db'];var utils=require(_0xfcc3('0x7'));var logger=require(_0xfcc3('0x8'))(_0xfcc3('0x9'));var config=require(_0xfcc3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfcc3('0xb')][_0xfcc3('0xc')]({'port':0x232a});config[_0xfcc3('0xd')]=_[_0xfcc3('0xe')](config[_0xfcc3('0xd')],{'host':_0xfcc3('0xf'),'port':0x18eb});var socket=require(_0xfcc3('0x10'))(new Redis(config[_0xfcc3('0xd')]));require(_0xfcc3('0x11'))[_0xfcc3('0x12')](socket);function respondWithRpcPromise(_0x3428ab,_0x2f5598,_0x40af40){return new BPromise(function(_0x175c51,_0x1c72c1){return client[_0xfcc3('0x13')](_0x3428ab,_0x40af40)[_0xfcc3('0x14')](function(_0x48d5f2){logger[_0xfcc3('0x15')](_0xfcc3('0x16'),_0x2f5598,_0xfcc3('0x17'));logger['debug'](_0xfcc3('0x18'),_0x2f5598,_0xfcc3('0x17'),JSON['stringify'](_0x48d5f2));if(_0x48d5f2[_0xfcc3('0x19')]){if(_0x48d5f2[_0xfcc3('0x19')][_0xfcc3('0x1a')]===0x1f4){logger['error'](_0xfcc3('0x16'),_0x2f5598,_0x48d5f2['error'][_0xfcc3('0x1b')]);return _0x1c72c1(_0x48d5f2[_0xfcc3('0x19')][_0xfcc3('0x1b')]);}logger['error'](_0xfcc3('0x16'),_0x2f5598,_0x48d5f2[_0xfcc3('0x19')]['message']);return _0x175c51(_0x48d5f2[_0xfcc3('0x19')][_0xfcc3('0x1b')]);}else{logger[_0xfcc3('0x15')](_0xfcc3('0x16'),_0x2f5598,_0xfcc3('0x17'));_0x175c51(_0x48d5f2['result']['message']);}})[_0xfcc3('0x1c')](function(_0x2dbfc5){logger[_0xfcc3('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2f5598,_0x2dbfc5);_0x1c72c1(_0x2dbfc5);});});}exports['GetVoiceQueueRtPauses']=function(_0x2ed10c){var _0xe36557=this;return new Promise(function(_0x4c42d9,_0x1c2f2e){return db[_0xfcc3('0x1d')]['findAll']({'raw':_0x2ed10c['options']?_0x2ed10c[_0xfcc3('0x1e')][_0xfcc3('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ed10c[_0xfcc3('0x1e')]?_0x2ed10c[_0xfcc3('0x1e')][_0xfcc3('0x20')]||null:null,'attributes':[[db[_0xfcc3('0x21')]['fn'](_0xfcc3('0x22'),db[_0xfcc3('0x21')]['fn']('IF',db[_0xfcc3('0x21')][_0xfcc3('0x23')](_0xfcc3('0x24')))),_0xfcc3('0x25')]]})['then'](function(_0x1162be){logger[_0xfcc3('0x15')](_0xfcc3('0x26'),_0x2ed10c);logger[_0xfcc3('0x27')](_0xfcc3('0x26'),_0x2ed10c,JSON[_0xfcc3('0x28')](_0x1162be));_0x4c42d9(_0x1162be);})[_0xfcc3('0x1c')](function(_0x3d2dc8){logger[_0xfcc3('0x19')](_0xfcc3('0x26'),_0x3d2dc8[_0xfcc3('0x1b')],_0x2ed10c);_0x1c2f2e(_0xe36557[_0xfcc3('0x19')](0x1f4,_0x3d2dc8[_0xfcc3('0x1b')]));});});};