b43744f0cc0f9cf52b7c87b39672cd6a4aa1d238
[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 _0xa0f4=['then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e3da6,_0x1a27bb){var _0x596897=function(_0x1073e5){while(--_0x1073e5){_0x5e3da6['push'](_0x5e3da6['shift']());}};_0x596897(++_0x1a27bb);}(_0xa0f4,0x15f));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a0f('0x0'));var util=require('util');var moment=require(_0x4a0f('0x1'));var BPromise=require(_0x4a0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a0f('0x3'));var db=require(_0x4a0f('0x4'))['db'];var utils=require(_0x4a0f('0x5'));var logger=require(_0x4a0f('0x6'))(_0x4a0f('0x7'));var config=require(_0x4a0f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3da9,_0x5643fa,_0x1ec602){return new BPromise(function(_0x516d48,_0x2a8658){return client['request'](_0x3c3da9,_0x1ec602)[_0x4a0f('0x9')](function(_0x5e9140){logger['info'](_0x4a0f('0xa'),_0x5643fa,_0x4a0f('0xb'));logger['debug'](_0x4a0f('0xc'),_0x5643fa,'request\x20sent',JSON[_0x4a0f('0xd')](_0x5e9140));if(_0x5e9140['error']){if(_0x5e9140[_0x4a0f('0xe')][_0x4a0f('0xf')]===0x1f4){logger[_0x4a0f('0xe')](_0x4a0f('0xa'),_0x5643fa,_0x5e9140['error'][_0x4a0f('0x10')]);return _0x2a8658(_0x5e9140[_0x4a0f('0xe')][_0x4a0f('0x10')]);}logger[_0x4a0f('0xe')]('Automation,\x20%s,\x20%s',_0x5643fa,_0x5e9140[_0x4a0f('0xe')]['message']);return _0x516d48(_0x5e9140[_0x4a0f('0xe')][_0x4a0f('0x10')]);}else{logger[_0x4a0f('0x11')]('Automation,\x20%s,\x20%s',_0x5643fa,_0x4a0f('0xb'));_0x516d48(_0x5e9140[_0x4a0f('0x12')][_0x4a0f('0x10')]);}})[_0x4a0f('0x13')](function(_0x551b2d){logger[_0x4a0f('0xe')](_0x4a0f('0xa'),_0x5643fa,_0x551b2d);_0x2a8658(_0x551b2d);});});}