Built motion from commit 47436d59.|2.6.7
[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 _0x04bb=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment'];(function(_0x3559bf,_0x414616){var _0x3b8c7b=function(_0x21c887){while(--_0x21c887){_0x3559bf['push'](_0x3559bf['shift']());}};_0x3b8c7b(++_0x414616);}(_0x04bb,0x83));var _0xb04b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x04bb[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xb04b('0x0'));var moment=require(_0xb04b('0x1'));var BPromise=require(_0xb04b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb04b('0x3'))['db'];var utils=require(_0xb04b('0x4'));var logger=require('../../config/logger')(_0xb04b('0x5'));var config=require(_0xb04b('0x6'));var jayson=require(_0xb04b('0x7'));var client=jayson[_0xb04b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5305dd,_0x49533b,_0x599c40){return new BPromise(function(_0x12648b,_0x5b8c38){return client['request'](_0x5305dd,_0x599c40)[_0xb04b('0x9')](function(_0x372fe3){logger[_0xb04b('0xa')](_0xb04b('0xb'),_0x49533b,_0xb04b('0xc'));logger[_0xb04b('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x49533b,_0xb04b('0xc'),JSON[_0xb04b('0xe')](_0x372fe3));if(_0x372fe3[_0xb04b('0xf')]){if(_0x372fe3[_0xb04b('0xf')][_0xb04b('0x10')]===0x1f4){logger[_0xb04b('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x49533b,_0x372fe3[_0xb04b('0xf')][_0xb04b('0x11')]);return _0x5b8c38(_0x372fe3[_0xb04b('0xf')]['message']);}logger[_0xb04b('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x49533b,_0x372fe3[_0xb04b('0xf')][_0xb04b('0x11')]);return _0x12648b(_0x372fe3['error'][_0xb04b('0x11')]);}else{logger[_0xb04b('0xa')](_0xb04b('0xb'),_0x49533b,'request\x20sent');_0x12648b(_0x372fe3['result'][_0xb04b('0x11')]);}})[_0xb04b('0x12')](function(_0x59802e){logger[_0xb04b('0xf')](_0xb04b('0xb'),_0x49533b,_0x59802e);_0x5b8c38(_0x59802e);});});}