Built motion from commit 953226e6.|2.6.32
[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 _0x56d8=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x2c1aa4,_0x25b489){var _0x4afc0b=function(_0x34a9b5){while(--_0x34a9b5){_0x2c1aa4['push'](_0x2c1aa4['shift']());}};_0x4afc0b(++_0x25b489);}(_0x56d8,0x1a1));var _0x856d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x56d8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x856d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x856d('0x1'));var rs=require(_0x856d('0x2'));var fs=require('fs');var Redis=require(_0x856d('0x3'));var db=require(_0x856d('0x4'))['db'];var utils=require(_0x856d('0x5'));var logger=require(_0x856d('0x6'))(_0x856d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x856d('0x8')][_0x856d('0x9')]({'port':0x232a});config[_0x856d('0xa')]=_[_0x856d('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x856d('0xc'))(new Redis(config['redis']));require(_0x856d('0xd'))[_0x856d('0xe')](socket);function respondWithRpcPromise(_0x176659,_0x3facd4,_0x1f9b9c){return new BPromise(function(_0x333f1d,_0x25a226){return client[_0x856d('0xf')](_0x176659,_0x1f9b9c)[_0x856d('0x10')](function(_0x437ede){logger[_0x856d('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x3facd4,_0x856d('0x12'));logger[_0x856d('0x13')](_0x856d('0x14'),_0x3facd4,_0x856d('0x12'),JSON['stringify'](_0x437ede));if(_0x437ede['error']){if(_0x437ede[_0x856d('0x15')]['code']===0x1f4){logger[_0x856d('0x15')](_0x856d('0x16'),_0x3facd4,_0x437ede[_0x856d('0x15')]['message']);return _0x25a226(_0x437ede[_0x856d('0x15')]['message']);}logger[_0x856d('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x3facd4,_0x437ede[_0x856d('0x15')][_0x856d('0x17')]);return _0x333f1d(_0x437ede[_0x856d('0x15')][_0x856d('0x17')]);}else{logger['info'](_0x856d('0x16'),_0x3facd4,_0x856d('0x12'));_0x333f1d(_0x437ede[_0x856d('0x18')][_0x856d('0x17')]);}})[_0x856d('0x19')](function(_0x33e919){logger[_0x856d('0x15')](_0x856d('0x16'),_0x3facd4,_0x33e919);_0x25a226(_0x33e919);});});}