Built motion from commit (unavailable).|2.5.13
[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 _0x6c7b=['Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s'];(function(_0x246bb6,_0x2d2b2d){var _0x2b892b=function(_0x2e2afa){while(--_0x2e2afa){_0x246bb6['push'](_0x246bb6['shift']());}};_0x2b892b(++_0x2d2b2d);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2ea83b,_0xda9c25){_0x2ea83b=_0x2ea83b-0x0;var _0x38fe59=_0x6c7b[_0x2ea83b];return _0x38fe59;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb6c7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6c7('0x2'))['db'];var utils=require(_0xb6c7('0x3'));var logger=require(_0xb6c7('0x4'))('rpc');var config=require(_0xb6c7('0x5'));var jayson=require(_0xb6c7('0x6'));var client=jayson[_0xb6c7('0x7')][_0xb6c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb889c3,_0x5dd47a,_0x12e97e){return new BPromise(function(_0x41a5a5,_0xe2ce08){return client[_0xb6c7('0x9')](_0xb889c3,_0x12e97e)[_0xb6c7('0xa')](function(_0x34dbbd){logger[_0xb6c7('0xb')](_0xb6c7('0xc'),_0x5dd47a,'request\x20sent');logger['debug'](_0xb6c7('0xd'),_0x5dd47a,_0xb6c7('0xe'),JSON[_0xb6c7('0xf')](_0x34dbbd));if(_0x34dbbd[_0xb6c7('0x10')]){if(_0x34dbbd[_0xb6c7('0x10')][_0xb6c7('0x11')]===0x1f4){logger[_0xb6c7('0x10')]('Integration,\x20%s,\x20%s',_0x5dd47a,_0x34dbbd[_0xb6c7('0x10')][_0xb6c7('0x12')]);return _0xe2ce08(_0x34dbbd[_0xb6c7('0x10')][_0xb6c7('0x12')]);}logger[_0xb6c7('0x10')](_0xb6c7('0xc'),_0x5dd47a,_0x34dbbd[_0xb6c7('0x10')]['message']);return _0x41a5a5(_0x34dbbd[_0xb6c7('0x10')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x5dd47a,_0xb6c7('0xe'));_0x41a5a5(_0x34dbbd['result'][_0xb6c7('0x12')]);}})[_0xb6c7('0x13')](function(_0x23971b){logger[_0xb6c7('0x10')](_0xb6c7('0xc'),_0x5dd47a,_0x23971b);_0xe2ce08(_0x23971b);});});}