Built motion from commit (unavailable).|2.5.13
[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 _0x84ff=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x107e10,_0x532fde){var _0x4be009=function(_0x57965b){while(--_0x57965b){_0x107e10['push'](_0x107e10['shift']());}};_0x4be009(++_0x532fde);}(_0x84ff,0x156));var _0xf84f=function(_0x56fa5a,_0x3ecbe9){_0x56fa5a=_0x56fa5a-0x0;var _0x445b01=_0x84ff[_0x56fa5a];return _0x445b01;};'use strict';var _=require('lodash');var util=require(_0xf84f('0x0'));var moment=require('moment');var BPromise=require(_0xf84f('0x1'));var rs=require(_0xf84f('0x2'));var fs=require('fs');var Redis=require(_0xf84f('0x3'));var db=require(_0xf84f('0x4'))['db'];var utils=require(_0xf84f('0x5'));var logger=require(_0xf84f('0x6'))('rpc');var config=require(_0xf84f('0x7'));var jayson=require(_0xf84f('0x8'));var client=jayson[_0xf84f('0x9')][_0xf84f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4157e0,_0x3963cf,_0x12a96b){return new BPromise(function(_0x5c3e66,_0x5b0a1e){return client[_0xf84f('0xb')](_0x4157e0,_0x12a96b)['then'](function(_0x430652){logger[_0xf84f('0xc')](_0xf84f('0xd'),_0x3963cf,'request\x20sent');logger[_0xf84f('0xe')](_0xf84f('0xf'),_0x3963cf,_0xf84f('0x10'),JSON[_0xf84f('0x11')](_0x430652));if(_0x430652[_0xf84f('0x12')]){if(_0x430652[_0xf84f('0x12')][_0xf84f('0x13')]===0x1f4){logger[_0xf84f('0x12')](_0xf84f('0xd'),_0x3963cf,_0x430652['error'][_0xf84f('0x14')]);return _0x5b0a1e(_0x430652['error'][_0xf84f('0x14')]);}logger[_0xf84f('0x12')](_0xf84f('0xd'),_0x3963cf,_0x430652[_0xf84f('0x12')][_0xf84f('0x14')]);return _0x5c3e66(_0x430652[_0xf84f('0x12')][_0xf84f('0x14')]);}else{logger[_0xf84f('0xc')]('Automation,\x20%s,\x20%s',_0x3963cf,_0xf84f('0x10'));_0x5c3e66(_0x430652[_0xf84f('0x15')][_0xf84f('0x14')]);}})[_0xf84f('0x16')](function(_0x1e45e6){logger['error']('Automation,\x20%s,\x20%s',_0x3963cf,_0x1e45e6);_0x5b0a1e(_0x1e45e6);});});}