Built motion from commit 994c64e1.|2.6.1
[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 _0xdc0d=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdc0d,0x1db));var _0xddc0=function(_0x14e81b,_0x3977f4){_0x14e81b=_0x14e81b-0x0;var _0x17ea95=_0xdc0d[_0x14e81b];return _0x17ea95;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var moment=require('moment');var BPromise=require(_0xddc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddc0('0x3'));var db=require(_0xddc0('0x4'))['db'];var utils=require(_0xddc0('0x5'));var logger=require(_0xddc0('0x6'))(_0xddc0('0x7'));var config=require(_0xddc0('0x8'));var jayson=require(_0xddc0('0x9'));var client=jayson[_0xddc0('0xa')][_0xddc0('0xb')]({'port':0x232a});config['redis']=_[_0xddc0('0xc')](config[_0xddc0('0xd')],{'host':_0xddc0('0xe'),'port':0x18eb});var socket=require(_0xddc0('0xf'))(new Redis(config[_0xddc0('0xd')]));require(_0xddc0('0x10'))['register'](socket);function respondWithRpcPromise(_0x3edc9b,_0xb4a23d,_0x388a4b){return new BPromise(function(_0x217112,_0x9da840){return client[_0xddc0('0x11')](_0x3edc9b,_0x388a4b)[_0xddc0('0x12')](function(_0x36cf5e){logger['info'](_0xddc0('0x13'),_0xb4a23d,_0xddc0('0x14'));logger['debug'](_0xddc0('0x15'),_0xb4a23d,_0xddc0('0x14'),JSON[_0xddc0('0x16')](_0x36cf5e));if(_0x36cf5e[_0xddc0('0x17')]){if(_0x36cf5e[_0xddc0('0x17')]['code']===0x1f4){logger[_0xddc0('0x17')](_0xddc0('0x13'),_0xb4a23d,_0x36cf5e['error'][_0xddc0('0x18')]);return _0x9da840(_0x36cf5e['error'][_0xddc0('0x18')]);}logger[_0xddc0('0x17')](_0xddc0('0x13'),_0xb4a23d,_0x36cf5e['error']['message']);return _0x217112(_0x36cf5e[_0xddc0('0x17')][_0xddc0('0x18')]);}else{logger[_0xddc0('0x19')](_0xddc0('0x13'),_0xb4a23d,'request\x20sent');_0x217112(_0x36cf5e[_0xddc0('0x1a')][_0xddc0('0x18')]);}})[_0xddc0('0x1b')](function(_0x3aedb2){logger['error'](_0xddc0('0x13'),_0xb4a23d,_0x3aedb2);_0x9da840(_0x3aedb2);});});}