Built motion from commit (unavailable).|2.5.28
[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 _0x3675=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3675,0x1e7));var _0x5367=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0x3675[_0x4c9f6a];return _0x5df5b9;};'use strict';var _=require(_0x5367('0x0'));var util=require('util');var moment=require(_0x5367('0x1'));var BPromise=require(_0x5367('0x2'));var rs=require(_0x5367('0x3'));var fs=require('fs');var Redis=require(_0x5367('0x4'));var db=require(_0x5367('0x5'))['db'];var utils=require(_0x5367('0x6'));var logger=require(_0x5367('0x7'))('rpc');var config=require(_0x5367('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5367('0x9')]=_[_0x5367('0xa')](config[_0x5367('0x9')],{'host':_0x5367('0xb'),'port':0x18eb});var socket=require(_0x5367('0xc'))(new Redis(config[_0x5367('0x9')]));require('./chatInternalMessage.socket')[_0x5367('0xd')](socket);function respondWithRpcPromise(_0x5acf5b,_0x2cc5f1,_0x3d5974){return new BPromise(function(_0x31032d,_0x4b0a78){return client[_0x5367('0xe')](_0x5acf5b,_0x3d5974)[_0x5367('0xf')](function(_0x46d17f){logger[_0x5367('0x10')](_0x5367('0x11'),_0x2cc5f1,_0x5367('0x12'));logger[_0x5367('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2cc5f1,_0x5367('0x12'),JSON['stringify'](_0x46d17f));if(_0x46d17f['error']){if(_0x46d17f[_0x5367('0x14')][_0x5367('0x15')]===0x1f4){logger[_0x5367('0x14')](_0x5367('0x11'),_0x2cc5f1,_0x46d17f['error']['message']);return _0x4b0a78(_0x46d17f['error'][_0x5367('0x16')]);}logger[_0x5367('0x14')](_0x5367('0x11'),_0x2cc5f1,_0x46d17f[_0x5367('0x14')][_0x5367('0x16')]);return _0x31032d(_0x46d17f['error'][_0x5367('0x16')]);}else{logger[_0x5367('0x10')](_0x5367('0x11'),_0x2cc5f1,_0x5367('0x12'));_0x31032d(_0x46d17f['result'][_0x5367('0x16')]);}})[_0x5367('0x17')](function(_0xbb56f7){logger['error'](_0x5367('0x11'),_0x2cc5f1,_0xbb56f7);_0x4b0a78(_0xbb56f7);});});}