Built motion from commit (unavailable).|2.5.16
[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 _0x8e09=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x8e09,0xf2));var _0x98e0=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x8e09[_0x34021d];return _0x16597b;};'use strict';var _=require('lodash');var util=require(_0x98e0('0x0'));var moment=require(_0x98e0('0x1'));var BPromise=require(_0x98e0('0x2'));var rs=require(_0x98e0('0x3'));var fs=require('fs');var Redis=require(_0x98e0('0x4'));var db=require(_0x98e0('0x5'))['db'];var utils=require(_0x98e0('0x6'));var logger=require(_0x98e0('0x7'))('rpc');var config=require(_0x98e0('0x8'));var jayson=require(_0x98e0('0x9'));var client=jayson[_0x98e0('0xa')][_0x98e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x501f58,_0x17bda8,_0x413af9){return new BPromise(function(_0x4fabae,_0x42dff0){return client[_0x98e0('0xc')](_0x501f58,_0x413af9)[_0x98e0('0xd')](function(_0x4d2c55){logger[_0x98e0('0xe')](_0x98e0('0xf'),_0x17bda8,_0x98e0('0x10'));logger[_0x98e0('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x17bda8,'request\x20sent',JSON[_0x98e0('0x12')](_0x4d2c55));if(_0x4d2c55[_0x98e0('0x13')]){if(_0x4d2c55['error'][_0x98e0('0x14')]===0x1f4){logger['error'](_0x98e0('0xf'),_0x17bda8,_0x4d2c55[_0x98e0('0x13')][_0x98e0('0x15')]);return _0x42dff0(_0x4d2c55[_0x98e0('0x13')][_0x98e0('0x15')]);}logger[_0x98e0('0x13')](_0x98e0('0xf'),_0x17bda8,_0x4d2c55[_0x98e0('0x13')][_0x98e0('0x15')]);return _0x4fabae(_0x4d2c55[_0x98e0('0x13')][_0x98e0('0x15')]);}else{logger[_0x98e0('0xe')](_0x98e0('0xf'),_0x17bda8,_0x98e0('0x10'));_0x4fabae(_0x4d2c55['result']['message']);}})[_0x98e0('0x16')](function(_0x2b033b){logger[_0x98e0('0x13')](_0x98e0('0xf'),_0x17bda8,_0x2b033b);_0x42dff0(_0x2b033b);});});}