Built motion from commit (unavailable).|2.5.26
[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 _0x579f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird'];(function(_0xef9903,_0x1f6af1){var _0x4db20e=function(_0x5d9ce9){while(--_0x5d9ce9){_0xef9903['push'](_0xef9903['shift']());}};_0x4db20e(++_0x1f6af1);}(_0x579f,0x14d));var _0xf579=function(_0x37b4c9,_0x24e0b9){_0x37b4c9=_0x37b4c9-0x0;var _0x1409f1=_0x579f[_0x37b4c9];return _0x1409f1;};'use strict';var _=require(_0xf579('0x0'));var util=require(_0xf579('0x1'));var moment=require('moment');var BPromise=require(_0xf579('0x2'));var rs=require(_0xf579('0x3'));var fs=require('fs');var Redis=require(_0xf579('0x4'));var db=require(_0xf579('0x5'))['db'];var utils=require(_0xf579('0x6'));var logger=require(_0xf579('0x7'))(_0xf579('0x8'));var config=require(_0xf579('0x9'));var jayson=require(_0xf579('0xa'));var client=jayson[_0xf579('0xb')][_0xf579('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21fc96,_0xba7a9e,_0x506834){return new BPromise(function(_0x232e8f,_0x7845ef){return client[_0xf579('0xd')](_0x21fc96,_0x506834)['then'](function(_0x338a7f){logger['info'](_0xf579('0xe'),_0xba7a9e,_0xf579('0xf'));logger[_0xf579('0x10')](_0xf579('0x11'),_0xba7a9e,_0xf579('0xf'),JSON[_0xf579('0x12')](_0x338a7f));if(_0x338a7f[_0xf579('0x13')]){if(_0x338a7f[_0xf579('0x13')]['code']===0x1f4){logger[_0xf579('0x13')](_0xf579('0xe'),_0xba7a9e,_0x338a7f[_0xf579('0x13')][_0xf579('0x14')]);return _0x7845ef(_0x338a7f['error'][_0xf579('0x14')]);}logger[_0xf579('0x13')]('Automation,\x20%s,\x20%s',_0xba7a9e,_0x338a7f['error']['message']);return _0x232e8f(_0x338a7f[_0xf579('0x13')][_0xf579('0x14')]);}else{logger[_0xf579('0x15')](_0xf579('0xe'),_0xba7a9e,_0xf579('0xf'));_0x232e8f(_0x338a7f[_0xf579('0x16')][_0xf579('0x14')]);}})[_0xf579('0x17')](function(_0x2a3a8a){logger[_0xf579('0x13')]('Automation,\x20%s,\x20%s',_0xba7a9e,_0x2a3a8a);_0x7845ef(_0x2a3a8a);});});}