43ba7323391029b97d9e614a70a6c7ccd957fa0f
[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 _0xbfb3=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x24e726,_0x9831b5){var _0x59d085=function(_0x28cb59){while(--_0x28cb59){_0x24e726['push'](_0x24e726['shift']());}};_0x59d085(++_0x9831b5);}(_0xbfb3,0xa5));var _0x3bfb=function(_0x1be50b,_0x453389){_0x1be50b=_0x1be50b-0x0;var _0x49dc09=_0xbfb3[_0x1be50b];return _0x49dc09;};'use strict';var _=require(_0x3bfb('0x0'));var util=require(_0x3bfb('0x1'));var moment=require(_0x3bfb('0x2'));var BPromise=require(_0x3bfb('0x3'));var rs=require(_0x3bfb('0x4'));var fs=require('fs');var Redis=require(_0x3bfb('0x5'));var db=require(_0x3bfb('0x6'))['db'];var utils=require(_0x3bfb('0x7'));var logger=require(_0x3bfb('0x8'))(_0x3bfb('0x9'));var config=require('../../config/environment');var jayson=require(_0x3bfb('0xa'));var client=jayson[_0x3bfb('0xb')][_0x3bfb('0xc')]({'port':0x232a});config[_0x3bfb('0xd')]=_['defaults'](config[_0x3bfb('0xd')],{'host':_0x3bfb('0xe'),'port':0x18eb});var socket=require(_0x3bfb('0xf'))(new Redis(config[_0x3bfb('0xd')]));require(_0x3bfb('0x10'))[_0x3bfb('0x11')](socket);function respondWithRpcPromise(_0x2be7c2,_0x42a8ed,_0x19a56c){return new BPromise(function(_0x3e9317,_0x3d4059){return client[_0x3bfb('0x12')](_0x2be7c2,_0x19a56c)[_0x3bfb('0x13')](function(_0x5d5f77){logger[_0x3bfb('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x42a8ed,_0x3bfb('0x15'));logger['debug'](_0x3bfb('0x16'),_0x42a8ed,_0x3bfb('0x15'),JSON[_0x3bfb('0x17')](_0x5d5f77));if(_0x5d5f77[_0x3bfb('0x18')]){if(_0x5d5f77[_0x3bfb('0x18')]['code']===0x1f4){logger[_0x3bfb('0x18')](_0x3bfb('0x19'),_0x42a8ed,_0x5d5f77[_0x3bfb('0x18')][_0x3bfb('0x1a')]);return _0x3d4059(_0x5d5f77[_0x3bfb('0x18')][_0x3bfb('0x1a')]);}logger[_0x3bfb('0x18')](_0x3bfb('0x19'),_0x42a8ed,_0x5d5f77['error'][_0x3bfb('0x1a')]);return _0x3e9317(_0x5d5f77['error'][_0x3bfb('0x1a')]);}else{logger[_0x3bfb('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x42a8ed,_0x3bfb('0x15'));_0x3e9317(_0x5d5f77[_0x3bfb('0x1b')][_0x3bfb('0x1a')]);}})[_0x3bfb('0x1c')](function(_0x2586b8){logger[_0x3bfb('0x18')](_0x3bfb('0x19'),_0x42a8ed,_0x2586b8);_0x3d4059(_0x2586b8);});});}