Built motion from commit 775e2a94.|2.6.3
[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 _0x64b6=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5dc14f,_0x250178){var _0x4ce01d=function(_0x1b9470){while(--_0x1b9470){_0x5dc14f['push'](_0x5dc14f['shift']());}};_0x4ce01d(++_0x250178);}(_0x64b6,0x11a));var _0x664b=function(_0x45943c,_0x292e90){_0x45943c=_0x45943c-0x0;var _0xe1cf98=_0x64b6[_0x45943c];return _0xe1cf98;};'use strict';var _=require(_0x664b('0x0'));var util=require('util');var moment=require(_0x664b('0x1'));var BPromise=require('bluebird');var rs=require(_0x664b('0x2'));var fs=require('fs');var Redis=require(_0x664b('0x3'));var db=require(_0x664b('0x4'))['db'];var utils=require(_0x664b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x664b('0x6'));var jayson=require(_0x664b('0x7'));var client=jayson[_0x664b('0x8')][_0x664b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x430c31,_0x107440,_0x5fbbd){return new BPromise(function(_0x23285c,_0x1503c1){return client['request'](_0x430c31,_0x5fbbd)['then'](function(_0xe3073d){logger['info'](_0x664b('0xa'),_0x107440,_0x664b('0xb'));logger['debug'](_0x664b('0xc'),_0x107440,_0x664b('0xb'),JSON[_0x664b('0xd')](_0xe3073d));if(_0xe3073d[_0x664b('0xe')]){if(_0xe3073d['error'][_0x664b('0xf')]===0x1f4){logger[_0x664b('0xe')](_0x664b('0xa'),_0x107440,_0xe3073d['error'][_0x664b('0x10')]);return _0x1503c1(_0xe3073d[_0x664b('0xe')][_0x664b('0x10')]);}logger['error'](_0x664b('0xa'),_0x107440,_0xe3073d[_0x664b('0xe')][_0x664b('0x10')]);return _0x23285c(_0xe3073d['error']['message']);}else{logger[_0x664b('0x11')](_0x664b('0xa'),_0x107440,_0x664b('0xb'));_0x23285c(_0xe3073d[_0x664b('0x12')]['message']);}})[_0x664b('0x13')](function(_0x51d871){logger[_0x664b('0xe')]('ChatApplication,\x20%s,\x20%s',_0x107440,_0x51d871);_0x1503c1(_0x51d871);});});}