c2aad97a09328e9df39ab3ad6bae5677caf6b070
[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 _0xd520=['../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis'];(function(_0x5a2371,_0x2d57c1){var _0xcc7682=function(_0x547beb){while(--_0x547beb){_0x5a2371['push'](_0x5a2371['shift']());}};_0xcc7682(++_0x2d57c1);}(_0xd520,0xef));var _0x0d52=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xd520[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require(_0x0d52('0x0'));var moment=require(_0x0d52('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d52('0x2'));var fs=require('fs');var Redis=require(_0x0d52('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d52('0x4'));var logger=require(_0x0d52('0x5'))(_0x0d52('0x6'));var config=require('../../config/environment');var jayson=require(_0x0d52('0x7'));var client=jayson[_0x0d52('0x8')]['http']({'port':0x232a});config[_0x0d52('0x9')]=_[_0x0d52('0xa')](config['redis'],{'host':_0x0d52('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d52('0x9')]));require(_0x0d52('0xc'))[_0x0d52('0xd')](socket);function respondWithRpcPromise(_0xb1a186,_0x4be349,_0x2dff93){return new BPromise(function(_0x18c794,_0x43b331){return client[_0x0d52('0xe')](_0xb1a186,_0x2dff93)[_0x0d52('0xf')](function(_0x125bf2){logger['info'](_0x0d52('0x10'),_0x4be349,_0x0d52('0x11'));logger[_0x0d52('0x12')](_0x0d52('0x13'),_0x4be349,_0x0d52('0x11'),JSON[_0x0d52('0x14')](_0x125bf2));if(_0x125bf2[_0x0d52('0x15')]){if(_0x125bf2[_0x0d52('0x15')][_0x0d52('0x16')]===0x1f4){logger[_0x0d52('0x15')](_0x0d52('0x10'),_0x4be349,_0x125bf2[_0x0d52('0x15')][_0x0d52('0x17')]);return _0x43b331(_0x125bf2['error'][_0x0d52('0x17')]);}logger[_0x0d52('0x15')](_0x0d52('0x10'),_0x4be349,_0x125bf2[_0x0d52('0x15')][_0x0d52('0x17')]);return _0x18c794(_0x125bf2['error'][_0x0d52('0x17')]);}else{logger[_0x0d52('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x4be349,_0x0d52('0x11'));_0x18c794(_0x125bf2[_0x0d52('0x19')][_0x0d52('0x17')]);}})[_0x0d52('0x1a')](function(_0x3e043){logger['error'](_0x0d52('0x10'),_0x4be349,_0x3e043);_0x43b331(_0x3e043);});});}