Built motion from commit (unavailable).|2.5.4
[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 _0xd131=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x567b96,_0x1e9957){var _0x53e9be=function(_0x102853){while(--_0x102853){_0x567b96['push'](_0x567b96['shift']());}};_0x53e9be(++_0x1e9957);}(_0xd131,0x113));var _0x1d13=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0xd131[_0x426076];return _0x1e9565;};'use strict';var _=require(_0x1d13('0x0'));var util=require(_0x1d13('0x1'));var moment=require(_0x1d13('0x2'));var BPromise=require(_0x1d13('0x3'));var rs=require(_0x1d13('0x4'));var fs=require('fs');var Redis=require(_0x1d13('0x5'));var db=require(_0x1d13('0x6'))['db'];var utils=require(_0x1d13('0x7'));var logger=require(_0x1d13('0x8'))('rpc');var config=require(_0x1d13('0x9'));var jayson=require(_0x1d13('0xa'));var client=jayson['client'][_0x1d13('0xb')]({'port':0x232a});config[_0x1d13('0xc')]=_[_0x1d13('0xd')](config[_0x1d13('0xc')],{'host':_0x1d13('0xe'),'port':0x18eb});var socket=require(_0x1d13('0xf'))(new Redis(config[_0x1d13('0xc')]));require(_0x1d13('0x10'))[_0x1d13('0x11')](socket);function respondWithRpcPromise(_0x1c4f04,_0x4678bc,_0x1a363b){return new BPromise(function(_0xcf9968,_0x435b6b){return client[_0x1d13('0x12')](_0x1c4f04,_0x1a363b)['then'](function(_0x2bd022){logger[_0x1d13('0x13')](_0x1d13('0x14'),_0x4678bc,_0x1d13('0x15'));logger[_0x1d13('0x16')](_0x1d13('0x17'),_0x4678bc,_0x1d13('0x15'),JSON['stringify'](_0x2bd022));if(_0x2bd022[_0x1d13('0x18')]){if(_0x2bd022[_0x1d13('0x18')][_0x1d13('0x19')]===0x1f4){logger['error'](_0x1d13('0x14'),_0x4678bc,_0x2bd022[_0x1d13('0x18')]['message']);return _0x435b6b(_0x2bd022[_0x1d13('0x18')][_0x1d13('0x1a')]);}logger[_0x1d13('0x18')](_0x1d13('0x14'),_0x4678bc,_0x2bd022[_0x1d13('0x18')][_0x1d13('0x1a')]);return _0xcf9968(_0x2bd022[_0x1d13('0x18')][_0x1d13('0x1a')]);}else{logger[_0x1d13('0x13')](_0x1d13('0x14'),_0x4678bc,_0x1d13('0x15'));_0xcf9968(_0x2bd022[_0x1d13('0x1b')][_0x1d13('0x1a')]);}})['catch'](function(_0x2488d5){logger[_0x1d13('0x18')](_0x1d13('0x14'),_0x4678bc,_0x2488d5);_0x435b6b(_0x2488d5);});});}