a6e7238e7cb148d758c6bb16fc1f2fa3d2b4dbc6
[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 _0x6f92=['GetVoiceQueueRtPauses','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info'];(function(_0x3ff0e5,_0xdc43ce){var _0x393882=function(_0x3eedd5){while(--_0x3eedd5){_0x3ff0e5['push'](_0x3ff0e5['shift']());}};_0x393882(++_0xdc43ce);}(_0x6f92,0x1c5));var _0x26f9=function(_0x21b3ac,_0x14460f){_0x21b3ac=_0x21b3ac-0x0;var _0x408333=_0x6f92[_0x21b3ac];return _0x408333;};'use strict';var _=require(_0x26f9('0x0'));var util=require(_0x26f9('0x1'));var moment=require(_0x26f9('0x2'));var BPromise=require(_0x26f9('0x3'));var rs=require(_0x26f9('0x4'));var fs=require('fs');var Redis=require(_0x26f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x26f9('0x6'));var logger=require(_0x26f9('0x7'))(_0x26f9('0x8'));var config=require(_0x26f9('0x9'));var jayson=require(_0x26f9('0xa'));var client=jayson[_0x26f9('0xb')][_0x26f9('0xc')]({'port':0x232a});config[_0x26f9('0xd')]=_[_0x26f9('0xe')](config['redis'],{'host':_0x26f9('0xf'),'port':0x18eb});var socket=require(_0x26f9('0x10'))(new Redis(config[_0x26f9('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x650904,_0x3e213d,_0x3dc4db){return new BPromise(function(_0x157570,_0x5bdf67){return client[_0x26f9('0x11')](_0x650904,_0x3dc4db)[_0x26f9('0x12')](function(_0x5395b3){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3e213d,_0x26f9('0x13'));logger[_0x26f9('0x14')](_0x26f9('0x15'),_0x3e213d,_0x26f9('0x13'),JSON['stringify'](_0x5395b3));if(_0x5395b3['error']){if(_0x5395b3[_0x26f9('0x16')][_0x26f9('0x17')]===0x1f4){logger[_0x26f9('0x16')](_0x26f9('0x18'),_0x3e213d,_0x5395b3[_0x26f9('0x16')][_0x26f9('0x19')]);return _0x5bdf67(_0x5395b3[_0x26f9('0x16')]['message']);}logger['error'](_0x26f9('0x18'),_0x3e213d,_0x5395b3[_0x26f9('0x16')][_0x26f9('0x19')]);return _0x157570(_0x5395b3['error'][_0x26f9('0x19')]);}else{logger['info'](_0x26f9('0x18'),_0x3e213d,_0x26f9('0x13'));_0x157570(_0x5395b3[_0x26f9('0x1a')][_0x26f9('0x19')]);}})[_0x26f9('0x1b')](function(_0x459e76){logger[_0x26f9('0x16')](_0x26f9('0x18'),_0x3e213d,_0x459e76);_0x5bdf67(_0x459e76);});});}exports['GetVoiceQueueRtPauses']=function(_0x47bf2e){var _0x495902=this;return new Promise(function(_0x4d4320,_0x570cfa){return db[_0x26f9('0x1c')][_0x26f9('0x1d')]({'raw':_0x47bf2e[_0x26f9('0x1e')]?_0x47bf2e[_0x26f9('0x1e')][_0x26f9('0x1f')]===undefined?!![]:![]:!![],'where':_0x47bf2e[_0x26f9('0x1e')]?_0x47bf2e[_0x26f9('0x1e')][_0x26f9('0x20')]||null:null,'attributes':[[db[_0x26f9('0x21')]['fn'](_0x26f9('0x22'),db['sequelize']['fn']('IF',db[_0x26f9('0x21')][_0x26f9('0x23')](_0x26f9('0x24')))),_0x26f9('0x25')]]})['then'](function(_0x3269d9){logger[_0x26f9('0x26')]('GetVoiceQueueRtPauses',_0x47bf2e);logger[_0x26f9('0x14')](_0x26f9('0x27'),_0x47bf2e,JSON[_0x26f9('0x28')](_0x3269d9));_0x4d4320(_0x3269d9);})['catch'](function(_0x1faf60){logger['error']('GetVoiceQueueRtPauses',_0x1faf60[_0x26f9('0x19')],_0x47bf2e);_0x570cfa(_0x495902[_0x26f9('0x16')](0x1f4,_0x1faf60['message']));});});};