Built motion from commit 616d3211.|2.6.4
[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 _0x0831=['error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c2d8f,_0x4f7bf3){var _0x13903f=function(_0x3c3761){while(--_0x3c3761){_0x2c2d8f['push'](_0x2c2d8f['shift']());}};_0x13903f(++_0x4f7bf3);}(_0x0831,0x109));var _0x1083=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x0831[_0x285c85];return _0x2f81cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1083('0x0'));var BPromise=require(_0x1083('0x1'));var rs=require(_0x1083('0x2'));var fs=require('fs');var Redis=require(_0x1083('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1083('0x4'));var logger=require(_0x1083('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1083('0x6'));var client=jayson[_0x1083('0x7')][_0x1083('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x617216,_0x11c1ce,_0x3fb8ac){return new BPromise(function(_0x97f260,_0x20fdfe){return client['request'](_0x617216,_0x3fb8ac)[_0x1083('0x9')](function(_0x2533fa){logger['info'](_0x1083('0xa'),_0x11c1ce,_0x1083('0xb'));logger[_0x1083('0xc')](_0x1083('0xd'),_0x11c1ce,_0x1083('0xb'),JSON[_0x1083('0xe')](_0x2533fa));if(_0x2533fa[_0x1083('0xf')]){if(_0x2533fa[_0x1083('0xf')][_0x1083('0x10')]===0x1f4){logger[_0x1083('0xf')](_0x1083('0xa'),_0x11c1ce,_0x2533fa[_0x1083('0xf')][_0x1083('0x11')]);return _0x20fdfe(_0x2533fa[_0x1083('0xf')]['message']);}logger[_0x1083('0xf')](_0x1083('0xa'),_0x11c1ce,_0x2533fa[_0x1083('0xf')][_0x1083('0x11')]);return _0x97f260(_0x2533fa[_0x1083('0xf')][_0x1083('0x11')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x11c1ce,_0x1083('0xb'));_0x97f260(_0x2533fa[_0x1083('0x12')]['message']);}})[_0x1083('0x13')](function(_0x28ce2e){logger[_0x1083('0xf')](_0x1083('0xa'),_0x11c1ce,_0x28ce2e);_0x20fdfe(_0x28ce2e);});});}