Built motion from commit (unavailable).|2.4.4
[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 _0x5b78=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5b78,0xfa));var _0x85b7=function(_0x207a2a,_0x461c28){_0x207a2a=_0x207a2a-0x0;var _0x2004a8=_0x5b78[_0x207a2a];return _0x2004a8;};'use strict';var _=require(_0x85b7('0x0'));var util=require(_0x85b7('0x1'));var moment=require(_0x85b7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x85b7('0x4'));var logger=require(_0x85b7('0x5'))(_0x85b7('0x6'));var config=require(_0x85b7('0x7'));var jayson=require(_0x85b7('0x8'));var client=jayson[_0x85b7('0x9')][_0x85b7('0xa')]({'port':0x232a});config[_0x85b7('0xb')]=_['defaults'](config[_0x85b7('0xb')],{'host':_0x85b7('0xc'),'port':0x18eb});var socket=require(_0x85b7('0xd'))(new Redis(config[_0x85b7('0xb')]));require(_0x85b7('0xe'))[_0x85b7('0xf')](socket);function respondWithRpcPromise(_0x5d84c8,_0x4fed57,_0x3086bb){return new BPromise(function(_0x1f8120,_0x4fb6b3){return client['request'](_0x5d84c8,_0x3086bb)[_0x85b7('0x10')](function(_0x12c070){logger[_0x85b7('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4fed57,_0x85b7('0x12'));logger[_0x85b7('0x13')](_0x85b7('0x14'),_0x4fed57,_0x85b7('0x12'),JSON[_0x85b7('0x15')](_0x12c070));if(_0x12c070[_0x85b7('0x16')]){if(_0x12c070[_0x85b7('0x16')][_0x85b7('0x17')]===0x1f4){logger[_0x85b7('0x16')](_0x85b7('0x18'),_0x4fed57,_0x12c070[_0x85b7('0x16')][_0x85b7('0x19')]);return _0x4fb6b3(_0x12c070['error']['message']);}logger[_0x85b7('0x16')](_0x85b7('0x18'),_0x4fed57,_0x12c070[_0x85b7('0x16')][_0x85b7('0x19')]);return _0x1f8120(_0x12c070['error']['message']);}else{logger['info'](_0x85b7('0x18'),_0x4fed57,'request\x20sent');_0x1f8120(_0x12c070[_0x85b7('0x1a')][_0x85b7('0x19')]);}})[_0x85b7('0x1b')](function(_0x55ceec){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4fed57,_0x55ceec);_0x4fb6b3(_0x55ceec);});});}