Built motion from commit (unavailable).|2.5.4
[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 _0x2dc6=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x254a19,_0x7b092b){var _0xba020a=function(_0x231bb3){while(--_0x231bb3){_0x254a19['push'](_0x254a19['shift']());}};_0xba020a(++_0x7b092b);}(_0x2dc6,0x173));var _0x62dc=function(_0x4a3b17,_0x48aebd){_0x4a3b17=_0x4a3b17-0x0;var _0x1b39a3=_0x2dc6[_0x4a3b17];return _0x1b39a3;};'use strict';var _=require(_0x62dc('0x0'));var util=require(_0x62dc('0x1'));var moment=require('moment');var BPromise=require(_0x62dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62dc('0x3'))['db'];var utils=require(_0x62dc('0x4'));var logger=require('../../config/logger')(_0x62dc('0x5'));var config=require(_0x62dc('0x6'));var jayson=require(_0x62dc('0x7'));var client=jayson[_0x62dc('0x8')][_0x62dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13dae3,_0x5aa9ea,_0x16a01d){return new BPromise(function(_0x31b938,_0x528dc1){return client[_0x62dc('0xa')](_0x13dae3,_0x16a01d)[_0x62dc('0xb')](function(_0x31f02c){logger[_0x62dc('0xc')]('Automation,\x20%s,\x20%s',_0x5aa9ea,_0x62dc('0xd'));logger[_0x62dc('0xe')](_0x62dc('0xf'),_0x5aa9ea,_0x62dc('0xd'),JSON[_0x62dc('0x10')](_0x31f02c));if(_0x31f02c[_0x62dc('0x11')]){if(_0x31f02c[_0x62dc('0x11')]['code']===0x1f4){logger['error'](_0x62dc('0x12'),_0x5aa9ea,_0x31f02c['error'][_0x62dc('0x13')]);return _0x528dc1(_0x31f02c[_0x62dc('0x11')][_0x62dc('0x13')]);}logger['error'](_0x62dc('0x12'),_0x5aa9ea,_0x31f02c[_0x62dc('0x11')][_0x62dc('0x13')]);return _0x31b938(_0x31f02c[_0x62dc('0x11')][_0x62dc('0x13')]);}else{logger[_0x62dc('0xc')]('Automation,\x20%s,\x20%s',_0x5aa9ea,_0x62dc('0xd'));_0x31b938(_0x31f02c[_0x62dc('0x14')][_0x62dc('0x13')]);}})['catch'](function(_0x4412ad){logger[_0x62dc('0x11')](_0x62dc('0x12'),_0x5aa9ea,_0x4412ad);_0x528dc1(_0x4412ad);});});}