Built motion from commit (unavailable).|2.4.18
[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 _0x4226=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x2c9197,_0x37f2f2){var _0x3eed29=function(_0x42aef1){while(--_0x42aef1){_0x2c9197['push'](_0x2c9197['shift']());}};_0x3eed29(++_0x37f2f2);}(_0x4226,0x1dc));var _0x6422=function(_0x2d7dc5,_0x50877f){_0x2d7dc5=_0x2d7dc5-0x0;var _0x231489=_0x4226[_0x2d7dc5];return _0x231489;};'use strict';var _=require('lodash');var util=require(_0x6422('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6422('0x1'));var db=require(_0x6422('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6422('0x3'))(_0x6422('0x4'));var config=require(_0x6422('0x5'));var jayson=require(_0x6422('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2450,_0x1eb320,_0x5b6c6d){return new BPromise(function(_0x304998,_0xd422a2){return client['request'](_0x5a2450,_0x5b6c6d)[_0x6422('0x7')](function(_0x452be6){logger['info'](_0x6422('0x8'),_0x1eb320,_0x6422('0x9'));logger[_0x6422('0xa')](_0x6422('0xb'),_0x1eb320,_0x6422('0x9'),JSON[_0x6422('0xc')](_0x452be6));if(_0x452be6[_0x6422('0xd')]){if(_0x452be6[_0x6422('0xd')]['code']===0x1f4){logger[_0x6422('0xd')](_0x6422('0x8'),_0x1eb320,_0x452be6['error']['message']);return _0xd422a2(_0x452be6[_0x6422('0xd')][_0x6422('0xe')]);}logger['error'](_0x6422('0x8'),_0x1eb320,_0x452be6['error'][_0x6422('0xe')]);return _0x304998(_0x452be6[_0x6422('0xd')][_0x6422('0xe')]);}else{logger[_0x6422('0xf')]('Automation,\x20%s,\x20%s',_0x1eb320,_0x6422('0x9'));_0x304998(_0x452be6[_0x6422('0x10')][_0x6422('0xe')]);}})[_0x6422('0x11')](function(_0x5a05f5){logger[_0x6422('0xd')]('Automation,\x20%s,\x20%s',_0x1eb320,_0x5a05f5);_0xd422a2(_0x5a05f5);});});}