Built motion from commit (unavailable).|2.4.18
[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 _0x4a64=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4b68bc,_0x46cb1a){var _0x1b8a15=function(_0xe0b6a4){while(--_0xe0b6a4){_0x4b68bc['push'](_0x4b68bc['shift']());}};_0x1b8a15(++_0x46cb1a);}(_0x4a64,0x172));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x44a6('0x0'));var util=require(_0x44a6('0x1'));var moment=require(_0x44a6('0x2'));var BPromise=require('bluebird');var rs=require(_0x44a6('0x3'));var fs=require('fs');var Redis=require(_0x44a6('0x4'));var db=require(_0x44a6('0x5'))['db'];var utils=require(_0x44a6('0x6'));var logger=require(_0x44a6('0x7'))(_0x44a6('0x8'));var config=require(_0x44a6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x44a6('0xa')][_0x44a6('0xb')]({'port':0x232a});config[_0x44a6('0xc')]=_[_0x44a6('0xd')](config[_0x44a6('0xc')],{'host':_0x44a6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44a6('0xc')]));require(_0x44a6('0xf'))[_0x44a6('0x10')](socket);function respondWithRpcPromise(_0x568902,_0x42b583,_0x45476f){return new BPromise(function(_0x203a2d,_0xbf72c7){return client['request'](_0x568902,_0x45476f)['then'](function(_0x20c562){logger[_0x44a6('0x11')](_0x44a6('0x12'),_0x42b583,_0x44a6('0x13'));logger[_0x44a6('0x14')](_0x44a6('0x15'),_0x42b583,_0x44a6('0x13'),JSON[_0x44a6('0x16')](_0x20c562));if(_0x20c562[_0x44a6('0x17')]){if(_0x20c562['error'][_0x44a6('0x18')]===0x1f4){logger[_0x44a6('0x17')](_0x44a6('0x12'),_0x42b583,_0x20c562[_0x44a6('0x17')][_0x44a6('0x19')]);return _0xbf72c7(_0x20c562[_0x44a6('0x17')][_0x44a6('0x19')]);}logger[_0x44a6('0x17')](_0x44a6('0x12'),_0x42b583,_0x20c562[_0x44a6('0x17')][_0x44a6('0x19')]);return _0x203a2d(_0x20c562['error'][_0x44a6('0x19')]);}else{logger[_0x44a6('0x11')](_0x44a6('0x12'),_0x42b583,_0x44a6('0x13'));_0x203a2d(_0x20c562[_0x44a6('0x1a')]['message']);}})[_0x44a6('0x1b')](function(_0xbe8c4b){logger['error'](_0x44a6('0x12'),_0x42b583,_0xbe8c4b);_0xbf72c7(_0xbe8c4b);});});}