91102d4045dd70c5113a7e06bab354cc8f670c24
[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 _0xe935=['../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xe935,0x10b));var _0x5e93=function(_0x1a29d0,_0x406487){_0x1a29d0=_0x1a29d0-0x0;var _0x9e4bc8=_0xe935[_0x1a29d0];return _0x9e4bc8;};'use strict';var _=require(_0x5e93('0x0'));var util=require(_0x5e93('0x1'));var moment=require('moment');var BPromise=require(_0x5e93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e93('0x4'));var logger=require(_0x5e93('0x5'))('rpc');var config=require(_0x5e93('0x6'));var jayson=require(_0x5e93('0x7'));var client=jayson[_0x5e93('0x8')][_0x5e93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f89c8,_0x5724bc,_0x2a5f05){return new BPromise(function(_0xcf77c5,_0x458009){return client[_0x5e93('0xa')](_0x4f89c8,_0x2a5f05)[_0x5e93('0xb')](function(_0x651659){logger[_0x5e93('0xc')](_0x5e93('0xd'),_0x5724bc,_0x5e93('0xe'));logger['debug'](_0x5e93('0xf'),_0x5724bc,_0x5e93('0xe'),JSON[_0x5e93('0x10')](_0x651659));if(_0x651659[_0x5e93('0x11')]){if(_0x651659[_0x5e93('0x11')][_0x5e93('0x12')]===0x1f4){logger[_0x5e93('0x11')]('ChatApplication,\x20%s,\x20%s',_0x5724bc,_0x651659[_0x5e93('0x11')][_0x5e93('0x13')]);return _0x458009(_0x651659[_0x5e93('0x11')]['message']);}logger[_0x5e93('0x11')]('ChatApplication,\x20%s,\x20%s',_0x5724bc,_0x651659[_0x5e93('0x11')][_0x5e93('0x13')]);return _0xcf77c5(_0x651659[_0x5e93('0x11')][_0x5e93('0x13')]);}else{logger['info'](_0x5e93('0xd'),_0x5724bc,_0x5e93('0xe'));_0xcf77c5(_0x651659[_0x5e93('0x14')][_0x5e93('0x13')]);}})['catch'](function(_0x1d9af4){logger[_0x5e93('0x11')](_0x5e93('0xd'),_0x5724bc,_0x1d9af4);_0x458009(_0x1d9af4);});});}