4e15aff331849b56b454814d9ff3862428225b83
[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 _0xe3c5=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0xe3c5[_0x3b81eb];return _0x149491;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var moment=require(_0x5e3c('0x2'));var BPromise=require(_0x5e3c('0x3'));var rs=require(_0x5e3c('0x4'));var fs=require('fs');var Redis=require(_0x5e3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e3c('0x6'));var logger=require(_0x5e3c('0x7'))(_0x5e3c('0x8'));var config=require(_0x5e3c('0x9'));var jayson=require(_0x5e3c('0xa'));var client=jayson[_0x5e3c('0xb')][_0x5e3c('0xc')]({'port':0x232a});config[_0x5e3c('0xd')]=_[_0x5e3c('0xe')](config[_0x5e3c('0xd')],{'host':_0x5e3c('0xf'),'port':0x18eb});var socket=require(_0x5e3c('0x10'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5e3c('0x11')](socket);function respondWithRpcPromise(_0x125a7c,_0x1835d9,_0x167eee){return new BPromise(function(_0x3ffc9,_0x54ce39){return client[_0x5e3c('0x12')](_0x125a7c,_0x167eee)[_0x5e3c('0x13')](function(_0x5e110b){logger[_0x5e3c('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,'request\x20sent');logger[_0x5e3c('0x15')](_0x5e3c('0x16'),_0x1835d9,_0x5e3c('0x17'),JSON[_0x5e3c('0x18')](_0x5e110b));if(_0x5e110b[_0x5e3c('0x19')]){if(_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1a')]===0x1f4){logger[_0x5e3c('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x5e110b['error'][_0x5e3c('0x1b')]);return _0x54ce39(_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1b')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1b')]);return _0x3ffc9(_0x5e110b[_0x5e3c('0x19')][_0x5e3c('0x1b')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x5e3c('0x17'));_0x3ffc9(_0x5e110b['result']['message']);}})[_0x5e3c('0x1c')](function(_0x551ccb){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1835d9,_0x551ccb);_0x54ce39(_0x551ccb);});});}