Built motion from commit (unavailable).|2.5.26
[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 _0xbd5d=['error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','then','GetVoiceQueueRtPauses','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23c5cb,_0xfbaea6){var _0x48d3f1=function(_0x13576d){while(--_0x13576d){_0x23c5cb['push'](_0x23c5cb['shift']());}};_0x48d3f1(++_0xfbaea6);}(_0xbd5d,0x1d7));var _0xdbd5=function(_0x13e132,_0x165c6d){_0x13e132=_0x13e132-0x0;var _0x1e295d=_0xbd5d[_0x13e132];return _0x1e295d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdbd5('0x0'));var BPromise=require(_0xdbd5('0x1'));var rs=require(_0xdbd5('0x2'));var fs=require('fs');var Redis=require(_0xdbd5('0x3'));var db=require(_0xdbd5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdbd5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdbd5('0x6')]['http']({'port':0x232a});config[_0xdbd5('0x7')]=_[_0xdbd5('0x8')](config['redis'],{'host':_0xdbd5('0x9'),'port':0x18eb});var socket=require(_0xdbd5('0xa'))(new Redis(config[_0xdbd5('0x7')]));require(_0xdbd5('0xb'))['register'](socket);function respondWithRpcPromise(_0x3c9fe7,_0x2252b9,_0x3f068d){return new BPromise(function(_0x59befb,_0x21f02d){return client[_0xdbd5('0xc')](_0x3c9fe7,_0x3f068d)['then'](function(_0x2ea470){logger[_0xdbd5('0xd')](_0xdbd5('0xe'),_0x2252b9,_0xdbd5('0xf'));logger[_0xdbd5('0x10')](_0xdbd5('0x11'),_0x2252b9,_0xdbd5('0xf'),JSON[_0xdbd5('0x12')](_0x2ea470));if(_0x2ea470[_0xdbd5('0x13')]){if(_0x2ea470[_0xdbd5('0x13')][_0xdbd5('0x14')]===0x1f4){logger[_0xdbd5('0x13')](_0xdbd5('0xe'),_0x2252b9,_0x2ea470[_0xdbd5('0x13')][_0xdbd5('0x15')]);return _0x21f02d(_0x2ea470[_0xdbd5('0x13')][_0xdbd5('0x15')]);}logger['error'](_0xdbd5('0xe'),_0x2252b9,_0x2ea470[_0xdbd5('0x13')][_0xdbd5('0x15')]);return _0x59befb(_0x2ea470['error'][_0xdbd5('0x15')]);}else{logger[_0xdbd5('0xd')](_0xdbd5('0xe'),_0x2252b9,_0xdbd5('0xf'));_0x59befb(_0x2ea470[_0xdbd5('0x16')][_0xdbd5('0x15')]);}})[_0xdbd5('0x17')](function(_0x4c8193){logger[_0xdbd5('0x13')](_0xdbd5('0xe'),_0x2252b9,_0x4c8193);_0x21f02d(_0x4c8193);});});}exports['GetVoiceQueueRtPauses']=function(_0x62fd90){var _0x5d980b=this;return new Promise(function(_0x472bf6,_0x134b5b){return db[_0xdbd5('0x18')][_0xdbd5('0x19')]({'raw':_0x62fd90[_0xdbd5('0x1a')]?_0x62fd90[_0xdbd5('0x1a')][_0xdbd5('0x1b')]===undefined?!![]:![]:!![],'where':_0x62fd90['options']?_0x62fd90[_0xdbd5('0x1a')][_0xdbd5('0x1c')]||null:null,'attributes':[[db[_0xdbd5('0x1d')]['fn'](_0xdbd5('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xdbd5('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0xdbd5('0x20')]]})[_0xdbd5('0x21')](function(_0x5d8def){logger[_0xdbd5('0xd')](_0xdbd5('0x22'),_0x62fd90);logger[_0xdbd5('0x10')](_0xdbd5('0x22'),_0x62fd90,JSON[_0xdbd5('0x12')](_0x5d8def));_0x472bf6(_0x5d8def);})[_0xdbd5('0x17')](function(_0x3f08a2){logger[_0xdbd5('0x13')](_0xdbd5('0x22'),_0x3f08a2[_0xdbd5('0x15')],_0x62fd90);_0x134b5b(_0x5d980b[_0xdbd5('0x13')](0x1f4,_0x3f08a2[_0xdbd5('0x15')]));});});};