2bc7f39cb6cc4af09d0aefb44441e26fc261c447
[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 _0x17c4=['code','message','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./chatInternalMessage.socket','register','request','then','info','debug','error'];(function(_0x40b242,_0x38d533){var _0x4b846b=function(_0xb266d1){while(--_0xb266d1){_0x40b242['push'](_0x40b242['shift']());}};_0x4b846b(++_0x38d533);}(_0x17c4,0x102));var _0x417c=function(_0x276015,_0x57eb3d){_0x276015=_0x276015-0x0;var _0x385345=_0x17c4[_0x276015];return _0x385345;};'use strict';var _=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var moment=require(_0x417c('0x2'));var BPromise=require(_0x417c('0x3'));var rs=require(_0x417c('0x4'));var fs=require('fs');var Redis=require(_0x417c('0x5'));var db=require(_0x417c('0x6'))['db'];var utils=require(_0x417c('0x7'));var logger=require(_0x417c('0x8'))(_0x417c('0x9'));var config=require(_0x417c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x417c('0xb')][_0x417c('0xc')]({'port':0x232a});config[_0x417c('0xd')]=_[_0x417c('0xe')](config[_0x417c('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x417c('0xd')]));require(_0x417c('0xf'))[_0x417c('0x10')](socket);function respondWithRpcPromise(_0x34c16d,_0xddbe26,_0x514a18){return new BPromise(function(_0x69d19c,_0x5a507c){return client[_0x417c('0x11')](_0x34c16d,_0x514a18)[_0x417c('0x12')](function(_0x413a4b){logger[_0x417c('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xddbe26,'request\x20sent');logger[_0x417c('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xddbe26,'request\x20sent',JSON['stringify'](_0x413a4b));if(_0x413a4b[_0x417c('0x15')]){if(_0x413a4b['error'][_0x417c('0x16')]===0x1f4){logger[_0x417c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0xddbe26,_0x413a4b[_0x417c('0x15')][_0x417c('0x17')]);return _0x5a507c(_0x413a4b[_0x417c('0x15')][_0x417c('0x17')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xddbe26,_0x413a4b[_0x417c('0x15')][_0x417c('0x17')]);return _0x69d19c(_0x413a4b[_0x417c('0x15')]['message']);}else{logger[_0x417c('0x13')](_0x417c('0x18'),_0xddbe26,_0x417c('0x19'));_0x69d19c(_0x413a4b[_0x417c('0x1a')][_0x417c('0x17')]);}})[_0x417c('0x1b')](function(_0x3714fe){logger[_0x417c('0x15')](_0x417c('0x18'),_0xddbe26,_0x3714fe);_0x5a507c(_0x3714fe);});});}