dbff76d9892e0c48d27edc2f4e71b549d8d3d6c5
[motion2.git] / server / api / chatApplication / chatApplication.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 _0x6a02=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x6a02,0x6e));var _0x26a0=function(_0x4a602b,_0x27c754){_0x4a602b=_0x4a602b-0x0;var _0x499b98=_0x6a02[_0x4a602b];return _0x499b98;};'use strict';var _=require(_0x26a0('0x0'));var util=require(_0x26a0('0x1'));var moment=require(_0x26a0('0x2'));var BPromise=require(_0x26a0('0x3'));var rs=require(_0x26a0('0x4'));var fs=require('fs');var Redis=require(_0x26a0('0x5'));var db=require(_0x26a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x26a0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x26a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb194f2,_0xc3f075,_0x568bc4){return new BPromise(function(_0x442d1c,_0x250a34){return client[_0x26a0('0x9')](_0xb194f2,_0x568bc4)[_0x26a0('0xa')](function(_0x522554){logger[_0x26a0('0xb')](_0x26a0('0xc'),_0xc3f075,_0x26a0('0xd'));logger[_0x26a0('0xe')](_0x26a0('0xf'),_0xc3f075,_0x26a0('0xd'),JSON[_0x26a0('0x10')](_0x522554));if(_0x522554[_0x26a0('0x11')]){if(_0x522554[_0x26a0('0x11')][_0x26a0('0x12')]===0x1f4){logger['error'](_0x26a0('0xc'),_0xc3f075,_0x522554[_0x26a0('0x11')][_0x26a0('0x13')]);return _0x250a34(_0x522554[_0x26a0('0x11')][_0x26a0('0x13')]);}logger[_0x26a0('0x11')]('ChatApplication,\x20%s,\x20%s',_0xc3f075,_0x522554['error'][_0x26a0('0x13')]);return _0x442d1c(_0x522554['error']['message']);}else{logger[_0x26a0('0xb')](_0x26a0('0xc'),_0xc3f075,_0x26a0('0xd'));_0x442d1c(_0x522554[_0x26a0('0x14')][_0x26a0('0x13')]);}})[_0x26a0('0x15')](function(_0x5fa976){logger[_0x26a0('0x11')](_0x26a0('0xc'),_0xc3f075,_0x5fa976);_0x250a34(_0x5fa976);});});}