Built motion from commit c0cdc9d8.|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 _0x75b6=['result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d4b69,_0x36e918){var _0x2fde5e=function(_0x1a4e39){while(--_0x1a4e39){_0x3d4b69['push'](_0x3d4b69['shift']());}};_0x2fde5e(++_0x36e918);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x675b('0x1'));var rs=require(_0x675b('0x2'));var fs=require('fs');var Redis=require(_0x675b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x675b('0x4'));var logger=require(_0x675b('0x5'))(_0x675b('0x6'));var config=require('../../config/environment');var jayson=require(_0x675b('0x7'));var client=jayson['client'][_0x675b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7a7a,_0x3f34b8,_0x556239){return new BPromise(function(_0x1bff7d,_0x4f55d4){return client[_0x675b('0x9')](_0x3a7a7a,_0x556239)[_0x675b('0xa')](function(_0x24cf1c){logger[_0x675b('0xb')](_0x675b('0xc'),_0x3f34b8,_0x675b('0xd'));logger[_0x675b('0xe')](_0x675b('0xf'),_0x3f34b8,_0x675b('0xd'),JSON[_0x675b('0x10')](_0x24cf1c));if(_0x24cf1c['error']){if(_0x24cf1c[_0x675b('0x11')][_0x675b('0x12')]===0x1f4){logger[_0x675b('0x11')](_0x675b('0xc'),_0x3f34b8,_0x24cf1c['error']['message']);return _0x4f55d4(_0x24cf1c['error']['message']);}logger['error'](_0x675b('0xc'),_0x3f34b8,_0x24cf1c['error']['message']);return _0x1bff7d(_0x24cf1c[_0x675b('0x11')][_0x675b('0x13')]);}else{logger[_0x675b('0xb')](_0x675b('0xc'),_0x3f34b8,'request\x20sent');_0x1bff7d(_0x24cf1c[_0x675b('0x14')][_0x675b('0x13')]);}})[_0x675b('0x15')](function(_0x17c3fc){logger[_0x675b('0x11')](_0x675b('0xc'),_0x3f34b8,_0x17c3fc);_0x4f55d4(_0x17c3fc);});});}