Built motion from commit (unavailable).|2.5.21
[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 _0xac87=['ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xac87,0x137));var _0x7ac8=function(_0x20804a,_0x145e41){_0x20804a=_0x20804a-0x0;var _0x6f9cd0=_0xac87[_0x20804a];return _0x6f9cd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ac8('0x0'));var fs=require('fs');var Redis=require(_0x7ac8('0x1'));var db=require(_0x7ac8('0x2'))['db'];var utils=require(_0x7ac8('0x3'));var logger=require(_0x7ac8('0x4'))(_0x7ac8('0x5'));var config=require(_0x7ac8('0x6'));var jayson=require(_0x7ac8('0x7'));var client=jayson[_0x7ac8('0x8')][_0x7ac8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526feb,_0x55b2c7,_0xcaa61a){return new BPromise(function(_0x4800e5,_0x45fbe9){return client['request'](_0x526feb,_0xcaa61a)[_0x7ac8('0xa')](function(_0x1dd48e){logger[_0x7ac8('0xb')](_0x7ac8('0xc'),_0x55b2c7,_0x7ac8('0xd'));logger['debug'](_0x7ac8('0xe'),_0x55b2c7,_0x7ac8('0xd'),JSON[_0x7ac8('0xf')](_0x1dd48e));if(_0x1dd48e[_0x7ac8('0x10')]){if(_0x1dd48e[_0x7ac8('0x10')][_0x7ac8('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x55b2c7,_0x1dd48e['error'][_0x7ac8('0x12')]);return _0x45fbe9(_0x1dd48e['error'][_0x7ac8('0x12')]);}logger[_0x7ac8('0x10')](_0x7ac8('0xc'),_0x55b2c7,_0x1dd48e['error']['message']);return _0x4800e5(_0x1dd48e[_0x7ac8('0x10')][_0x7ac8('0x12')]);}else{logger[_0x7ac8('0xb')](_0x7ac8('0xc'),_0x55b2c7,_0x7ac8('0xd'));_0x4800e5(_0x1dd48e['result'][_0x7ac8('0x12')]);}})['catch'](function(_0x223dc9){logger[_0x7ac8('0x10')](_0x7ac8('0xc'),_0x55b2c7,_0x223dc9);_0x45fbe9(_0x223dc9);});});}