b399fb9a60987ae43333cb66f084543f42b17c2f
[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 _0x400b=['rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x320cf5,_0x4e437d){var _0xa77006=function(_0x854b9c){while(--_0x854b9c){_0x320cf5['push'](_0x320cf5['shift']());}};_0xa77006(++_0x4e437d);}(_0x400b,0x1e5));var _0xb400=function(_0x3098a7,_0x490909){_0x3098a7=_0x3098a7-0x0;var _0x530a7b=_0x400b[_0x3098a7];return _0x530a7b;};'use strict';var _=require(_0xb400('0x0'));var util=require(_0xb400('0x1'));var moment=require(_0xb400('0x2'));var BPromise=require(_0xb400('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb400('0x4'));var db=require(_0xb400('0x5'))['db'];var utils=require(_0xb400('0x6'));var logger=require(_0xb400('0x7'))(_0xb400('0x8'));var config=require(_0xb400('0x9'));var jayson=require(_0xb400('0xa'));var client=jayson['client'][_0xb400('0xb')]({'port':0x232a});config['redis']=_[_0xb400('0xc')](config[_0xb400('0xd')],{'host':_0xb400('0xe'),'port':0x18eb});var socket=require(_0xb400('0xf'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xb400('0x10')](socket);function respondWithRpcPromise(_0x1299ef,_0x2811ab,_0x4c7373){return new BPromise(function(_0x438f8c,_0xe35775){return client[_0xb400('0x11')](_0x1299ef,_0x4c7373)[_0xb400('0x12')](function(_0xa63c5){logger[_0xb400('0x13')](_0xb400('0x14'),_0x2811ab,'request\x20sent');logger[_0xb400('0x15')](_0xb400('0x16'),_0x2811ab,_0xb400('0x17'),JSON[_0xb400('0x18')](_0xa63c5));if(_0xa63c5['error']){if(_0xa63c5[_0xb400('0x19')]['code']===0x1f4){logger[_0xb400('0x19')](_0xb400('0x14'),_0x2811ab,_0xa63c5[_0xb400('0x19')][_0xb400('0x1a')]);return _0xe35775(_0xa63c5[_0xb400('0x19')]['message']);}logger[_0xb400('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x2811ab,_0xa63c5[_0xb400('0x19')][_0xb400('0x1a')]);return _0x438f8c(_0xa63c5[_0xb400('0x19')][_0xb400('0x1a')]);}else{logger[_0xb400('0x13')](_0xb400('0x14'),_0x2811ab,_0xb400('0x17'));_0x438f8c(_0xa63c5[_0xb400('0x1b')][_0xb400('0x1a')]);}})[_0xb400('0x1c')](function(_0x4251d7){logger[_0xb400('0x19')](_0xb400('0x14'),_0x2811ab,_0x4251d7);_0xe35775(_0x4251d7);});});}