fed0005a8de377f55be60034b94e275d216a73e8
[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 _0x3645=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3645,0x154));var _0x5364=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x3645[_0x2b737c];return _0x466ed5;};'use strict';var _=require('lodash');var util=require(_0x5364('0x0'));var moment=require(_0x5364('0x1'));var BPromise=require(_0x5364('0x2'));var rs=require(_0x5364('0x3'));var fs=require('fs');var Redis=require(_0x5364('0x4'));var db=require(_0x5364('0x5'))['db'];var utils=require(_0x5364('0x6'));var logger=require('../../config/logger')(_0x5364('0x7'));var config=require(_0x5364('0x8'));var jayson=require(_0x5364('0x9'));var client=jayson[_0x5364('0xa')][_0x5364('0xb')]({'port':0x232a});config[_0x5364('0xc')]=_[_0x5364('0xd')](config[_0x5364('0xc')],{'host':_0x5364('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5364('0xc')]));require(_0x5364('0xf'))[_0x5364('0x10')](socket);function respondWithRpcPromise(_0x244d2e,_0x180904,_0x1a7702){return new BPromise(function(_0x106842,_0x65f168){return client[_0x5364('0x11')](_0x244d2e,_0x1a7702)[_0x5364('0x12')](function(_0x19f33d){logger[_0x5364('0x13')](_0x5364('0x14'),_0x180904,'request\x20sent');logger[_0x5364('0x15')](_0x5364('0x16'),_0x180904,_0x5364('0x17'),JSON[_0x5364('0x18')](_0x19f33d));if(_0x19f33d['error']){if(_0x19f33d[_0x5364('0x19')]['code']===0x1f4){logger[_0x5364('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x180904,_0x19f33d[_0x5364('0x19')][_0x5364('0x1a')]);return _0x65f168(_0x19f33d[_0x5364('0x19')][_0x5364('0x1a')]);}logger[_0x5364('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x180904,_0x19f33d['error'][_0x5364('0x1a')]);return _0x106842(_0x19f33d[_0x5364('0x19')][_0x5364('0x1a')]);}else{logger[_0x5364('0x13')](_0x5364('0x14'),_0x180904,_0x5364('0x17'));_0x106842(_0x19f33d[_0x5364('0x1b')][_0x5364('0x1a')]);}})[_0x5364('0x1c')](function(_0x5192df){logger[_0x5364('0x19')](_0x5364('0x14'),_0x180904,_0x5192df);_0x65f168(_0x5192df);});});}