Built motion from commit (unavailable).|2.4.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 _0x7498=['request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7498,0x64));var _0x8749=function(_0x12a9c3,_0x294954){_0x12a9c3=_0x12a9c3-0x0;var _0xe469fa=_0x7498[_0x12a9c3];return _0xe469fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8749('0x0'));var BPromise=require(_0x8749('0x1'));var rs=require(_0x8749('0x2'));var fs=require('fs');var Redis=require(_0x8749('0x3'));var db=require(_0x8749('0x4'))['db'];var utils=require(_0x8749('0x5'));var logger=require('../../config/logger')(_0x8749('0x6'));var config=require(_0x8749('0x7'));var jayson=require(_0x8749('0x8'));var client=jayson[_0x8749('0x9')][_0x8749('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4440,_0x48ae62,_0x363207){return new BPromise(function(_0x3047d8,_0x454946){return client[_0x8749('0xb')](_0x4b4440,_0x363207)[_0x8749('0xc')](function(_0x542f27){logger[_0x8749('0xd')](_0x8749('0xe'),_0x48ae62,_0x8749('0xf'));logger[_0x8749('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x48ae62,'request\x20sent',JSON[_0x8749('0x11')](_0x542f27));if(_0x542f27[_0x8749('0x12')]){if(_0x542f27[_0x8749('0x12')][_0x8749('0x13')]===0x1f4){logger[_0x8749('0x12')](_0x8749('0xe'),_0x48ae62,_0x542f27[_0x8749('0x12')][_0x8749('0x14')]);return _0x454946(_0x542f27['error'][_0x8749('0x14')]);}logger['error'](_0x8749('0xe'),_0x48ae62,_0x542f27[_0x8749('0x12')]['message']);return _0x3047d8(_0x542f27[_0x8749('0x12')][_0x8749('0x14')]);}else{logger[_0x8749('0xd')](_0x8749('0xe'),_0x48ae62,'request\x20sent');_0x3047d8(_0x542f27[_0x8749('0x15')][_0x8749('0x14')]);}})[_0x8749('0x16')](function(_0x55b005){logger[_0x8749('0x12')]('Integration,\x20%s,\x20%s',_0x48ae62,_0x55b005);_0x454946(_0x55b005);});});}