Built motion from commit 497d3d92.|2.5.43
[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 _0x566f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b7374,_0x2e869a){var _0x33d85d=function(_0x25c7a4){while(--_0x25c7a4){_0x5b7374['push'](_0x5b7374['shift']());}};_0x33d85d(++_0x2e869a);}(_0x566f,0x124));var _0xf566=function(_0x119f8d,_0x2e792f){_0x119f8d=_0x119f8d-0x0;var _0x10c3f8=_0x566f[_0x119f8d];return _0x10c3f8;};'use strict';var _=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var moment=require(_0xf566('0x2'));var BPromise=require(_0xf566('0x3'));var rs=require(_0xf566('0x4'));var fs=require('fs');var Redis=require(_0xf566('0x5'));var db=require(_0xf566('0x6'))['db'];var utils=require(_0xf566('0x7'));var logger=require('../../config/logger')(_0xf566('0x8'));var config=require(_0xf566('0x9'));var jayson=require(_0xf566('0xa'));var client=jayson[_0xf566('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xacfc48,_0x354e78,_0x3af552){return new BPromise(function(_0x1e33fa,_0x588e82){return client[_0xf566('0xc')](_0xacfc48,_0x3af552)['then'](function(_0x112610){logger[_0xf566('0xd')](_0xf566('0xe'),_0x354e78,_0xf566('0xf'));logger['debug'](_0xf566('0x10'),_0x354e78,_0xf566('0xf'),JSON[_0xf566('0x11')](_0x112610));if(_0x112610[_0xf566('0x12')]){if(_0x112610[_0xf566('0x12')][_0xf566('0x13')]===0x1f4){logger[_0xf566('0x12')](_0xf566('0xe'),_0x354e78,_0x112610['error'][_0xf566('0x14')]);return _0x588e82(_0x112610[_0xf566('0x12')][_0xf566('0x14')]);}logger[_0xf566('0x12')]('Automation,\x20%s,\x20%s',_0x354e78,_0x112610[_0xf566('0x12')]['message']);return _0x1e33fa(_0x112610['error'][_0xf566('0x14')]);}else{logger[_0xf566('0xd')]('Automation,\x20%s,\x20%s',_0x354e78,_0xf566('0xf'));_0x1e33fa(_0x112610[_0xf566('0x15')]['message']);}})[_0xf566('0x16')](function(_0x5e208d){logger[_0xf566('0x12')]('Automation,\x20%s,\x20%s',_0x354e78,_0x5e208d);_0x588e82(_0x5e208d);});});}