Built motion from commit (unavailable).|2.5.30
[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 _0x323b=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x15c2b6,_0x4f111c){var _0x14dc85=function(_0x18c8f2){while(--_0x18c8f2){_0x15c2b6['push'](_0x15c2b6['shift']());}};_0x14dc85(++_0x4f111c);}(_0x323b,0x1ad));var _0xb323=function(_0xed2165,_0xc2d25f){_0xed2165=_0xed2165-0x0;var _0x424733=_0x323b[_0xed2165];return _0x424733;};'use strict';var _=require(_0xb323('0x0'));var util=require('util');var moment=require(_0xb323('0x1'));var BPromise=require(_0xb323('0x2'));var rs=require(_0xb323('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb323('0x4'))['db'];var utils=require(_0xb323('0x5'));var logger=require(_0xb323('0x6'))(_0xb323('0x7'));var config=require(_0xb323('0x8'));var jayson=require(_0xb323('0x9'));var client=jayson[_0xb323('0xa')][_0xb323('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53aec0,_0x4e620b,_0x2f0d17){return new BPromise(function(_0x3508d5,_0xfbffcd){return client[_0xb323('0xc')](_0x53aec0,_0x2f0d17)['then'](function(_0x3567ea){logger[_0xb323('0xd')](_0xb323('0xe'),_0x4e620b,'request\x20sent');logger[_0xb323('0xf')](_0xb323('0x10'),_0x4e620b,_0xb323('0x11'),JSON[_0xb323('0x12')](_0x3567ea));if(_0x3567ea[_0xb323('0x13')]){if(_0x3567ea['error'][_0xb323('0x14')]===0x1f4){logger[_0xb323('0x13')](_0xb323('0xe'),_0x4e620b,_0x3567ea[_0xb323('0x13')]['message']);return _0xfbffcd(_0x3567ea[_0xb323('0x13')][_0xb323('0x15')]);}logger[_0xb323('0x13')](_0xb323('0xe'),_0x4e620b,_0x3567ea[_0xb323('0x13')][_0xb323('0x15')]);return _0x3508d5(_0x3567ea[_0xb323('0x13')][_0xb323('0x15')]);}else{logger[_0xb323('0xd')]('Integration,\x20%s,\x20%s',_0x4e620b,_0xb323('0x11'));_0x3508d5(_0x3567ea[_0xb323('0x16')][_0xb323('0x15')]);}})[_0xb323('0x17')](function(_0x4a813b){logger[_0xb323('0x13')](_0xb323('0xe'),_0x4e620b,_0x4a813b);_0xfbffcd(_0x4a813b);});});}