Built motion from commit (unavailable).|2.5.31
[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 _0x8e3f=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','outboundQueuePauses','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1a0c87,_0x348d55){var _0x3c4042=function(_0x393660){while(--_0x393660){_0x1a0c87['push'](_0x1a0c87['shift']());}};_0x3c4042(++_0x348d55);}(_0x8e3f,0x13d));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf8e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf8e3('0x1'));var rs=require(_0xf8e3('0x2'));var fs=require('fs');var Redis=require(_0xf8e3('0x3'));var db=require(_0xf8e3('0x4'))['db'];var utils=require(_0xf8e3('0x5'));var logger=require('../../config/logger')(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf8e3('0x8')]['http']({'port':0x232a});config[_0xf8e3('0x9')]=_[_0xf8e3('0xa')](config[_0xf8e3('0x9')],{'host':_0xf8e3('0xb'),'port':0x18eb});var socket=require(_0xf8e3('0xc'))(new Redis(config[_0xf8e3('0x9')]));require(_0xf8e3('0xd'))[_0xf8e3('0xe')](socket);function respondWithRpcPromise(_0x135132,_0x147142,_0x357e89){return new BPromise(function(_0xeca05a,_0x4da462){return client[_0xf8e3('0xf')](_0x135132,_0x357e89)[_0xf8e3('0x10')](function(_0x4e49c1){logger['info'](_0xf8e3('0x11'),_0x147142,_0xf8e3('0x12'));logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x147142,_0xf8e3('0x12'),JSON[_0xf8e3('0x15')](_0x4e49c1));if(_0x4e49c1[_0xf8e3('0x16')]){if(_0x4e49c1[_0xf8e3('0x16')]['code']===0x1f4){logger[_0xf8e3('0x16')](_0xf8e3('0x11'),_0x147142,_0x4e49c1['error'][_0xf8e3('0x17')]);return _0x4da462(_0x4e49c1[_0xf8e3('0x16')][_0xf8e3('0x17')]);}logger[_0xf8e3('0x16')](_0xf8e3('0x11'),_0x147142,_0x4e49c1[_0xf8e3('0x16')]['message']);return _0xeca05a(_0x4e49c1[_0xf8e3('0x16')][_0xf8e3('0x17')]);}else{logger[_0xf8e3('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x147142,'request\x20sent');_0xeca05a(_0x4e49c1['result'][_0xf8e3('0x17')]);}})[_0xf8e3('0x19')](function(_0x10ec9b){logger['error'](_0xf8e3('0x11'),_0x147142,_0x10ec9b);_0x4da462(_0x10ec9b);});});}exports[_0xf8e3('0x1a')]=function(_0x3ed15f){var _0x4cf7d2=this;return new Promise(function(_0xaec880,_0x7802c2){return db[_0xf8e3('0x1b')][_0xf8e3('0x1c')]({'raw':_0x3ed15f[_0xf8e3('0x1d')]?_0x3ed15f['options'][_0xf8e3('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ed15f['options']?_0x3ed15f[_0xf8e3('0x1d')][_0xf8e3('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf8e3('0x20'),db[_0xf8e3('0x21')]['fn']('IF',db[_0xf8e3('0x21')][_0xf8e3('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0xf8e3('0x23')]]})[_0xf8e3('0x10')](function(_0x191895){logger[_0xf8e3('0x18')]('GetVoiceQueueRtPauses',_0x3ed15f);logger[_0xf8e3('0x13')](_0xf8e3('0x1a'),_0x3ed15f,JSON['stringify'](_0x191895));_0xaec880(_0x191895);})[_0xf8e3('0x19')](function(_0x1f2eb7){logger[_0xf8e3('0x16')]('GetVoiceQueueRtPauses',_0x1f2eb7[_0xf8e3('0x17')],_0x3ed15f);_0x7802c2(_0x4cf7d2[_0xf8e3('0x16')](0x1f4,_0x1f2eb7[_0xf8e3('0x17')]));});});};