Built motion from commit f3da74b7.|2.5.36
[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 _0x03cf=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../config/utils'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x03cf,0x64));var _0xf03c=function(_0x383ca6,_0x39dc19){_0x383ca6=_0x383ca6-0x0;var _0x7e0082=_0x03cf[_0x383ca6];return _0x7e0082;};'use strict';var _=require('lodash');var util=require(_0xf03c('0x0'));var moment=require(_0xf03c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf03c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf03c('0x3'));var logger=require('../../config/logger')(_0xf03c('0x4'));var config=require(_0xf03c('0x5'));var jayson=require(_0xf03c('0x6'));var client=jayson['client'][_0xf03c('0x7')]({'port':0x232a});config[_0xf03c('0x8')]=_[_0xf03c('0x9')](config[_0xf03c('0x8')],{'host':_0xf03c('0xa'),'port':0x18eb});var socket=require(_0xf03c('0xb'))(new Redis(config['redis']));require(_0xf03c('0xc'))[_0xf03c('0xd')](socket);function respondWithRpcPromise(_0x1713d6,_0x17ff63,_0x15d5c6){return new BPromise(function(_0x36c6c3,_0xa50ef){return client[_0xf03c('0xe')](_0x1713d6,_0x15d5c6)[_0xf03c('0xf')](function(_0x30e960){logger[_0xf03c('0x10')](_0xf03c('0x11'),_0x17ff63,_0xf03c('0x12'));logger['debug'](_0xf03c('0x13'),_0x17ff63,_0xf03c('0x12'),JSON[_0xf03c('0x14')](_0x30e960));if(_0x30e960[_0xf03c('0x15')]){if(_0x30e960['error'][_0xf03c('0x16')]===0x1f4){logger[_0xf03c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x17ff63,_0x30e960[_0xf03c('0x15')][_0xf03c('0x17')]);return _0xa50ef(_0x30e960[_0xf03c('0x15')]['message']);}logger[_0xf03c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x17ff63,_0x30e960[_0xf03c('0x15')][_0xf03c('0x17')]);return _0x36c6c3(_0x30e960['error']['message']);}else{logger['info'](_0xf03c('0x11'),_0x17ff63,_0xf03c('0x12'));_0x36c6c3(_0x30e960[_0xf03c('0x18')]['message']);}})[_0xf03c('0x19')](function(_0x3eb515){logger[_0xf03c('0x15')](_0xf03c('0x11'),_0x17ff63,_0x3eb515);_0xa50ef(_0x3eb515);});});}