Built motion from commit (unavailable).|2.4.17
[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 _0x58f4=['catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result'];(function(_0x3c0a59,_0x2d7c3c){var _0x28c0dd=function(_0x1a5b25){while(--_0x1a5b25){_0x3c0a59['push'](_0x3c0a59['shift']());}};_0x28c0dd(++_0x2d7c3c);}(_0x58f4,0x135));var _0x458f=function(_0x35e939,_0x4f70a1){_0x35e939=_0x35e939-0x0;var _0x2ed6bc=_0x58f4[_0x35e939];return _0x2ed6bc;};'use strict';var _=require('lodash');var util=require(_0x458f('0x0'));var moment=require('moment');var BPromise=require(_0x458f('0x1'));var rs=require(_0x458f('0x2'));var fs=require('fs');var Redis=require(_0x458f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x458f('0x4'));var logger=require(_0x458f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x458f('0x6'));var client=jayson[_0x458f('0x7')][_0x458f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272fb3,_0x211683,_0x23b0d3){return new BPromise(function(_0x140316,_0x9b4a6){return client[_0x458f('0x9')](_0x272fb3,_0x23b0d3)[_0x458f('0xa')](function(_0x4be55f){logger['info'](_0x458f('0xb'),_0x211683,_0x458f('0xc'));logger[_0x458f('0xd')](_0x458f('0xe'),_0x211683,_0x458f('0xc'),JSON[_0x458f('0xf')](_0x4be55f));if(_0x4be55f['error']){if(_0x4be55f['error'][_0x458f('0x10')]===0x1f4){logger['error'](_0x458f('0xb'),_0x211683,_0x4be55f['error'][_0x458f('0x11')]);return _0x9b4a6(_0x4be55f[_0x458f('0x12')][_0x458f('0x11')]);}logger['error'](_0x458f('0xb'),_0x211683,_0x4be55f['error']['message']);return _0x140316(_0x4be55f[_0x458f('0x12')][_0x458f('0x11')]);}else{logger[_0x458f('0x13')](_0x458f('0xb'),_0x211683,_0x458f('0xc'));_0x140316(_0x4be55f[_0x458f('0x14')][_0x458f('0x11')]);}})[_0x458f('0x15')](function(_0xf104bf){logger[_0x458f('0x12')](_0x458f('0xb'),_0x211683,_0xf104bf);_0x9b4a6(_0xf104bf);});});}