5bb1c7e6d66926503235f4e7b75fc8eb8d7dbc48
[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 _0x6557=['ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','message','result','catch','error','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6557,0x77));var _0x7655=function(_0x28ae4f,_0x895596){_0x28ae4f=_0x28ae4f-0x0;var _0x535310=_0x6557[_0x28ae4f];return _0x535310;};'use strict';var _=require(_0x7655('0x0'));var util=require('util');var moment=require(_0x7655('0x1'));var BPromise=require(_0x7655('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7655('0x3'));var db=require(_0x7655('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7655('0x5'));var config=require(_0x7655('0x6'));var jayson=require(_0x7655('0x7'));var client=jayson[_0x7655('0x8')][_0x7655('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3788af,_0x292a4b,_0x2a1537){return new BPromise(function(_0xae6ac,_0x1fdad4){return client[_0x7655('0xa')](_0x3788af,_0x2a1537)[_0x7655('0xb')](function(_0xe643d6){logger[_0x7655('0xc')](_0x7655('0xd'),_0x292a4b,_0x7655('0xe'));logger['debug'](_0x7655('0xf'),_0x292a4b,_0x7655('0xe'),JSON[_0x7655('0x10')](_0xe643d6));if(_0xe643d6['error']){if(_0xe643d6['error'][_0x7655('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x292a4b,_0xe643d6['error'][_0x7655('0x12')]);return _0x1fdad4(_0xe643d6['error'][_0x7655('0x12')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x292a4b,_0xe643d6['error'][_0x7655('0x12')]);return _0xae6ac(_0xe643d6['error']['message']);}else{logger[_0x7655('0xc')](_0x7655('0xd'),_0x292a4b,_0x7655('0xe'));_0xae6ac(_0xe643d6[_0x7655('0x13')][_0x7655('0x12')]);}})[_0x7655('0x14')](function(_0x4ca5f6){logger[_0x7655('0x15')](_0x7655('0xd'),_0x292a4b,_0x4ca5f6);_0x1fdad4(_0x4ca5f6);});});}