Built motion from commit (unavailable).|2.5.21
[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 _0xb344=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','moment','bluebird','randomstring','ioredis'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xb344,0x150));var _0x4b34=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xb344[_0x3bfdde];return _0x3f752a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4b34('0x0'));var BPromise=require(_0x4b34('0x1'));var rs=require(_0x4b34('0x2'));var fs=require('fs');var Redis=require(_0x4b34('0x3'));var db=require(_0x4b34('0x4'))['db'];var utils=require(_0x4b34('0x5'));var logger=require(_0x4b34('0x6'))('rpc');var config=require(_0x4b34('0x7'));var jayson=require(_0x4b34('0x8'));var client=jayson[_0x4b34('0x9')][_0x4b34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e953c,_0x1a04a8,_0x51005f){return new BPromise(function(_0x66d348,_0x235d58){return client['request'](_0x5e953c,_0x51005f)['then'](function(_0x5e1c6b){logger[_0x4b34('0xb')](_0x4b34('0xc'),_0x1a04a8,'request\x20sent');logger[_0x4b34('0xd')](_0x4b34('0xe'),_0x1a04a8,_0x4b34('0xf'),JSON[_0x4b34('0x10')](_0x5e1c6b));if(_0x5e1c6b[_0x4b34('0x11')]){if(_0x5e1c6b[_0x4b34('0x11')][_0x4b34('0x12')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x1a04a8,_0x5e1c6b[_0x4b34('0x11')][_0x4b34('0x13')]);return _0x235d58(_0x5e1c6b[_0x4b34('0x11')][_0x4b34('0x13')]);}logger[_0x4b34('0x11')]('Automation,\x20%s,\x20%s',_0x1a04a8,_0x5e1c6b[_0x4b34('0x11')][_0x4b34('0x13')]);return _0x66d348(_0x5e1c6b[_0x4b34('0x11')][_0x4b34('0x13')]);}else{logger[_0x4b34('0xb')](_0x4b34('0xc'),_0x1a04a8,_0x4b34('0xf'));_0x66d348(_0x5e1c6b['result'][_0x4b34('0x13')]);}})['catch'](function(_0x37d60e){logger[_0x4b34('0x11')](_0x4b34('0xc'),_0x1a04a8,_0x37d60e);_0x235d58(_0x37d60e);});});}