5114a123a129f79bbe48025e2ee0c293dcaa5f35
[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 _0x13e3=['register','request','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./chatInternalMessage.socket'];(function(_0x132ae5,_0x27b7a6){var _0x132432=function(_0x39c000){while(--_0x39c000){_0x132ae5['push'](_0x132ae5['shift']());}};_0x132432(++_0x27b7a6);}(_0x13e3,0x137));var _0x313e=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x13e3[_0x267d8d];return _0x11a98f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x313e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x313e('0x1'));var db=require(_0x313e('0x2'))['db'];var utils=require(_0x313e('0x3'));var logger=require(_0x313e('0x4'))('rpc');var config=require(_0x313e('0x5'));var jayson=require(_0x313e('0x6'));var client=jayson[_0x313e('0x7')]['http']({'port':0x232a});config[_0x313e('0x8')]=_[_0x313e('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x313e('0x8')]));require(_0x313e('0xa'))[_0x313e('0xb')](socket);function respondWithRpcPromise(_0x3c39cc,_0x474546,_0x3bc88e){return new BPromise(function(_0x5b7550,_0x16d722){return client[_0x313e('0xc')](_0x3c39cc,_0x3bc88e)['then'](function(_0x359e03){logger[_0x313e('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x474546,_0x313e('0xe'));logger[_0x313e('0xf')](_0x313e('0x10'),_0x474546,_0x313e('0xe'),JSON[_0x313e('0x11')](_0x359e03));if(_0x359e03['error']){if(_0x359e03[_0x313e('0x12')][_0x313e('0x13')]===0x1f4){logger[_0x313e('0x12')](_0x313e('0x14'),_0x474546,_0x359e03[_0x313e('0x12')][_0x313e('0x15')]);return _0x16d722(_0x359e03[_0x313e('0x12')][_0x313e('0x15')]);}logger[_0x313e('0x12')](_0x313e('0x14'),_0x474546,_0x359e03['error'][_0x313e('0x15')]);return _0x5b7550(_0x359e03[_0x313e('0x12')][_0x313e('0x15')]);}else{logger[_0x313e('0xd')](_0x313e('0x14'),_0x474546,'request\x20sent');_0x5b7550(_0x359e03[_0x313e('0x16')][_0x313e('0x15')]);}})['catch'](function(_0x3fbce6){logger['error'](_0x313e('0x14'),_0x474546,_0x3fbce6);_0x16d722(_0x3fbce6);});});}