Built motion from commit 85328c08.|2.5.50
[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 _0x6f18=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x246698,_0x24f600){var _0x34ab93=function(_0x49c5bf){while(--_0x49c5bf){_0x246698['push'](_0x246698['shift']());}};_0x34ab93(++_0x24f600);}(_0x6f18,0x1b4));var _0x86f1=function(_0x496e32,_0x3b3d8a){_0x496e32=_0x496e32-0x0;var _0x282961=_0x6f18[_0x496e32];return _0x282961;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var moment=require(_0x86f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x86f1('0x2'));var fs=require('fs');var Redis=require(_0x86f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86f1('0x4'));var logger=require(_0x86f1('0x5'))('rpc');var config=require(_0x86f1('0x6'));var jayson=require(_0x86f1('0x7'));var client=jayson[_0x86f1('0x8')][_0x86f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x403f48,_0x4c7943,_0x5b0f45){return new BPromise(function(_0x3cc3c5,_0x3223eb){return client[_0x86f1('0xa')](_0x403f48,_0x5b0f45)[_0x86f1('0xb')](function(_0x4f1f6e){logger[_0x86f1('0xc')](_0x86f1('0xd'),_0x4c7943,_0x86f1('0xe'));logger[_0x86f1('0xf')](_0x86f1('0x10'),_0x4c7943,_0x86f1('0xe'),JSON[_0x86f1('0x11')](_0x4f1f6e));if(_0x4f1f6e[_0x86f1('0x12')]){if(_0x4f1f6e['error'][_0x86f1('0x13')]===0x1f4){logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);return _0x3223eb(_0x4f1f6e[_0x86f1('0x12')]['message']);}logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);return _0x3cc3c5(_0x4f1f6e[_0x86f1('0x12')][_0x86f1('0x14')]);}else{logger[_0x86f1('0xc')](_0x86f1('0xd'),_0x4c7943,'request\x20sent');_0x3cc3c5(_0x4f1f6e[_0x86f1('0x15')][_0x86f1('0x14')]);}})[_0x86f1('0x16')](function(_0x4452c4){logger[_0x86f1('0x12')](_0x86f1('0xd'),_0x4c7943,_0x4452c4);_0x3223eb(_0x4452c4);});});}