Built motion from commit (unavailable).|2.5.7
[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 _0xf2b4=['Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xf2b4,0xe5));var _0x4f2b=function(_0x3ef193,_0x55d880){_0x3ef193=_0x3ef193-0x0;var _0x388284=_0xf2b4[_0x3ef193];return _0x388284;};'use strict';var _=require(_0x4f2b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f2b('0x1'));var fs=require('fs');var Redis=require(_0x4f2b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f2b('0x3'));var logger=require(_0x4f2b('0x4'))(_0x4f2b('0x5'));var config=require(_0x4f2b('0x6'));var jayson=require(_0x4f2b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xebc569,_0x3c2f2d,_0x1d6d6f){return new BPromise(function(_0x29f539,_0x2c7c79){return client[_0x4f2b('0x8')](_0xebc569,_0x1d6d6f)[_0x4f2b('0x9')](function(_0x8027da){logger[_0x4f2b('0xa')](_0x4f2b('0xb'),_0x3c2f2d,_0x4f2b('0xc'));logger['debug'](_0x4f2b('0xd'),_0x3c2f2d,_0x4f2b('0xc'),JSON[_0x4f2b('0xe')](_0x8027da));if(_0x8027da[_0x4f2b('0xf')]){if(_0x8027da['error'][_0x4f2b('0x10')]===0x1f4){logger[_0x4f2b('0xf')](_0x4f2b('0xb'),_0x3c2f2d,_0x8027da[_0x4f2b('0xf')][_0x4f2b('0x11')]);return _0x2c7c79(_0x8027da[_0x4f2b('0xf')][_0x4f2b('0x11')]);}logger[_0x4f2b('0xf')](_0x4f2b('0xb'),_0x3c2f2d,_0x8027da[_0x4f2b('0xf')][_0x4f2b('0x11')]);return _0x29f539(_0x8027da['error'][_0x4f2b('0x11')]);}else{logger['info'](_0x4f2b('0xb'),_0x3c2f2d,'request\x20sent');_0x29f539(_0x8027da[_0x4f2b('0x12')][_0x4f2b('0x11')]);}})[_0x4f2b('0x13')](function(_0x2b9537){logger[_0x4f2b('0xf')](_0x4f2b('0xb'),_0x3c2f2d,_0x2b9537);_0x2c7c79(_0x2b9537);});});}