Built motion from commit 9d1906d1.|2.5.40
[motion2.git] / server / api / userChatQueue / userChatQueue.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 _0xb1c0=['client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b52d4,_0x1d3600){var _0x34cce1=function(_0x34363f){while(--_0x34363f){_0x5b52d4['push'](_0x5b52d4['shift']());}};_0x34cce1(++_0x1d3600);}(_0xb1c0,0xbd));var _0x0b1c=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xb1c0[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x0b1c('0x0'));var util=require(_0x0b1c('0x1'));var moment=require(_0x0b1c('0x2'));var BPromise=require(_0x0b1c('0x3'));var rs=require(_0x0b1c('0x4'));var fs=require('fs');var Redis=require(_0x0b1c('0x5'));var db=require(_0x0b1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b1c('0x7'))(_0x0b1c('0x8'));var config=require(_0x0b1c('0x9'));var jayson=require(_0x0b1c('0xa'));var client=jayson[_0x0b1c('0xb')][_0x0b1c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f6dab,_0x1d079f,_0x311b5d){return new BPromise(function(_0x34aa2a,_0x28b9e8){return client[_0x0b1c('0xd')](_0x1f6dab,_0x311b5d)[_0x0b1c('0xe')](function(_0x4035d6){logger[_0x0b1c('0xf')](_0x0b1c('0x10'),_0x1d079f,_0x0b1c('0x11'));logger[_0x0b1c('0x12')](_0x0b1c('0x13'),_0x1d079f,_0x0b1c('0x11'),JSON[_0x0b1c('0x14')](_0x4035d6));if(_0x4035d6[_0x0b1c('0x15')]){if(_0x4035d6[_0x0b1c('0x15')][_0x0b1c('0x16')]===0x1f4){logger[_0x0b1c('0x15')](_0x0b1c('0x10'),_0x1d079f,_0x4035d6[_0x0b1c('0x15')][_0x0b1c('0x17')]);return _0x28b9e8(_0x4035d6['error']['message']);}logger[_0x0b1c('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x1d079f,_0x4035d6[_0x0b1c('0x15')][_0x0b1c('0x17')]);return _0x34aa2a(_0x4035d6[_0x0b1c('0x15')]['message']);}else{logger['info'](_0x0b1c('0x10'),_0x1d079f,_0x0b1c('0x11'));_0x34aa2a(_0x4035d6['result'][_0x0b1c('0x17')]);}})[_0x0b1c('0x18')](function(_0x267f46){logger[_0x0b1c('0x15')](_0x0b1c('0x10'),_0x1d079f,_0x267f46);_0x28b9e8(_0x267f46);});});}