179480e3db1a96318480e1c9dbdb86ad7698f5eb
[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 _0x5197=['redis','localhost','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x128042,_0x364963){var _0x4e887f=function(_0x2bcae3){while(--_0x2bcae3){_0x128042['push'](_0x128042['shift']());}};_0x4e887f(++_0x364963);}(_0x5197,0x140));var _0x7519=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x5197[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x7519('0x0'));var util=require('util');var moment=require(_0x7519('0x1'));var BPromise=require(_0x7519('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7519('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7519('0x4'));var logger=require(_0x7519('0x5'))(_0x7519('0x6'));var config=require(_0x7519('0x7'));var jayson=require(_0x7519('0x8'));var client=jayson[_0x7519('0x9')]['http']({'port':0x232a});config[_0x7519('0xa')]=_['defaults'](config['redis'],{'host':_0x7519('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7519('0xc'))['register'](socket);function respondWithRpcPromise(_0x54ca07,_0x3c0dbd,_0x428db3){return new BPromise(function(_0x14db79,_0x4cab85){return client[_0x7519('0xd')](_0x54ca07,_0x428db3)['then'](function(_0x4d6be7){logger[_0x7519('0xe')](_0x7519('0xf'),_0x3c0dbd,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3c0dbd,_0x7519('0x10'),JSON[_0x7519('0x11')](_0x4d6be7));if(_0x4d6be7['error']){if(_0x4d6be7[_0x7519('0x12')]['code']===0x1f4){logger['error'](_0x7519('0xf'),_0x3c0dbd,_0x4d6be7[_0x7519('0x12')][_0x7519('0x13')]);return _0x4cab85(_0x4d6be7['error'][_0x7519('0x13')]);}logger['error'](_0x7519('0xf'),_0x3c0dbd,_0x4d6be7[_0x7519('0x12')]['message']);return _0x14db79(_0x4d6be7[_0x7519('0x12')][_0x7519('0x13')]);}else{logger[_0x7519('0xe')](_0x7519('0xf'),_0x3c0dbd,_0x7519('0x10'));_0x14db79(_0x4d6be7[_0x7519('0x14')][_0x7519('0x13')]);}})[_0x7519('0x15')](function(_0x4f6c41){logger[_0x7519('0x12')](_0x7519('0xf'),_0x3c0dbd,_0x4f6c41);_0x4cab85(_0x4f6c41);});});}