Built motion from commit 19a84241.|2.5.34
[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 _0x27a1=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x545dd3,_0x2a4af4){var _0x2ba373=function(_0x4efc23){while(--_0x4efc23){_0x545dd3['push'](_0x545dd3['shift']());}};_0x2ba373(++_0x2a4af4);}(_0x27a1,0x160));var _0x127a=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x27a1[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x127a('0x0'));var util=require(_0x127a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x127a('0x2'));var fs=require('fs');var Redis=require(_0x127a('0x3'));var db=require(_0x127a('0x4'))['db'];var utils=require(_0x127a('0x5'));var logger=require(_0x127a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x127a('0x7'));var client=jayson[_0x127a('0x8')][_0x127a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42dc93,_0x19154d,_0x2bc0e9){return new BPromise(function(_0x49e7b1,_0x3e48d0){return client[_0x127a('0xa')](_0x42dc93,_0x2bc0e9)[_0x127a('0xb')](function(_0x3da087){logger[_0x127a('0xc')](_0x127a('0xd'),_0x19154d,_0x127a('0xe'));logger[_0x127a('0xf')](_0x127a('0x10'),_0x19154d,_0x127a('0xe'),JSON[_0x127a('0x11')](_0x3da087));if(_0x3da087[_0x127a('0x12')]){if(_0x3da087[_0x127a('0x12')][_0x127a('0x13')]===0x1f4){logger[_0x127a('0x12')](_0x127a('0xd'),_0x19154d,_0x3da087[_0x127a('0x12')]['message']);return _0x3e48d0(_0x3da087[_0x127a('0x12')][_0x127a('0x14')]);}logger[_0x127a('0x12')]('ChatApplication,\x20%s,\x20%s',_0x19154d,_0x3da087['error'][_0x127a('0x14')]);return _0x49e7b1(_0x3da087[_0x127a('0x12')][_0x127a('0x14')]);}else{logger['info'](_0x127a('0xd'),_0x19154d,_0x127a('0xe'));_0x49e7b1(_0x3da087[_0x127a('0x15')]['message']);}})[_0x127a('0x16')](function(_0x49653c){logger['error']('ChatApplication,\x20%s,\x20%s',_0x19154d,_0x49653c);_0x3e48d0(_0x49653c);});});}