Built motion from commit (unavailable).|2.4.21
[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 _0x59d9=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x40fa3e,_0x38ba31){var _0x10f1e1=function(_0x5785a9){while(--_0x5785a9){_0x40fa3e['push'](_0x40fa3e['shift']());}};_0x10f1e1(++_0x38ba31);}(_0x59d9,0x9a));var _0x959d=function(_0x3db5b2,_0x34c6d1){_0x3db5b2=_0x3db5b2-0x0;var _0x462a5c=_0x59d9[_0x3db5b2];return _0x462a5c;};'use strict';var _=require(_0x959d('0x0'));var util=require(_0x959d('0x1'));var moment=require(_0x959d('0x2'));var BPromise=require(_0x959d('0x3'));var rs=require(_0x959d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x959d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x959d('0x6'))(_0x959d('0x7'));var config=require(_0x959d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x959d('0x9')]['http']({'port':0x232a});config[_0x959d('0xa')]=_[_0x959d('0xb')](config[_0x959d('0xa')],{'host':_0x959d('0xc'),'port':0x18eb});var socket=require(_0x959d('0xd'))(new Redis(config[_0x959d('0xa')]));require(_0x959d('0xe'))['register'](socket);function respondWithRpcPromise(_0x11f453,_0x166088,_0x42a99b){return new BPromise(function(_0x537fd0,_0x559e86){return client[_0x959d('0xf')](_0x11f453,_0x42a99b)[_0x959d('0x10')](function(_0x26e125){logger['info'](_0x959d('0x11'),_0x166088,'request\x20sent');logger[_0x959d('0x12')](_0x959d('0x13'),_0x166088,_0x959d('0x14'),JSON[_0x959d('0x15')](_0x26e125));if(_0x26e125[_0x959d('0x16')]){if(_0x26e125[_0x959d('0x16')][_0x959d('0x17')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x166088,_0x26e125[_0x959d('0x16')]['message']);return _0x559e86(_0x26e125['error'][_0x959d('0x18')]);}logger['error'](_0x959d('0x11'),_0x166088,_0x26e125[_0x959d('0x16')]['message']);return _0x537fd0(_0x26e125['error'][_0x959d('0x18')]);}else{logger[_0x959d('0x19')](_0x959d('0x11'),_0x166088,_0x959d('0x14'));_0x537fd0(_0x26e125['result'][_0x959d('0x18')]);}})[_0x959d('0x1a')](function(_0x5c0be3){logger[_0x959d('0x16')](_0x959d('0x11'),_0x166088,_0x5c0be3);_0x559e86(_0x5c0be3);});});}