Built motion from commit (unavailable).|2.4.18
[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 _0x8b1d=['jayson/promise','client','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','stringify','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5f1ee6,_0x1ca95a){var _0x123509=function(_0x2823f6){while(--_0x2823f6){_0x5f1ee6['push'](_0x5f1ee6['shift']());}};_0x123509(++_0x1ca95a);}(_0x8b1d,0xe6));var _0xd8b1=function(_0x2bfe50,_0x4a8a57){_0x2bfe50=_0x2bfe50-0x0;var _0x4d12c0=_0x8b1d[_0x2bfe50];return _0x4d12c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8b1('0x0'));var BPromise=require(_0xd8b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8b1('0x2'));var db=require(_0xd8b1('0x3'))['db'];var utils=require(_0xd8b1('0x4'));var logger=require(_0xd8b1('0x5'))(_0xd8b1('0x6'));var config=require(_0xd8b1('0x7'));var jayson=require(_0xd8b1('0x8'));var client=jayson[_0xd8b1('0x9')]['http']({'port':0x232a});config['redis']=_[_0xd8b1('0xa')](config[_0xd8b1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8b1('0xc'))(new Redis(config[_0xd8b1('0xb')]));require(_0xd8b1('0xd'))[_0xd8b1('0xe')](socket);function respondWithRpcPromise(_0x5aa6d8,_0x9f09f8,_0x50a133){return new BPromise(function(_0x4292c6,_0x12f33b){return client['request'](_0x5aa6d8,_0x50a133)[_0xd8b1('0xf')](function(_0x9256ab){logger[_0xd8b1('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x9f09f8,_0xd8b1('0x11'));logger[_0xd8b1('0x12')](_0xd8b1('0x13'),_0x9f09f8,_0xd8b1('0x11'),JSON['stringify'](_0x9256ab));if(_0x9256ab[_0xd8b1('0x14')]){if(_0x9256ab[_0xd8b1('0x14')][_0xd8b1('0x15')]===0x1f4){logger[_0xd8b1('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x9f09f8,_0x9256ab[_0xd8b1('0x14')][_0xd8b1('0x16')]);return _0x12f33b(_0x9256ab[_0xd8b1('0x14')][_0xd8b1('0x16')]);}logger['error'](_0xd8b1('0x17'),_0x9f09f8,_0x9256ab[_0xd8b1('0x14')][_0xd8b1('0x16')]);return _0x4292c6(_0x9256ab['error'][_0xd8b1('0x16')]);}else{logger[_0xd8b1('0x10')](_0xd8b1('0x17'),_0x9f09f8,_0xd8b1('0x11'));_0x4292c6(_0x9256ab[_0xd8b1('0x18')][_0xd8b1('0x16')]);}})['catch'](function(_0x2349d9){logger[_0xd8b1('0x14')](_0xd8b1('0x17'),_0x9f09f8,_0x2349d9);_0x12f33b(_0x2349d9);});});}exports[_0xd8b1('0x19')]=function(_0x7d3737){var _0x108814=this;return new Promise(function(_0x1647b9,_0x4f542b){return db[_0xd8b1('0x1a')][_0xd8b1('0x1b')]({'raw':_0x7d3737[_0xd8b1('0x1c')]?_0x7d3737[_0xd8b1('0x1c')][_0xd8b1('0x1d')]===undefined?!![]:![]:!![],'where':_0x7d3737['options']?_0x7d3737['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xd8b1('0x1e'),db[_0xd8b1('0x1f')]['fn']('IF',db[_0xd8b1('0x1f')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xd8b1('0xf')](function(_0x24a23a){logger[_0xd8b1('0x10')](_0xd8b1('0x19'),_0x7d3737);logger[_0xd8b1('0x12')]('GetVoiceQueueRtPauses',_0x7d3737,JSON[_0xd8b1('0x20')](_0x24a23a));_0x1647b9(_0x24a23a);})[_0xd8b1('0x21')](function(_0x533abb){logger[_0xd8b1('0x14')](_0xd8b1('0x19'),_0x533abb[_0xd8b1('0x16')],_0x7d3737);_0x4f542b(_0x108814[_0xd8b1('0x14')](0x1f4,_0x533abb['message']));});});};