Built motion from commit 746c7d2a.|2.5.35
[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 _0xcc3f=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x6d56e9,_0x2589e8){var _0x1bd9ae=function(_0x162f18){while(--_0x162f18){_0x6d56e9['push'](_0x6d56e9['shift']());}};_0x1bd9ae(++_0x2589e8);}(_0xcc3f,0x16b));var _0xfcc3=function(_0x4c9763,_0x2ff3fe){_0x4c9763=_0x4c9763-0x0;var _0x4f2df8=_0xcc3f[_0x4c9763];return _0x4f2df8;};'use strict';var _=require('lodash');var util=require(_0xfcc3('0x0'));var moment=require('moment');var BPromise=require(_0xfcc3('0x1'));var rs=require(_0xfcc3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcc3('0x3'))['db'];var utils=require(_0xfcc3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfcc3('0x5'));var jayson=require(_0xfcc3('0x6'));var client=jayson[_0xfcc3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38be46,_0x3af7ca,_0xf3235a){return new BPromise(function(_0x30576a,_0x25ab4b){return client[_0xfcc3('0x8')](_0x38be46,_0xf3235a)['then'](function(_0x2c1b82){logger[_0xfcc3('0x9')](_0xfcc3('0xa'),_0x3af7ca,_0xfcc3('0xb'));logger[_0xfcc3('0xc')](_0xfcc3('0xd'),_0x3af7ca,'request\x20sent',JSON[_0xfcc3('0xe')](_0x2c1b82));if(_0x2c1b82[_0xfcc3('0xf')]){if(_0x2c1b82[_0xfcc3('0xf')]['code']===0x1f4){logger[_0xfcc3('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3af7ca,_0x2c1b82[_0xfcc3('0xf')][_0xfcc3('0x10')]);return _0x25ab4b(_0x2c1b82[_0xfcc3('0xf')][_0xfcc3('0x10')]);}logger[_0xfcc3('0xf')](_0xfcc3('0xa'),_0x3af7ca,_0x2c1b82[_0xfcc3('0xf')][_0xfcc3('0x10')]);return _0x30576a(_0x2c1b82['error'][_0xfcc3('0x10')]);}else{logger[_0xfcc3('0x9')](_0xfcc3('0xa'),_0x3af7ca,'request\x20sent');_0x30576a(_0x2c1b82[_0xfcc3('0x11')][_0xfcc3('0x10')]);}})[_0xfcc3('0x12')](function(_0x4977c1){logger['error'](_0xfcc3('0xa'),_0x3af7ca,_0x4977c1);_0x25ab4b(_0x4977c1);});});}