Built motion from commit (unavailable).|2.5.4
[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 _0xb8ba=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8ba,0x6d));var _0xab8b=function(_0x118b5e,_0x3567bc){_0x118b5e=_0x118b5e-0x0;var _0x1e6d84=_0xb8ba[_0x118b5e];return _0x1e6d84;};'use strict';var _=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var moment=require(_0xab8b('0x2'));var BPromise=require('bluebird');var rs=require(_0xab8b('0x3'));var fs=require('fs');var Redis=require(_0xab8b('0x4'));var db=require(_0xab8b('0x5'))['db'];var utils=require(_0xab8b('0x6'));var logger=require(_0xab8b('0x7'))(_0xab8b('0x8'));var config=require(_0xab8b('0x9'));var jayson=require(_0xab8b('0xa'));var client=jayson['client'][_0xab8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5300bf,_0x1121e2,_0x57f8ba){return new BPromise(function(_0x233bfd,_0xb1ec1e){return client[_0xab8b('0xc')](_0x5300bf,_0x57f8ba)['then'](function(_0x5215cd){logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));logger[_0xab8b('0x10')](_0xab8b('0x11'),_0x1121e2,_0xab8b('0xf'),JSON[_0xab8b('0x12')](_0x5215cd));if(_0x5215cd[_0xab8b('0x13')]){if(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x14')]===0x1f4){logger[_0xab8b('0x13')]('Integration,\x20%s,\x20%s',_0x1121e2,_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);return _0xb1ec1e(_0x5215cd['error'][_0xab8b('0x15')]);}logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5215cd['error']['message']);return _0x233bfd(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);}else{logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));_0x233bfd(_0x5215cd['result'][_0xab8b('0x15')]);}})['catch'](function(_0x5241b2){logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5241b2);_0xb1ec1e(_0x5241b2);});});}