Built motion from commit f8768ebe.|2.6.15
[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 _0x9332=['../../config/environment','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x3bb8db,_0x2749d1){var _0x2596d2=function(_0x42f21e){while(--_0x42f21e){_0x3bb8db['push'](_0x3bb8db['shift']());}};_0x2596d2(++_0x2749d1);}(_0x9332,0x161));var _0x2933=function(_0x328972,_0x15c834){_0x328972=_0x328972-0x0;var _0x67a1cf=_0x9332[_0x328972];return _0x67a1cf;};'use strict';var _=require(_0x2933('0x0'));var util=require(_0x2933('0x1'));var moment=require(_0x2933('0x2'));var BPromise=require(_0x2933('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2933('0x4'));var logger=require(_0x2933('0x5'))(_0x2933('0x6'));var config=require(_0x2933('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2933('0x8')][_0x2933('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x370794,_0x516e98,_0x2234b8){return new BPromise(function(_0x2922a2,_0x117f0e){return client[_0x2933('0xa')](_0x370794,_0x2234b8)[_0x2933('0xb')](function(_0x495f88){logger['info'](_0x2933('0xc'),_0x516e98,_0x2933('0xd'));logger[_0x2933('0xe')](_0x2933('0xf'),_0x516e98,_0x2933('0xd'),JSON[_0x2933('0x10')](_0x495f88));if(_0x495f88['error']){if(_0x495f88[_0x2933('0x11')]['code']===0x1f4){logger[_0x2933('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x516e98,_0x495f88['error'][_0x2933('0x12')]);return _0x117f0e(_0x495f88[_0x2933('0x11')][_0x2933('0x12')]);}logger[_0x2933('0x11')](_0x2933('0xc'),_0x516e98,_0x495f88[_0x2933('0x11')][_0x2933('0x12')]);return _0x2922a2(_0x495f88[_0x2933('0x11')][_0x2933('0x12')]);}else{logger[_0x2933('0x13')](_0x2933('0xc'),_0x516e98,_0x2933('0xd'));_0x2922a2(_0x495f88['result'][_0x2933('0x12')]);}})['catch'](function(_0x3b14b8){logger[_0x2933('0x11')](_0x2933('0xc'),_0x516e98,_0x3b14b8);_0x117f0e(_0x3b14b8);});});}