Built motion from commit (unavailable).|2.3.2
[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 _0x6514=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x168c60,_0x539d96){var _0x29bea4=function(_0x1f7f4e){while(--_0x1f7f4e){_0x168c60['push'](_0x168c60['shift']());}};_0x29bea4(++_0x539d96);}(_0x6514,0x1cc));var _0x4651=function(_0x248873,_0x32cca5){_0x248873=_0x248873-0x0;var _0x28d0c4=_0x6514[_0x248873];return _0x28d0c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4651('0x0'));var BPromise=require(_0x4651('0x1'));var rs=require(_0x4651('0x2'));var fs=require('fs');var Redis=require(_0x4651('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4651('0x4'));var logger=require('../../config/logger')(_0x4651('0x5'));var config=require(_0x4651('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4651('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5abb06,_0x4db51a,_0x2a5ee4){return new BPromise(function(_0x5466ee,_0x15665c){return client[_0x4651('0x8')](_0x5abb06,_0x2a5ee4)[_0x4651('0x9')](function(_0x38c52e){logger[_0x4651('0xa')](_0x4651('0xb'),_0x4db51a,_0x4651('0xc'));logger['debug'](_0x4651('0xd'),_0x4db51a,_0x4651('0xc'),JSON[_0x4651('0xe')](_0x38c52e));if(_0x38c52e[_0x4651('0xf')]){if(_0x38c52e['error'][_0x4651('0x10')]===0x1f4){logger[_0x4651('0xf')](_0x4651('0xb'),_0x4db51a,_0x38c52e['error']['message']);return _0x15665c(_0x38c52e[_0x4651('0xf')]['message']);}logger['error'](_0x4651('0xb'),_0x4db51a,_0x38c52e[_0x4651('0xf')][_0x4651('0x11')]);return _0x5466ee(_0x38c52e['error'][_0x4651('0x11')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x4db51a,'request\x20sent');_0x5466ee(_0x38c52e[_0x4651('0x12')]['message']);}})[_0x4651('0x13')](function(_0x25b228){logger[_0x4651('0xf')]('Integration,\x20%s,\x20%s',_0x4db51a,_0x25b228);_0x15665c(_0x25b228);});});}