Built motion from commit (unavailable).|2.5.27
[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 _0xe397=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../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'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe397,0xac));var _0x7e39=function(_0x14647d,_0x20a244){_0x14647d=_0x14647d-0x0;var _0x3a0cae=_0xe397[_0x14647d];return _0x3a0cae;};'use strict';var _=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var moment=require(_0x7e39('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e39('0x3'));var fs=require('fs');var Redis=require(_0x7e39('0x4'));var db=require(_0x7e39('0x5'))['db'];var utils=require(_0x7e39('0x6'));var logger=require(_0x7e39('0x7'))(_0x7e39('0x8'));var config=require('../../config/environment');var jayson=require(_0x7e39('0x9'));var client=jayson['client'][_0x7e39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ccef,_0x34400b,_0x51bc8d){return new BPromise(function(_0x1262fe,_0x535d37){return client[_0x7e39('0xb')](_0x28ccef,_0x51bc8d)[_0x7e39('0xc')](function(_0x4450ec){logger[_0x7e39('0xd')](_0x7e39('0xe'),_0x34400b,_0x7e39('0xf'));logger[_0x7e39('0x10')](_0x7e39('0x11'),_0x34400b,'request\x20sent',JSON[_0x7e39('0x12')](_0x4450ec));if(_0x4450ec[_0x7e39('0x13')]){if(_0x4450ec[_0x7e39('0x13')][_0x7e39('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x34400b,_0x4450ec['error'][_0x7e39('0x15')]);return _0x535d37(_0x4450ec['error'][_0x7e39('0x15')]);}logger['error'](_0x7e39('0xe'),_0x34400b,_0x4450ec['error'][_0x7e39('0x15')]);return _0x1262fe(_0x4450ec[_0x7e39('0x13')][_0x7e39('0x15')]);}else{logger[_0x7e39('0xd')](_0x7e39('0xe'),_0x34400b,'request\x20sent');_0x1262fe(_0x4450ec[_0x7e39('0x16')][_0x7e39('0x15')]);}})[_0x7e39('0x17')](function(_0x577f1a){logger[_0x7e39('0x13')](_0x7e39('0xe'),_0x34400b,_0x577f1a);_0x535d37(_0x577f1a);});});}