cb2655b6b86b800d315b2ed9911fe4627debe38d
[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 _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xd18d4f,_0x7e0a8){var _0x5e8d05=function(_0x459416){while(--_0x459416){_0xd18d4f['push'](_0xd18d4f['shift']());}};_0x5e8d05(++_0x7e0a8);}(_0xa3fe,0xd8));var _0xea3f=function(_0x489e5a,_0x30e893){_0x489e5a=_0x489e5a-0x0;var _0x4997a3=_0xa3fe[_0x489e5a];return _0x4997a3;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e494,_0x56abd6,_0x187ce0){return new BPromise(function(_0x35ba50,_0x3c4807){return client['request'](_0x49e494,_0x187ce0)['then'](function(_0x464ad4){logger['info']('Automation,\x20%s,\x20%s',_0x56abd6,_0xea3f('0xa'));logger[_0xea3f('0xb')](_0xea3f('0xc'),_0x56abd6,'request\x20sent',JSON['stringify'](_0x464ad4));if(_0x464ad4['error']){if(_0x464ad4[_0xea3f('0xd')][_0xea3f('0xe')]===0x1f4){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x464ad4['error']['message']);return _0x3c4807(_0x464ad4['error'][_0xea3f('0x10')]);}logger[_0xea3f('0xd')]('Automation,\x20%s,\x20%s',_0x56abd6,_0x464ad4[_0xea3f('0xd')][_0xea3f('0x10')]);return _0x35ba50(_0x464ad4['error'][_0xea3f('0x10')]);}else{logger[_0xea3f('0x11')](_0xea3f('0xf'),_0x56abd6,_0xea3f('0xa'));_0x35ba50(_0x464ad4[_0xea3f('0x12')][_0xea3f('0x10')]);}})[_0xea3f('0x13')](function(_0x2585f1){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x2585f1);_0x3c4807(_0x2585f1);});});}