Built motion from commit (unavailable).|2.3.5
[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 _0x0f36=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b9007,_0x482404){var _0xfe01e7=function(_0x199ebf){while(--_0x199ebf){_0x3b9007['push'](_0x3b9007['shift']());}};_0xfe01e7(++_0x482404);}(_0x0f36,0x8b));var _0x60f3=function(_0x34559b,_0x42b8ed){_0x34559b=_0x34559b-0x0;var _0x517ca8=_0x0f36[_0x34559b];return _0x517ca8;};'use strict';var _=require(_0x60f3('0x0'));var util=require(_0x60f3('0x1'));var moment=require(_0x60f3('0x2'));var BPromise=require(_0x60f3('0x3'));var rs=require(_0x60f3('0x4'));var fs=require('fs');var Redis=require(_0x60f3('0x5'));var db=require(_0x60f3('0x6'))['db'];var utils=require(_0x60f3('0x7'));var logger=require(_0x60f3('0x8'))(_0x60f3('0x9'));var config=require(_0x60f3('0xa'));var jayson=require(_0x60f3('0xb'));var client=jayson[_0x60f3('0xc')][_0x60f3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xd8fc9d,_0x4b34ee,_0x6b5250){return new BPromise(function(_0x1a4402,_0x4ef52b){return client[_0x60f3('0xe')](_0xd8fc9d,_0x6b5250)[_0x60f3('0xf')](function(_0x3271cb){logger[_0x60f3('0x10')](_0x60f3('0x11'),_0x4b34ee,_0x60f3('0x12'));logger['debug'](_0x60f3('0x13'),_0x4b34ee,_0x60f3('0x12'),JSON[_0x60f3('0x14')](_0x3271cb));if(_0x3271cb[_0x60f3('0x15')]){if(_0x3271cb[_0x60f3('0x15')]['code']===0x1f4){logger[_0x60f3('0x15')](_0x60f3('0x11'),_0x4b34ee,_0x3271cb[_0x60f3('0x15')][_0x60f3('0x16')]);return _0x4ef52b(_0x3271cb[_0x60f3('0x15')]['message']);}logger['error'](_0x60f3('0x11'),_0x4b34ee,_0x3271cb[_0x60f3('0x15')][_0x60f3('0x16')]);return _0x1a4402(_0x3271cb['error'][_0x60f3('0x16')]);}else{logger['info'](_0x60f3('0x11'),_0x4b34ee,_0x60f3('0x12'));_0x1a4402(_0x3271cb[_0x60f3('0x17')][_0x60f3('0x16')]);}})[_0x60f3('0x18')](function(_0x1f4990){logger[_0x60f3('0x15')](_0x60f3('0x11'),_0x4b34ee,_0x1f4990);_0x4ef52b(_0x1f4990);});});}