Built motion from commit (unavailable).|2.4.4
[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 _0x415a=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x433226,_0x250764){var _0x58172f=function(_0x5d8f46){while(--_0x5d8f46){_0x433226['push'](_0x433226['shift']());}};_0x58172f(++_0x250764);}(_0x415a,0x1df));var _0xa415=function(_0x438005,_0xb80c41){_0x438005=_0x438005-0x0;var _0x1587e0=_0x415a[_0x438005];return _0x1587e0;};'use strict';var _=require('lodash');var util=require(_0xa415('0x0'));var moment=require(_0xa415('0x1'));var BPromise=require(_0xa415('0x2'));var rs=require(_0xa415('0x3'));var fs=require('fs');var Redis=require(_0xa415('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa415('0x5'))(_0xa415('0x6'));var config=require(_0xa415('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa415('0x8')][_0xa415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2420cc,_0x4c1ea0,_0x115405){return new BPromise(function(_0x9983c8,_0x58c3fc){return client['request'](_0x2420cc,_0x115405)[_0xa415('0xa')](function(_0xb51f2){logger[_0xa415('0xb')](_0xa415('0xc'),_0x4c1ea0,_0xa415('0xd'));logger['debug'](_0xa415('0xe'),_0x4c1ea0,_0xa415('0xd'),JSON[_0xa415('0xf')](_0xb51f2));if(_0xb51f2[_0xa415('0x10')]){if(_0xb51f2['error'][_0xa415('0x11')]===0x1f4){logger['error'](_0xa415('0xc'),_0x4c1ea0,_0xb51f2['error']['message']);return _0x58c3fc(_0xb51f2[_0xa415('0x10')][_0xa415('0x12')]);}logger[_0xa415('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x4c1ea0,_0xb51f2['error'][_0xa415('0x12')]);return _0x9983c8(_0xb51f2['error'][_0xa415('0x12')]);}else{logger[_0xa415('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x4c1ea0,_0xa415('0xd'));_0x9983c8(_0xb51f2['result']['message']);}})[_0xa415('0x13')](function(_0x22c054){logger[_0xa415('0x10')](_0xa415('0xc'),_0x4c1ea0,_0x22c054);_0x58c3fc(_0x22c054);});});}