57620db9d3e76b76f0c88ed1e6fac47d98627c8d
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.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 _0xaf59=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf59,0xdc));var _0x9af5=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xaf59[_0x3fe6df];return _0x372a0e;};'use strict';var _=require(_0x9af5('0x0'));var util=require(_0x9af5('0x1'));var moment=require(_0x9af5('0x2'));var BPromise=require(_0x9af5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9af5('0x4'));var db=require(_0x9af5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9af5('0x6'))(_0x9af5('0x7'));var config=require(_0x9af5('0x8'));var jayson=require(_0x9af5('0x9'));var client=jayson[_0x9af5('0xa')]['http']({'port':0x232a});config[_0x9af5('0xb')]=_[_0x9af5('0xc')](config[_0x9af5('0xb')],{'host':_0x9af5('0xd'),'port':0x18eb});var socket=require(_0x9af5('0xe'))(new Redis(config[_0x9af5('0xb')]));require('./chatInternalMessage.socket')[_0x9af5('0xf')](socket);function respondWithRpcPromise(_0x5604f3,_0x49fc28,_0xac60fd){return new BPromise(function(_0x34da03,_0x2ab97f){return client[_0x9af5('0x10')](_0x5604f3,_0xac60fd)[_0x9af5('0x11')](function(_0x57056a){logger[_0x9af5('0x12')](_0x9af5('0x13'),_0x49fc28,_0x9af5('0x14'));logger[_0x9af5('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x49fc28,'request\x20sent',JSON[_0x9af5('0x16')](_0x57056a));if(_0x57056a['error']){if(_0x57056a[_0x9af5('0x17')][_0x9af5('0x18')]===0x1f4){logger[_0x9af5('0x17')](_0x9af5('0x13'),_0x49fc28,_0x57056a[_0x9af5('0x17')]['message']);return _0x2ab97f(_0x57056a[_0x9af5('0x17')][_0x9af5('0x19')]);}logger[_0x9af5('0x17')](_0x9af5('0x13'),_0x49fc28,_0x57056a['error'][_0x9af5('0x19')]);return _0x34da03(_0x57056a[_0x9af5('0x17')][_0x9af5('0x19')]);}else{logger[_0x9af5('0x12')](_0x9af5('0x13'),_0x49fc28,'request\x20sent');_0x34da03(_0x57056a[_0x9af5('0x1a')][_0x9af5('0x19')]);}})[_0x9af5('0x1b')](function(_0x20bd6c){logger['error'](_0x9af5('0x13'),_0x49fc28,_0x20bd6c);_0x2ab97f(_0x20bd6c);});});}