Built motion from commit (unavailable).|2.5.19
[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 _0x0a1b=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x17b76b,_0x56690b){var _0x5f137c=function(_0x579afe){while(--_0x579afe){_0x17b76b['push'](_0x17b76b['shift']());}};_0x5f137c(++_0x56690b);}(_0x0a1b,0xe0));var _0xb0a1=function(_0x49e761,_0x367670){_0x49e761=_0x49e761-0x0;var _0x417bf0=_0x0a1b[_0x49e761];return _0x417bf0;};'use strict';var _=require('lodash');var util=require(_0xb0a1('0x0'));var moment=require(_0xb0a1('0x1'));var BPromise=require(_0xb0a1('0x2'));var rs=require(_0xb0a1('0x3'));var fs=require('fs');var Redis=require(_0xb0a1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0a1('0x5'));var logger=require('../../config/logger')(_0xb0a1('0x6'));var config=require(_0xb0a1('0x7'));var jayson=require(_0xb0a1('0x8'));var client=jayson['client'][_0xb0a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fcb97,_0x464acb,_0x51f4b8){return new BPromise(function(_0x41301a,_0x5e6fdc){return client[_0xb0a1('0xa')](_0x4fcb97,_0x51f4b8)[_0xb0a1('0xb')](function(_0x2897a9){logger[_0xb0a1('0xc')]('Automation,\x20%s,\x20%s',_0x464acb,_0xb0a1('0xd'));logger['debug'](_0xb0a1('0xe'),_0x464acb,_0xb0a1('0xd'),JSON[_0xb0a1('0xf')](_0x2897a9));if(_0x2897a9['error']){if(_0x2897a9['error']['code']===0x1f4){logger[_0xb0a1('0x10')](_0xb0a1('0x11'),_0x464acb,_0x2897a9[_0xb0a1('0x10')][_0xb0a1('0x12')]);return _0x5e6fdc(_0x2897a9[_0xb0a1('0x10')][_0xb0a1('0x12')]);}logger[_0xb0a1('0x10')](_0xb0a1('0x11'),_0x464acb,_0x2897a9[_0xb0a1('0x10')][_0xb0a1('0x12')]);return _0x41301a(_0x2897a9[_0xb0a1('0x10')][_0xb0a1('0x12')]);}else{logger[_0xb0a1('0xc')](_0xb0a1('0x11'),_0x464acb,_0xb0a1('0xd'));_0x41301a(_0x2897a9[_0xb0a1('0x13')][_0xb0a1('0x12')]);}})[_0xb0a1('0x14')](function(_0x3f60e3){logger[_0xb0a1('0x10')]('Automation,\x20%s,\x20%s',_0x464acb,_0x3f60e3);_0x5e6fdc(_0x3f60e3);});});}