Built motion from commit b5413ace.|2.6.9
[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 _0x81d2=['code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x198e50,_0x1f8708){var _0x478867=function(_0x105c25){while(--_0x105c25){_0x198e50['push'](_0x198e50['shift']());}};_0x478867(++_0x1f8708);}(_0x81d2,0x86));var _0x281d=function(_0x2b1836,_0x246d1c){_0x2b1836=_0x2b1836-0x0;var _0x423ca9=_0x81d2[_0x2b1836];return _0x423ca9;};'use strict';var _=require(_0x281d('0x0'));var util=require(_0x281d('0x1'));var moment=require(_0x281d('0x2'));var BPromise=require('bluebird');var rs=require(_0x281d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x281d('0x4'))['db'];var utils=require(_0x281d('0x5'));var logger=require(_0x281d('0x6'))(_0x281d('0x7'));var config=require(_0x281d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x281d('0x9')]['http']({'port':0x232a});config[_0x281d('0xa')]=_[_0x281d('0xb')](config[_0x281d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x281d('0xc'))(new Redis(config[_0x281d('0xa')]));require('./chatInternalMessage.socket')[_0x281d('0xd')](socket);function respondWithRpcPromise(_0x3a9098,_0x590f11,_0x23fda5){return new BPromise(function(_0x387c01,_0x3f2d6c){return client[_0x281d('0xe')](_0x3a9098,_0x23fda5)[_0x281d('0xf')](function(_0x5194e9){logger['info'](_0x281d('0x10'),_0x590f11,_0x281d('0x11'));logger[_0x281d('0x12')](_0x281d('0x13'),_0x590f11,_0x281d('0x11'),JSON[_0x281d('0x14')](_0x5194e9));if(_0x5194e9['error']){if(_0x5194e9[_0x281d('0x15')][_0x281d('0x16')]===0x1f4){logger[_0x281d('0x15')](_0x281d('0x10'),_0x590f11,_0x5194e9[_0x281d('0x15')][_0x281d('0x17')]);return _0x3f2d6c(_0x5194e9[_0x281d('0x15')][_0x281d('0x17')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x590f11,_0x5194e9[_0x281d('0x15')]['message']);return _0x387c01(_0x5194e9[_0x281d('0x15')][_0x281d('0x17')]);}else{logger[_0x281d('0x18')](_0x281d('0x10'),_0x590f11,_0x281d('0x11'));_0x387c01(_0x5194e9['result'][_0x281d('0x17')]);}})[_0x281d('0x19')](function(_0x1d4237){logger[_0x281d('0x15')](_0x281d('0x10'),_0x590f11,_0x1d4237);_0x3f2d6c(_0x1d4237);});});}