Built motion from commit (unavailable).|2.5.15
[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 _0x4f29=['../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x4f29,0xfd));var _0x94f2=function(_0x1da356,_0xde6358){_0x1da356=_0x1da356-0x0;var _0x55d26a=_0x4f29[_0x1da356];return _0x55d26a;};'use strict';var _=require('lodash');var util=require(_0x94f2('0x0'));var moment=require(_0x94f2('0x1'));var BPromise=require(_0x94f2('0x2'));var rs=require(_0x94f2('0x3'));var fs=require('fs');var Redis=require(_0x94f2('0x4'));var db=require(_0x94f2('0x5'))['db'];var utils=require(_0x94f2('0x6'));var logger=require(_0x94f2('0x7'))(_0x94f2('0x8'));var config=require(_0x94f2('0x9'));var jayson=require(_0x94f2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe14ba5,_0x4042b1,_0x1d1910){return new BPromise(function(_0x224a93,_0x3eca06){return client['request'](_0xe14ba5,_0x1d1910)['then'](function(_0x5bc91c){logger[_0x94f2('0xb')]('Integration,\x20%s,\x20%s',_0x4042b1,_0x94f2('0xc'));logger[_0x94f2('0xd')](_0x94f2('0xe'),_0x4042b1,_0x94f2('0xc'),JSON['stringify'](_0x5bc91c));if(_0x5bc91c[_0x94f2('0xf')]){if(_0x5bc91c[_0x94f2('0xf')][_0x94f2('0x10')]===0x1f4){logger[_0x94f2('0xf')](_0x94f2('0x11'),_0x4042b1,_0x5bc91c[_0x94f2('0xf')][_0x94f2('0x12')]);return _0x3eca06(_0x5bc91c['error'][_0x94f2('0x12')]);}logger['error'](_0x94f2('0x11'),_0x4042b1,_0x5bc91c[_0x94f2('0xf')][_0x94f2('0x12')]);return _0x224a93(_0x5bc91c['error']['message']);}else{logger[_0x94f2('0xb')](_0x94f2('0x11'),_0x4042b1,_0x94f2('0xc'));_0x224a93(_0x5bc91c['result'][_0x94f2('0x12')]);}})[_0x94f2('0x13')](function(_0x5ae9d2){logger['error'](_0x94f2('0x11'),_0x4042b1,_0x5ae9d2);_0x3eca06(_0x5ae9d2);});});}