Built motion from commit (unavailable).|2.5.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 _0xab7e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','outboundQueuePauses','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xab7e,0xb8));var _0xeab7=function(_0x55a6ef,_0x3c992b){_0x55a6ef=_0x55a6ef-0x0;var _0x3cb2df=_0xab7e[_0x55a6ef];return _0x3cb2df;};'use strict';var _=require(_0xeab7('0x0'));var util=require('util');var moment=require(_0xeab7('0x1'));var BPromise=require(_0xeab7('0x2'));var rs=require(_0xeab7('0x3'));var fs=require('fs');var Redis=require(_0xeab7('0x4'));var db=require(_0xeab7('0x5'))['db'];var utils=require(_0xeab7('0x6'));var logger=require(_0xeab7('0x7'))(_0xeab7('0x8'));var config=require(_0xeab7('0x9'));var jayson=require(_0xeab7('0xa'));var client=jayson[_0xeab7('0xb')][_0xeab7('0xc')]({'port':0x232a});config[_0xeab7('0xd')]=_[_0xeab7('0xe')](config[_0xeab7('0xd')],{'host':_0xeab7('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeab7('0xd')]));require('./userVoiceQueueRt.socket')[_0xeab7('0x10')](socket);function respondWithRpcPromise(_0x4a74ea,_0x2e76c2,_0x38786b){return new BPromise(function(_0xd07a28,_0x57ee9c){return client[_0xeab7('0x11')](_0x4a74ea,_0x38786b)['then'](function(_0x20a7fd){logger[_0xeab7('0x12')](_0xeab7('0x13'),_0x2e76c2,'request\x20sent');logger[_0xeab7('0x14')](_0xeab7('0x15'),_0x2e76c2,'request\x20sent',JSON[_0xeab7('0x16')](_0x20a7fd));if(_0x20a7fd[_0xeab7('0x17')]){if(_0x20a7fd[_0xeab7('0x17')]['code']===0x1f4){logger[_0xeab7('0x17')](_0xeab7('0x13'),_0x2e76c2,_0x20a7fd[_0xeab7('0x17')][_0xeab7('0x18')]);return _0x57ee9c(_0x20a7fd[_0xeab7('0x17')][_0xeab7('0x18')]);}logger[_0xeab7('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e76c2,_0x20a7fd[_0xeab7('0x17')][_0xeab7('0x18')]);return _0xd07a28(_0x20a7fd[_0xeab7('0x17')]['message']);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e76c2,_0xeab7('0x19'));_0xd07a28(_0x20a7fd[_0xeab7('0x1a')][_0xeab7('0x18')]);}})[_0xeab7('0x1b')](function(_0x37ac67){logger['error'](_0xeab7('0x13'),_0x2e76c2,_0x37ac67);_0x57ee9c(_0x37ac67);});});}exports[_0xeab7('0x1c')]=function(_0x216278){var _0x456d71=this;return new Promise(function(_0x42fd3c,_0x19ed39){return db[_0xeab7('0x1d')][_0xeab7('0x1e')]({'raw':_0x216278[_0xeab7('0x1f')]?_0x216278[_0xeab7('0x1f')][_0xeab7('0x20')]===undefined?!![]:![]:!![],'where':_0x216278[_0xeab7('0x1f')]?_0x216278[_0xeab7('0x1f')]['where']||null:null,'attributes':[[db[_0xeab7('0x21')]['fn'](_0xeab7('0x22'),db[_0xeab7('0x21')]['fn']('IF',db[_0xeab7('0x21')][_0xeab7('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xeab7('0x24')]]})[_0xeab7('0x25')](function(_0x3e504b){logger[_0xeab7('0x12')]('GetVoiceQueueRtPauses',_0x216278);logger[_0xeab7('0x14')](_0xeab7('0x1c'),_0x216278,JSON[_0xeab7('0x16')](_0x3e504b));_0x42fd3c(_0x3e504b);})[_0xeab7('0x1b')](function(_0x1ce56a){logger[_0xeab7('0x17')]('GetVoiceQueueRtPauses',_0x1ce56a[_0xeab7('0x18')],_0x216278);_0x19ed39(_0x456d71[_0xeab7('0x17')](0x1f4,_0x1ce56a[_0xeab7('0x18')]));});});};