Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / api / automation / automation.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 _0xfe56=['result','catch','lodash','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e9764,_0x2c022f){var _0x431e3e=function(_0x5d1f68){while(--_0x5d1f68){_0x3e9764['push'](_0x3e9764['shift']());}};_0x431e3e(++_0x2c022f);}(_0xfe56,0x1d6));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6fe5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6fe5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe5('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6fe5('0x3'));var config=require(_0x6fe5('0x4'));var jayson=require(_0x6fe5('0x5'));var client=jayson[_0x6fe5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b77b1,_0x200633,_0x51c84f){return new BPromise(function(_0x2220b4,_0x510eca){return client[_0x6fe5('0x7')](_0x3b77b1,_0x51c84f)['then'](function(_0x494af7){logger[_0x6fe5('0x8')](_0x6fe5('0x9'),_0x200633,_0x6fe5('0xa'));logger['debug'](_0x6fe5('0xb'),_0x200633,_0x6fe5('0xa'),JSON[_0x6fe5('0xc')](_0x494af7));if(_0x494af7[_0x6fe5('0xd')]){if(_0x494af7['error'][_0x6fe5('0xe')]===0x1f4){logger[_0x6fe5('0xd')](_0x6fe5('0x9'),_0x200633,_0x494af7[_0x6fe5('0xd')]['message']);return _0x510eca(_0x494af7[_0x6fe5('0xd')]['message']);}logger[_0x6fe5('0xd')](_0x6fe5('0x9'),_0x200633,_0x494af7[_0x6fe5('0xd')][_0x6fe5('0xf')]);return _0x2220b4(_0x494af7[_0x6fe5('0xd')][_0x6fe5('0xf')]);}else{logger[_0x6fe5('0x8')](_0x6fe5('0x9'),_0x200633,'request\x20sent');_0x2220b4(_0x494af7[_0x6fe5('0x10')][_0x6fe5('0xf')]);}})[_0x6fe5('0x11')](function(_0x3de2f5){logger[_0x6fe5('0xd')]('Automation,\x20%s,\x20%s',_0x200633,_0x3de2f5);_0x510eca(_0x3de2f5);});});}