Built motion from commit 10af8726.|2.6.34
[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 _0x1371=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5adf87,_0x3467fa){var _0xfac128=function(_0x38832a){while(--_0x38832a){_0x5adf87['push'](_0x5adf87['shift']());}};_0xfac128(++_0x3467fa);}(_0x1371,0xe9));var _0x1137=function(_0x25228c,_0xe17849){_0x25228c=_0x25228c-0x0;var _0x59de40=_0x1371[_0x25228c];return _0x59de40;};'use strict';var _=require(_0x1137('0x0'));var util=require(_0x1137('0x1'));var moment=require(_0x1137('0x2'));var BPromise=require('bluebird');var rs=require(_0x1137('0x3'));var fs=require('fs');var Redis=require(_0x1137('0x4'));var db=require(_0x1137('0x5'))['db'];var utils=require(_0x1137('0x6'));var logger=require(_0x1137('0x7'))(_0x1137('0x8'));var config=require(_0x1137('0x9'));var jayson=require(_0x1137('0xa'));var client=jayson[_0x1137('0xb')][_0x1137('0xc')]({'port':0x232a});config[_0x1137('0xd')]=_['defaults'](config['redis'],{'host':_0x1137('0xe'),'port':0x18eb});var socket=require(_0x1137('0xf'))(new Redis(config[_0x1137('0xd')]));require('./userVoiceQueueRt.socket')[_0x1137('0x10')](socket);function respondWithRpcPromise(_0x230fd7,_0x489d1b,_0x4c4b58){return new BPromise(function(_0x14aa09,_0x1bdd23){return client[_0x1137('0x11')](_0x230fd7,_0x4c4b58)[_0x1137('0x12')](function(_0x15b983){logger[_0x1137('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x489d1b,'request\x20sent');logger[_0x1137('0x14')](_0x1137('0x15'),_0x489d1b,_0x1137('0x16'),JSON[_0x1137('0x17')](_0x15b983));if(_0x15b983[_0x1137('0x18')]){if(_0x15b983[_0x1137('0x18')][_0x1137('0x19')]===0x1f4){logger[_0x1137('0x18')](_0x1137('0x1a'),_0x489d1b,_0x15b983[_0x1137('0x18')][_0x1137('0x1b')]);return _0x1bdd23(_0x15b983[_0x1137('0x18')][_0x1137('0x1b')]);}logger[_0x1137('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x489d1b,_0x15b983[_0x1137('0x18')][_0x1137('0x1b')]);return _0x14aa09(_0x15b983[_0x1137('0x18')]['message']);}else{logger[_0x1137('0x13')](_0x1137('0x1a'),_0x489d1b,_0x1137('0x16'));_0x14aa09(_0x15b983[_0x1137('0x1c')][_0x1137('0x1b')]);}})[_0x1137('0x1d')](function(_0x5b8727){logger['error'](_0x1137('0x1a'),_0x489d1b,_0x5b8727);_0x1bdd23(_0x5b8727);});});}exports[_0x1137('0x1e')]=function(_0x1f6c42){var _0x25fbbe=this;return new Promise(function(_0x4967b1,_0x583f38){return db[_0x1137('0x1f')][_0x1137('0x20')]({'raw':_0x1f6c42[_0x1137('0x21')]?_0x1f6c42[_0x1137('0x21')][_0x1137('0x22')]===undefined?!![]:![]:!![],'where':_0x1f6c42[_0x1137('0x21')]?_0x1f6c42[_0x1137('0x21')][_0x1137('0x23')]||null:null,'attributes':[[db[_0x1137('0x24')]['fn'](_0x1137('0x25'),db[_0x1137('0x24')]['fn']('IF',db[_0x1137('0x24')][_0x1137('0x26')](_0x1137('0x27')))),'outboundQueuePauses']]})[_0x1137('0x12')](function(_0x40ed1b){logger[_0x1137('0x13')](_0x1137('0x1e'),_0x1f6c42);logger['debug']('GetVoiceQueueRtPauses',_0x1f6c42,JSON['stringify'](_0x40ed1b));_0x4967b1(_0x40ed1b);})[_0x1137('0x1d')](function(_0x117d37){logger[_0x1137('0x18')](_0x1137('0x1e'),_0x117d37[_0x1137('0x1b')],_0x1f6c42);_0x583f38(_0x25fbbe[_0x1137('0x18')](0x1f4,_0x117d37[_0x1137('0x1b')]));});});};