Built motion from commit (unavailable).|2.5.14
[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 _0x177a=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3c2efd,_0x405f28){var _0x433b01=function(_0xd9f231){while(--_0xd9f231){_0x3c2efd['push'](_0x3c2efd['shift']());}};_0x433b01(++_0x405f28);}(_0x177a,0xdd));var _0xa177=function(_0x2e4362,_0x39c31b){_0x2e4362=_0x2e4362-0x0;var _0x500526=_0x177a[_0x2e4362];return _0x500526;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa177('0x1'));var rs=require(_0xa177('0x2'));var fs=require('fs');var Redis=require(_0xa177('0x3'));var db=require(_0xa177('0x4'))['db'];var utils=require(_0xa177('0x5'));var logger=require(_0xa177('0x6'))('rpc');var config=require(_0xa177('0x7'));var jayson=require(_0xa177('0x8'));var client=jayson[_0xa177('0x9')][_0xa177('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34b6a7,_0xb27b2,_0x331b53){return new BPromise(function(_0x11a535,_0x55bf0f){return client[_0xa177('0xb')](_0x34b6a7,_0x331b53)['then'](function(_0x2a8a12){logger[_0xa177('0xc')](_0xa177('0xd'),_0xb27b2,_0xa177('0xe'));logger[_0xa177('0xf')](_0xa177('0x10'),_0xb27b2,_0xa177('0xe'),JSON['stringify'](_0x2a8a12));if(_0x2a8a12[_0xa177('0x11')]){if(_0x2a8a12[_0xa177('0x11')][_0xa177('0x12')]===0x1f4){logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);return _0x55bf0f(_0x2a8a12['error']['message']);}logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);return _0x11a535(_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);}else{logger[_0xa177('0xc')](_0xa177('0xd'),_0xb27b2,_0xa177('0xe'));_0x11a535(_0x2a8a12[_0xa177('0x14')][_0xa177('0x13')]);}})[_0xa177('0x15')](function(_0x5445da){logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x5445da);_0x55bf0f(_0x5445da);});});}