Built motion from commit (unavailable).|2.5.5
[motion2.git] / server / api / integration / integration.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 _0xe8cb=['info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe8cb,0x11a));var _0xbe8c=function(_0x213557,_0x2d1bd8){_0x213557=_0x213557-0x0;var _0x392752=_0xe8cb[_0x213557];return _0x392752;};'use strict';var _=require(_0xbe8c('0x0'));var util=require(_0xbe8c('0x1'));var moment=require(_0xbe8c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe8c('0x3'));var db=require(_0xbe8c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbe8c('0x5'));var config=require(_0xbe8c('0x6'));var jayson=require(_0xbe8c('0x7'));var client=jayson[_0xbe8c('0x8')][_0xbe8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e0da,_0x2891af,_0x143c54){return new BPromise(function(_0x3ff727,_0xbe7d50){return client[_0xbe8c('0xa')](_0x49e0da,_0x143c54)[_0xbe8c('0xb')](function(_0x496a06){logger[_0xbe8c('0xc')](_0xbe8c('0xd'),_0x2891af,_0xbe8c('0xe'));logger[_0xbe8c('0xf')](_0xbe8c('0x10'),_0x2891af,_0xbe8c('0xe'),JSON[_0xbe8c('0x11')](_0x496a06));if(_0x496a06[_0xbe8c('0x12')]){if(_0x496a06[_0xbe8c('0x12')][_0xbe8c('0x13')]===0x1f4){logger[_0xbe8c('0x12')](_0xbe8c('0xd'),_0x2891af,_0x496a06[_0xbe8c('0x12')][_0xbe8c('0x14')]);return _0xbe7d50(_0x496a06[_0xbe8c('0x12')][_0xbe8c('0x14')]);}logger[_0xbe8c('0x12')](_0xbe8c('0xd'),_0x2891af,_0x496a06[_0xbe8c('0x12')][_0xbe8c('0x14')]);return _0x3ff727(_0x496a06[_0xbe8c('0x12')][_0xbe8c('0x14')]);}else{logger[_0xbe8c('0xc')]('Integration,\x20%s,\x20%s',_0x2891af,_0xbe8c('0xe'));_0x3ff727(_0x496a06['result']['message']);}})['catch'](function(_0x259ba3){logger['error'](_0xbe8c('0xd'),_0x2891af,_0x259ba3);_0xbe7d50(_0x259ba3);});});}