Built motion from commit e02f907f.|2.6.14
[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 _0x6478=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis'];(function(_0x30d6c8,_0x192398){var _0x244aaf=function(_0x44da53){while(--_0x44da53){_0x30d6c8['push'](_0x30d6c8['shift']());}};_0x244aaf(++_0x192398);}(_0x6478,0x64));var _0x8647=function(_0x3c8168,_0x461028){_0x3c8168=_0x3c8168-0x0;var _0x20d28a=_0x6478[_0x3c8168];return _0x20d28a;};'use strict';var _=require(_0x8647('0x0'));var util=require(_0x8647('0x1'));var moment=require(_0x8647('0x2'));var BPromise=require(_0x8647('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8647('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8647('0x5'));var logger=require(_0x8647('0x6'))('rpc');var config=require(_0x8647('0x7'));var jayson=require(_0x8647('0x8'));var client=jayson['client'][_0x8647('0x9')]({'port':0x232a});config['redis']=_[_0x8647('0xa')](config[_0x8647('0xb')],{'host':_0x8647('0xc'),'port':0x18eb});var socket=require(_0x8647('0xd'))(new Redis(config[_0x8647('0xb')]));require(_0x8647('0xe'))[_0x8647('0xf')](socket);function respondWithRpcPromise(_0xabe8e4,_0x3d783a,_0x439d23){return new BPromise(function(_0x507db6,_0x291ddf){return client[_0x8647('0x10')](_0xabe8e4,_0x439d23)[_0x8647('0x11')](function(_0x429eb6){logger['info'](_0x8647('0x12'),_0x3d783a,_0x8647('0x13'));logger['debug'](_0x8647('0x14'),_0x3d783a,_0x8647('0x13'),JSON[_0x8647('0x15')](_0x429eb6));if(_0x429eb6[_0x8647('0x16')]){if(_0x429eb6['error'][_0x8647('0x17')]===0x1f4){logger[_0x8647('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x3d783a,_0x429eb6[_0x8647('0x16')][_0x8647('0x18')]);return _0x291ddf(_0x429eb6[_0x8647('0x16')][_0x8647('0x18')]);}logger[_0x8647('0x16')](_0x8647('0x12'),_0x3d783a,_0x429eb6['error'][_0x8647('0x18')]);return _0x507db6(_0x429eb6[_0x8647('0x16')][_0x8647('0x18')]);}else{logger[_0x8647('0x19')](_0x8647('0x12'),_0x3d783a,_0x8647('0x13'));_0x507db6(_0x429eb6[_0x8647('0x1a')][_0x8647('0x18')]);}})[_0x8647('0x1b')](function(_0x13467d){logger[_0x8647('0x16')](_0x8647('0x12'),_0x3d783a,_0x13467d);_0x291ddf(_0x13467d);});});}