Built motion from commit (unavailable).|2.5.31
[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 _0x9e16=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x8769e0,_0x349138){var _0x3668d3=function(_0x34bbe1){while(--_0x34bbe1){_0x8769e0['push'](_0x8769e0['shift']());}};_0x3668d3(++_0x349138);}(_0x9e16,0x19b));var _0x69e1=function(_0x255e94,_0x1fd934){_0x255e94=_0x255e94-0x0;var _0x4d45c7=_0x9e16[_0x255e94];return _0x4d45c7;};'use strict';var _=require(_0x69e1('0x0'));var util=require(_0x69e1('0x1'));var moment=require(_0x69e1('0x2'));var BPromise=require(_0x69e1('0x3'));var rs=require(_0x69e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69e1('0x5'))(_0x69e1('0x6'));var config=require(_0x69e1('0x7'));var jayson=require(_0x69e1('0x8'));var client=jayson[_0x69e1('0x9')][_0x69e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x472f65,_0x3b5062,_0x2410be){return new BPromise(function(_0x1c27da,_0xf6a7a1){return client[_0x69e1('0xb')](_0x472f65,_0x2410be)[_0x69e1('0xc')](function(_0x5ef11f){logger[_0x69e1('0xd')](_0x69e1('0xe'),_0x3b5062,_0x69e1('0xf'));logger[_0x69e1('0x10')](_0x69e1('0x11'),_0x3b5062,_0x69e1('0xf'),JSON[_0x69e1('0x12')](_0x5ef11f));if(_0x5ef11f[_0x69e1('0x13')]){if(_0x5ef11f[_0x69e1('0x13')]['code']===0x1f4){logger[_0x69e1('0x13')](_0x69e1('0xe'),_0x3b5062,_0x5ef11f[_0x69e1('0x13')][_0x69e1('0x14')]);return _0xf6a7a1(_0x5ef11f[_0x69e1('0x13')][_0x69e1('0x14')]);}logger[_0x69e1('0x13')](_0x69e1('0xe'),_0x3b5062,_0x5ef11f['error'][_0x69e1('0x14')]);return _0x1c27da(_0x5ef11f[_0x69e1('0x13')][_0x69e1('0x14')]);}else{logger[_0x69e1('0xd')](_0x69e1('0xe'),_0x3b5062,'request\x20sent');_0x1c27da(_0x5ef11f[_0x69e1('0x15')][_0x69e1('0x14')]);}})[_0x69e1('0x16')](function(_0x3bbf61){logger[_0x69e1('0x13')]('Automation,\x20%s,\x20%s',_0x3b5062,_0x3bbf61);_0xf6a7a1(_0x3bbf61);});});}