Built motion from commit 9d0783e6.|2.6.13
[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 _0x673f=['http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x107dec,_0x59bac7){var _0x596053=function(_0x29d744){while(--_0x29d744){_0x107dec['push'](_0x107dec['shift']());}};_0x596053(++_0x59bac7);}(_0x673f,0x64));var _0xf673=function(_0x23a24d,_0x42d93b){_0x23a24d=_0x23a24d-0x0;var _0x386294=_0x673f[_0x23a24d];return _0x386294;};'use strict';var _=require(_0xf673('0x0'));var util=require(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rs=require(_0xf673('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf673('0x5'))['db'];var utils=require(_0xf673('0x6'));var logger=require(_0xf673('0x7'))(_0xf673('0x8'));var config=require(_0xf673('0x9'));var jayson=require(_0xf673('0xa'));var client=jayson[_0xf673('0xb')][_0xf673('0xc')]({'port':0x232a});config[_0xf673('0xd')]=_['defaults'](config[_0xf673('0xd')],{'host':_0xf673('0xe'),'port':0x18eb});var socket=require(_0xf673('0xf'))(new Redis(config[_0xf673('0xd')]));require(_0xf673('0x10'))[_0xf673('0x11')](socket);function respondWithRpcPromise(_0x2c0185,_0x53b65d,_0x379248){return new BPromise(function(_0x27d518,_0xa4ae22){return client[_0xf673('0x12')](_0x2c0185,_0x379248)['then'](function(_0x3ced76){logger['info'](_0xf673('0x13'),_0x53b65d,_0xf673('0x14'));logger[_0xf673('0x15')](_0xf673('0x16'),_0x53b65d,_0xf673('0x14'),JSON['stringify'](_0x3ced76));if(_0x3ced76[_0xf673('0x17')]){if(_0x3ced76['error'][_0xf673('0x18')]===0x1f4){logger['error'](_0xf673('0x13'),_0x53b65d,_0x3ced76[_0xf673('0x17')][_0xf673('0x19')]);return _0xa4ae22(_0x3ced76[_0xf673('0x17')][_0xf673('0x19')]);}logger['error'](_0xf673('0x13'),_0x53b65d,_0x3ced76[_0xf673('0x17')][_0xf673('0x19')]);return _0x27d518(_0x3ced76[_0xf673('0x17')]['message']);}else{logger[_0xf673('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x53b65d,_0xf673('0x14'));_0x27d518(_0x3ced76[_0xf673('0x1b')][_0xf673('0x19')]);}})['catch'](function(_0xa59a76){logger[_0xf673('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x53b65d,_0xa59a76);_0xa4ae22(_0xa59a76);});});}