Built motion from commit 092f8824.|2.5.49
[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 _0x1b4a=['http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27cf55,_0x343de6){var _0x400675=function(_0x1be7f7){while(--_0x1be7f7){_0x27cf55['push'](_0x27cf55['shift']());}};_0x400675(++_0x343de6);}(_0x1b4a,0x99));var _0xa1b4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1b4a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa1b4('0x0'));var util=require(_0xa1b4('0x1'));var moment=require(_0xa1b4('0x2'));var BPromise=require(_0xa1b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa1b4('0x4'))(_0xa1b4('0x5'));var config=require(_0xa1b4('0x6'));var jayson=require(_0xa1b4('0x7'));var client=jayson[_0xa1b4('0x8')][_0xa1b4('0x9')]({'port':0x232a});config[_0xa1b4('0xa')]=_[_0xa1b4('0xb')](config[_0xa1b4('0xa')],{'host':_0xa1b4('0xc'),'port':0x18eb});var socket=require(_0xa1b4('0xd'))(new Redis(config[_0xa1b4('0xa')]));require(_0xa1b4('0xe'))[_0xa1b4('0xf')](socket);function respondWithRpcPromise(_0x273b92,_0x478502,_0x14b11b){return new BPromise(function(_0x3f9a4a,_0x26e764){return client['request'](_0x273b92,_0x14b11b)['then'](function(_0x53db6c){logger[_0xa1b4('0x10')](_0xa1b4('0x11'),_0x478502,'request\x20sent');logger[_0xa1b4('0x12')](_0xa1b4('0x13'),_0x478502,_0xa1b4('0x14'),JSON[_0xa1b4('0x15')](_0x53db6c));if(_0x53db6c['error']){if(_0x53db6c[_0xa1b4('0x16')][_0xa1b4('0x17')]===0x1f4){logger[_0xa1b4('0x16')](_0xa1b4('0x11'),_0x478502,_0x53db6c[_0xa1b4('0x16')][_0xa1b4('0x18')]);return _0x26e764(_0x53db6c['error'][_0xa1b4('0x18')]);}logger[_0xa1b4('0x16')](_0xa1b4('0x11'),_0x478502,_0x53db6c[_0xa1b4('0x16')]['message']);return _0x3f9a4a(_0x53db6c[_0xa1b4('0x16')][_0xa1b4('0x18')]);}else{logger[_0xa1b4('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x478502,_0xa1b4('0x14'));_0x3f9a4a(_0x53db6c[_0xa1b4('0x19')][_0xa1b4('0x18')]);}})[_0xa1b4('0x1a')](function(_0x2332d9){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x478502,_0x2332d9);_0x26e764(_0x2332d9);});});}