53ab2894b40fef4001c32773b61dd6d14027a494
[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 _0x7bae=['localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x137343,_0x34a770){var _0x14a3ce=function(_0x5b6201){while(--_0x5b6201){_0x137343['push'](_0x137343['shift']());}};_0x14a3ce(++_0x34a770);}(_0x7bae,0xaa));var _0xe7ba=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x7bae[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require(_0xe7ba('0x0'));var moment=require(_0xe7ba('0x1'));var BPromise=require(_0xe7ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7ba('0x3'))['db'];var utils=require(_0xe7ba('0x4'));var logger=require('../../config/logger')(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xd'))[_0xe7ba('0xe')](socket);function respondWithRpcPromise(_0x5d1b7e,_0x412c4f,_0x42ebc2){return new BPromise(function(_0x40aabc,_0x232cbe){return client[_0xe7ba('0xf')](_0x5d1b7e,_0x42ebc2)['then'](function(_0x464fbf){logger[_0xe7ba('0x10')](_0xe7ba('0x11'),_0x412c4f,'request\x20sent');logger[_0xe7ba('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x412c4f,_0xe7ba('0x13'),JSON[_0xe7ba('0x14')](_0x464fbf));if(_0x464fbf[_0xe7ba('0x15')]){if(_0x464fbf['error'][_0xe7ba('0x16')]===0x1f4){logger[_0xe7ba('0x15')](_0xe7ba('0x11'),_0x412c4f,_0x464fbf[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x232cbe(_0x464fbf[_0xe7ba('0x15')][_0xe7ba('0x17')]);}logger[_0xe7ba('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x412c4f,_0x464fbf['error']['message']);return _0x40aabc(_0x464fbf[_0xe7ba('0x15')][_0xe7ba('0x17')]);}else{logger[_0xe7ba('0x10')](_0xe7ba('0x11'),_0x412c4f,_0xe7ba('0x13'));_0x40aabc(_0x464fbf[_0xe7ba('0x18')][_0xe7ba('0x17')]);}})[_0xe7ba('0x19')](function(_0x3ca147){logger['error'](_0xe7ba('0x11'),_0x412c4f,_0x3ca147);_0x232cbe(_0x3ca147);});});}