Built motion from commit 9d0783e6.|2.6.13
[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 _0x09ce=['bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x425b60,_0x1bd5e5){var _0x7739bb=function(_0x32124e){while(--_0x32124e){_0x425b60['push'](_0x425b60['shift']());}};_0x7739bb(++_0x1bd5e5);}(_0x09ce,0x1e1));var _0xe09c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x09ce[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe09c('0x0'));var util=require(_0xe09c('0x1'));var moment=require('moment');var BPromise=require(_0xe09c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe09c('0x3'));var db=require(_0xe09c('0x4'))['db'];var utils=require(_0xe09c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe09c('0x6'));var client=jayson[_0xe09c('0x7')][_0xe09c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2746b8,_0x800aa0,_0x36560f){return new BPromise(function(_0x2393b2,_0x5578c2){return client[_0xe09c('0x9')](_0x2746b8,_0x36560f)[_0xe09c('0xa')](function(_0x480c78){logger[_0xe09c('0xb')](_0xe09c('0xc'),_0x800aa0,_0xe09c('0xd'));logger[_0xe09c('0xe')](_0xe09c('0xf'),_0x800aa0,_0xe09c('0xd'),JSON[_0xe09c('0x10')](_0x480c78));if(_0x480c78[_0xe09c('0x11')]){if(_0x480c78[_0xe09c('0x11')][_0xe09c('0x12')]===0x1f4){logger[_0xe09c('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x800aa0,_0x480c78[_0xe09c('0x11')][_0xe09c('0x13')]);return _0x5578c2(_0x480c78[_0xe09c('0x11')][_0xe09c('0x13')]);}logger[_0xe09c('0x11')](_0xe09c('0xc'),_0x800aa0,_0x480c78[_0xe09c('0x11')]['message']);return _0x2393b2(_0x480c78['error'][_0xe09c('0x13')]);}else{logger[_0xe09c('0xb')](_0xe09c('0xc'),_0x800aa0,'request\x20sent');_0x2393b2(_0x480c78[_0xe09c('0x14')][_0xe09c('0x13')]);}})['catch'](function(_0x41bfda){logger[_0xe09c('0x11')](_0xe09c('0xc'),_0x800aa0,_0x41bfda);_0x5578c2(_0x41bfda);});});}