Built motion from commit 88aa8522.|2.5.37
[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 _0x6007=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','info'];(function(_0x144388,_0xa4b2de){var _0x407ff0=function(_0x4eabaf){while(--_0x4eabaf){_0x144388['push'](_0x144388['shift']());}};_0x407ff0(++_0xa4b2de);}(_0x6007,0x8f));var _0x7600=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x6007[_0x5d0609];return _0xaa3fd1;};'use strict';var _=require(_0x7600('0x0'));var util=require(_0x7600('0x1'));var moment=require(_0x7600('0x2'));var BPromise=require(_0x7600('0x3'));var rs=require(_0x7600('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7600('0x5'))['db'];var utils=require(_0x7600('0x6'));var logger=require(_0x7600('0x7'))(_0x7600('0x8'));var config=require(_0x7600('0x9'));var jayson=require(_0x7600('0xa'));var client=jayson[_0x7600('0xb')][_0x7600('0xc')]({'port':0x232a});config[_0x7600('0xd')]=_['defaults'](config[_0x7600('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7600('0xe'))(new Redis(config[_0x7600('0xd')]));require(_0x7600('0xf'))[_0x7600('0x10')](socket);function respondWithRpcPromise(_0x1fae5f,_0x19f86,_0x57b568){return new BPromise(function(_0x24ece6,_0x3c456e){return client[_0x7600('0x11')](_0x1fae5f,_0x57b568)['then'](function(_0x75d836){logger[_0x7600('0x12')](_0x7600('0x13'),_0x19f86,_0x7600('0x14'));logger['debug'](_0x7600('0x15'),_0x19f86,'request\x20sent',JSON[_0x7600('0x16')](_0x75d836));if(_0x75d836[_0x7600('0x17')]){if(_0x75d836[_0x7600('0x17')][_0x7600('0x18')]===0x1f4){logger[_0x7600('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x19f86,_0x75d836['error'][_0x7600('0x19')]);return _0x3c456e(_0x75d836[_0x7600('0x17')]['message']);}logger[_0x7600('0x17')](_0x7600('0x13'),_0x19f86,_0x75d836[_0x7600('0x17')][_0x7600('0x19')]);return _0x24ece6(_0x75d836['error'][_0x7600('0x19')]);}else{logger['info'](_0x7600('0x13'),_0x19f86,_0x7600('0x14'));_0x24ece6(_0x75d836['result']['message']);}})[_0x7600('0x1a')](function(_0x303782){logger[_0x7600('0x17')](_0x7600('0x13'),_0x19f86,_0x303782);_0x3c456e(_0x303782);});});}