Built motion from commit (unavailable).|2.5.15
[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 _0x5e04=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x178825,_0x106fa3){var _0x45bf3f=function(_0x1f33fa){while(--_0x1f33fa){_0x178825['push'](_0x178825['shift']());}};_0x45bf3f(++_0x106fa3);}(_0x5e04,0xff));var _0x45e0=function(_0x505df9,_0x14138e){_0x505df9=_0x505df9-0x0;var _0x1cc025=_0x5e04[_0x505df9];return _0x1cc025;};'use strict';var _=require(_0x45e0('0x0'));var util=require(_0x45e0('0x1'));var moment=require(_0x45e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x45e0('0x3'));var fs=require('fs');var Redis=require(_0x45e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x45e0('0x5'));var logger=require('../../config/logger')(_0x45e0('0x6'));var config=require('../../config/environment');var jayson=require(_0x45e0('0x7'));var client=jayson[_0x45e0('0x8')][_0x45e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7328,_0x47dc97,_0x463588){return new BPromise(function(_0x45fdb8,_0x4c9809){return client[_0x45e0('0xa')](_0x3b7328,_0x463588)[_0x45e0('0xb')](function(_0x480ca7){logger[_0x45e0('0xc')](_0x45e0('0xd'),_0x47dc97,_0x45e0('0xe'));logger['debug'](_0x45e0('0xf'),_0x47dc97,_0x45e0('0xe'),JSON[_0x45e0('0x10')](_0x480ca7));if(_0x480ca7[_0x45e0('0x11')]){if(_0x480ca7['error'][_0x45e0('0x12')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x47dc97,_0x480ca7[_0x45e0('0x11')][_0x45e0('0x13')]);return _0x4c9809(_0x480ca7['error'][_0x45e0('0x13')]);}logger['error'](_0x45e0('0xd'),_0x47dc97,_0x480ca7[_0x45e0('0x11')][_0x45e0('0x13')]);return _0x45fdb8(_0x480ca7[_0x45e0('0x11')][_0x45e0('0x13')]);}else{logger[_0x45e0('0xc')](_0x45e0('0xd'),_0x47dc97,_0x45e0('0xe'));_0x45fdb8(_0x480ca7[_0x45e0('0x14')][_0x45e0('0x13')]);}})[_0x45e0('0x15')](function(_0x5171f9){logger[_0x45e0('0x11')](_0x45e0('0xd'),_0x47dc97,_0x5171f9);_0x4c9809(_0x5171f9);});});}