Built motion from commit 1fa89557.|2.6.10
[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 _0x5f7b=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x27dac2,_0x82c3eb){var _0x436264=function(_0x30b0b7){while(--_0x30b0b7){_0x27dac2['push'](_0x27dac2['shift']());}};_0x436264(++_0x82c3eb);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5f7b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var moment=require('moment');var BPromise=require(_0xb5f7('0x2'));var rs=require(_0xb5f7('0x3'));var fs=require('fs');var Redis=require(_0xb5f7('0x4'));var db=require(_0xb5f7('0x5'))['db'];var utils=require(_0xb5f7('0x6'));var logger=require(_0xb5f7('0x7'))(_0xb5f7('0x8'));var config=require('../../config/environment');var jayson=require(_0xb5f7('0x9'));var client=jayson['client'][_0xb5f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x725cc9,_0x580816,_0x3087a5){return new BPromise(function(_0x2d49ba,_0x4e09dd){return client[_0xb5f7('0xb')](_0x725cc9,_0x3087a5)[_0xb5f7('0xc')](function(_0x1b04ee){logger[_0xb5f7('0xd')](_0xb5f7('0xe'),_0x580816,_0xb5f7('0xf'));logger[_0xb5f7('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x580816,_0xb5f7('0xf'),JSON['stringify'](_0x1b04ee));if(_0x1b04ee['error']){if(_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x12')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x580816,_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);return _0x4e09dd(_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);}logger[_0xb5f7('0x11')]('Automation,\x20%s,\x20%s',_0x580816,_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);return _0x2d49ba(_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);}else{logger[_0xb5f7('0xd')](_0xb5f7('0xe'),_0x580816,'request\x20sent');_0x2d49ba(_0x1b04ee[_0xb5f7('0x14')][_0xb5f7('0x13')]);}})['catch'](function(_0x45e8c2){logger[_0xb5f7('0x11')]('Automation,\x20%s,\x20%s',_0x580816,_0x45e8c2);_0x4e09dd(_0x45e8c2);});});}