bc4e07a70696114eeda433dacf33aa5bc89a7110
[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 _0x85b2=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x45d174,_0x47c6bb){var _0x3a0128=function(_0xdd4c62){while(--_0xdd4c62){_0x45d174['push'](_0x45d174['shift']());}};_0x3a0128(++_0x47c6bb);}(_0x85b2,0x11f));var _0x285b=function(_0x71988b,_0x253aa1){_0x71988b=_0x71988b-0x0;var _0x192602=_0x85b2[_0x71988b];return _0x192602;};'use strict';var _=require(_0x285b('0x0'));var util=require(_0x285b('0x1'));var moment=require(_0x285b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x285b('0x3'))['db'];var utils=require(_0x285b('0x4'));var logger=require('../../config/logger')(_0x285b('0x5'));var config=require(_0x285b('0x6'));var jayson=require(_0x285b('0x7'));var client=jayson[_0x285b('0x8')][_0x285b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x164392,_0x485db7,_0x4bc965){return new BPromise(function(_0x192a68,_0x2091ef){return client[_0x285b('0xa')](_0x164392,_0x4bc965)['then'](function(_0x3c81ec){logger[_0x285b('0xb')](_0x285b('0xc'),_0x485db7,_0x285b('0xd'));logger[_0x285b('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x485db7,_0x285b('0xd'),JSON[_0x285b('0xf')](_0x3c81ec));if(_0x3c81ec[_0x285b('0x10')]){if(_0x3c81ec[_0x285b('0x10')][_0x285b('0x11')]===0x1f4){logger[_0x285b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x485db7,_0x3c81ec[_0x285b('0x10')]['message']);return _0x2091ef(_0x3c81ec[_0x285b('0x10')][_0x285b('0x12')]);}logger['error'](_0x285b('0xc'),_0x485db7,_0x3c81ec[_0x285b('0x10')][_0x285b('0x12')]);return _0x192a68(_0x3c81ec[_0x285b('0x10')][_0x285b('0x12')]);}else{logger[_0x285b('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x485db7,_0x285b('0xd'));_0x192a68(_0x3c81ec['result'][_0x285b('0x12')]);}})[_0x285b('0x13')](function(_0x4fd4a7){logger[_0x285b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x485db7,_0x4fd4a7);_0x2091ef(_0x4fd4a7);});});}