74cc627b7aceb8fcd9812cfc3165bfa6d65a0c5d
[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 _0x4ea1=['./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x4ea1,0x1b2));var _0x14ea=function(_0x277849,_0x100b68){_0x277849=_0x277849-0x0;var _0x29dadb=_0x4ea1[_0x277849];return _0x29dadb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14ea('0x0'));var BPromise=require(_0x14ea('0x1'));var rs=require(_0x14ea('0x2'));var fs=require('fs');var Redis=require(_0x14ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x14ea('0x4'));var logger=require(_0x14ea('0x5'))(_0x14ea('0x6'));var config=require(_0x14ea('0x7'));var jayson=require(_0x14ea('0x8'));var client=jayson[_0x14ea('0x9')][_0x14ea('0xa')]({'port':0x232a});config[_0x14ea('0xb')]=_[_0x14ea('0xc')](config[_0x14ea('0xb')],{'host':_0x14ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14ea('0xb')]));require(_0x14ea('0xe'))['register'](socket);function respondWithRpcPromise(_0x30733a,_0xdfb997,_0x4ad445){return new BPromise(function(_0x20f82c,_0x38a8ff){return client[_0x14ea('0xf')](_0x30733a,_0x4ad445)[_0x14ea('0x10')](function(_0x4e11a5){logger[_0x14ea('0x11')](_0x14ea('0x12'),_0xdfb997,_0x14ea('0x13'));logger[_0x14ea('0x14')](_0x14ea('0x15'),_0xdfb997,_0x14ea('0x13'),JSON[_0x14ea('0x16')](_0x4e11a5));if(_0x4e11a5[_0x14ea('0x17')]){if(_0x4e11a5['error'][_0x14ea('0x18')]===0x1f4){logger[_0x14ea('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0xdfb997,_0x4e11a5[_0x14ea('0x17')][_0x14ea('0x19')]);return _0x38a8ff(_0x4e11a5[_0x14ea('0x17')][_0x14ea('0x19')]);}logger[_0x14ea('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0xdfb997,_0x4e11a5[_0x14ea('0x17')][_0x14ea('0x19')]);return _0x20f82c(_0x4e11a5['error'][_0x14ea('0x19')]);}else{logger[_0x14ea('0x11')](_0x14ea('0x12'),_0xdfb997,_0x14ea('0x13'));_0x20f82c(_0x4e11a5[_0x14ea('0x1a')]['message']);}})[_0x14ea('0x1b')](function(_0x36af99){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xdfb997,_0x36af99);_0x38a8ff(_0x36af99);});});}