Built motion from commit d1eab355.|2.6.28
[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 _0xc893=['message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xc893,0x194));var _0x3c89=function(_0x404038,_0x425c7d){_0x404038=_0x404038-0x0;var _0x2dd034=_0xc893[_0x404038];return _0x2dd034;};'use strict';var _=require('lodash');var util=require(_0x3c89('0x0'));var moment=require(_0x3c89('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c89('0x2'));var db=require(_0x3c89('0x3'))['db'];var utils=require(_0x3c89('0x4'));var logger=require(_0x3c89('0x5'))(_0x3c89('0x6'));var config=require(_0x3c89('0x7'));var jayson=require(_0x3c89('0x8'));var client=jayson['client'][_0x3c89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0ec4,_0x189b7,_0x37cdcd){return new BPromise(function(_0x524125,_0x251b0c){return client['request'](_0x1a0ec4,_0x37cdcd)['then'](function(_0x3cfe79){logger['info'](_0x3c89('0xa'),_0x189b7,_0x3c89('0xb'));logger['debug'](_0x3c89('0xc'),_0x189b7,_0x3c89('0xb'),JSON[_0x3c89('0xd')](_0x3cfe79));if(_0x3cfe79[_0x3c89('0xe')]){if(_0x3cfe79[_0x3c89('0xe')][_0x3c89('0xf')]===0x1f4){logger[_0x3c89('0xe')](_0x3c89('0xa'),_0x189b7,_0x3cfe79[_0x3c89('0xe')][_0x3c89('0x10')]);return _0x251b0c(_0x3cfe79[_0x3c89('0xe')][_0x3c89('0x10')]);}logger[_0x3c89('0xe')](_0x3c89('0xa'),_0x189b7,_0x3cfe79['error'][_0x3c89('0x10')]);return _0x524125(_0x3cfe79[_0x3c89('0xe')][_0x3c89('0x10')]);}else{logger[_0x3c89('0x11')](_0x3c89('0xa'),_0x189b7,_0x3c89('0xb'));_0x524125(_0x3cfe79[_0x3c89('0x12')][_0x3c89('0x10')]);}})[_0x3c89('0x13')](function(_0x478744){logger[_0x3c89('0xe')]('Automation,\x20%s,\x20%s',_0x189b7,_0x478744);_0x251b0c(_0x478744);});});}