Built motion from commit a61a4a20.|2.5.46
[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 _0xb82a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird'];(function(_0x4cfe39,_0x16edcc){var _0x458c70=function(_0x253703){while(--_0x253703){_0x4cfe39['push'](_0x4cfe39['shift']());}};_0x458c70(++_0x16edcc);}(_0xb82a,0x93));var _0xab82=function(_0x4519bb,_0xb4be68){_0x4519bb=_0x4519bb-0x0;var _0x101fa2=_0xb82a[_0x4519bb];return _0x101fa2;};'use strict';var _=require('lodash');var util=require(_0xab82('0x0'));var moment=require(_0xab82('0x1'));var BPromise=require(_0xab82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab82('0x3'));var db=require(_0xab82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab82('0x5'))(_0xab82('0x6'));var config=require(_0xab82('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab82('0x8')][_0xab82('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xab82('0xa'),'port':0x18eb});var socket=require(_0xab82('0xb'))(new Redis(config['redis']));require(_0xab82('0xc'))[_0xab82('0xd')](socket);function respondWithRpcPromise(_0x313160,_0x2f377f,_0x46459a){return new BPromise(function(_0x1e1b06,_0x20992f){return client[_0xab82('0xe')](_0x313160,_0x46459a)['then'](function(_0x2f49b6){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x2f377f,_0xab82('0xf'));logger[_0xab82('0x10')](_0xab82('0x11'),_0x2f377f,_0xab82('0xf'),JSON[_0xab82('0x12')](_0x2f49b6));if(_0x2f49b6[_0xab82('0x13')]){if(_0x2f49b6[_0xab82('0x13')]['code']===0x1f4){logger[_0xab82('0x13')](_0xab82('0x14'),_0x2f377f,_0x2f49b6[_0xab82('0x13')]['message']);return _0x20992f(_0x2f49b6[_0xab82('0x13')][_0xab82('0x15')]);}logger[_0xab82('0x13')](_0xab82('0x14'),_0x2f377f,_0x2f49b6[_0xab82('0x13')][_0xab82('0x15')]);return _0x1e1b06(_0x2f49b6[_0xab82('0x13')]['message']);}else{logger[_0xab82('0x16')](_0xab82('0x14'),_0x2f377f,_0xab82('0xf'));_0x1e1b06(_0x2f49b6[_0xab82('0x17')]['message']);}})[_0xab82('0x18')](function(_0x1523cf){logger['error'](_0xab82('0x14'),_0x2f377f,_0x1523cf);_0x20992f(_0x1523cf);});});}