Built motion from commit (unavailable).|2.5.22
[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 _0x8de4=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8de4,0x64));var _0x48de=function(_0x470b55,_0x4a39ba){_0x470b55=_0x470b55-0x0;var _0x35a830=_0x8de4[_0x470b55];return _0x35a830;};'use strict';var _=require(_0x48de('0x0'));var util=require(_0x48de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48de('0x2'));var fs=require('fs');var Redis=require(_0x48de('0x3'));var db=require(_0x48de('0x4'))['db'];var utils=require(_0x48de('0x5'));var logger=require(_0x48de('0x6'))(_0x48de('0x7'));var config=require('../../config/environment');var jayson=require(_0x48de('0x8'));var client=jayson[_0x48de('0x9')][_0x48de('0xa')]({'port':0x232a});config[_0x48de('0xb')]=_[_0x48de('0xc')](config[_0x48de('0xb')],{'host':_0x48de('0xd'),'port':0x18eb});var socket=require(_0x48de('0xe'))(new Redis(config[_0x48de('0xb')]));require('./chatInternalMessage.socket')[_0x48de('0xf')](socket);function respondWithRpcPromise(_0x526345,_0x35dbc1,_0x56d9af){return new BPromise(function(_0x2cff13,_0x134458){return client[_0x48de('0x10')](_0x526345,_0x56d9af)[_0x48de('0x11')](function(_0x5763e8){logger[_0x48de('0x12')](_0x48de('0x13'),_0x35dbc1,_0x48de('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x35dbc1,_0x48de('0x14'),JSON['stringify'](_0x5763e8));if(_0x5763e8[_0x48de('0x15')]){if(_0x5763e8['error'][_0x48de('0x16')]===0x1f4){logger[_0x48de('0x15')](_0x48de('0x13'),_0x35dbc1,_0x5763e8[_0x48de('0x15')][_0x48de('0x17')]);return _0x134458(_0x5763e8[_0x48de('0x15')][_0x48de('0x17')]);}logger[_0x48de('0x15')](_0x48de('0x13'),_0x35dbc1,_0x5763e8[_0x48de('0x15')][_0x48de('0x17')]);return _0x2cff13(_0x5763e8[_0x48de('0x15')]['message']);}else{logger['info'](_0x48de('0x13'),_0x35dbc1,_0x48de('0x14'));_0x2cff13(_0x5763e8[_0x48de('0x18')][_0x48de('0x17')]);}})[_0x48de('0x19')](function(_0x33b404){logger[_0x48de('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x35dbc1,_0x33b404);_0x134458(_0x33b404);});});}