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 _0x3f45=['message','Automation,\x20%s,\x20%s','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1b660b,_0xccf3bc){var _0x42d2d7=function(_0x10ed91){while(--_0x10ed91){_0x1b660b['push'](_0x1b660b['shift']());}};_0x42d2d7(++_0xccf3bc);}(_0x3f45,0x115));var _0x53f4=function(_0x59008b,_0x75ea97){_0x59008b=_0x59008b-0x0;var _0x20359c=_0x3f45[_0x59008b];return _0x20359c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x53f4('0x0'));var rs=require(_0x53f4('0x1'));var fs=require('fs');var Redis=require(_0x53f4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x53f4('0x3'));var logger=require(_0x53f4('0x4'))(_0x53f4('0x5'));var config=require('../../config/environment');var jayson=require(_0x53f4('0x6'));var client=jayson[_0x53f4('0x7')][_0x53f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x501d2c,_0x2d0d7b,_0x3968fe){return new BPromise(function(_0x28387b,_0x16e621){return client[_0x53f4('0x9')](_0x501d2c,_0x3968fe)['then'](function(_0x336ad8){logger[_0x53f4('0xa')]('Automation,\x20%s,\x20%s',_0x2d0d7b,_0x53f4('0xb'));logger[_0x53f4('0xc')](_0x53f4('0xd'),_0x2d0d7b,_0x53f4('0xb'),JSON[_0x53f4('0xe')](_0x336ad8));if(_0x336ad8[_0x53f4('0xf')]){if(_0x336ad8[_0x53f4('0xf')][_0x53f4('0x10')]===0x1f4){logger[_0x53f4('0xf')]('Automation,\x20%s,\x20%s',_0x2d0d7b,_0x336ad8[_0x53f4('0xf')][_0x53f4('0x11')]);return _0x16e621(_0x336ad8['error'][_0x53f4('0x11')]);}logger[_0x53f4('0xf')](_0x53f4('0x12'),_0x2d0d7b,_0x336ad8[_0x53f4('0xf')][_0x53f4('0x11')]);return _0x28387b(_0x336ad8[_0x53f4('0xf')]['message']);}else{logger[_0x53f4('0xa')](_0x53f4('0x12'),_0x2d0d7b,_0x53f4('0xb'));_0x28387b(_0x336ad8[_0x53f4('0x13')][_0x53f4('0x11')]);}})[_0x53f4('0x14')](function(_0x3d0d11){logger['error']('Automation,\x20%s,\x20%s',_0x2d0d7b,_0x3d0d11);_0x16e621(_0x3d0d11);});});}