Built motion from commit a61a4a20.|2.5.46
[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 _0x5853=['then','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','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5853,0x113));var _0x3585=function(_0x4911ed,_0x476941){_0x4911ed=_0x4911ed-0x0;var _0x230288=_0x5853[_0x4911ed];return _0x230288;};'use strict';var _=require(_0x3585('0x0'));var util=require(_0x3585('0x1'));var moment=require(_0x3585('0x2'));var BPromise=require(_0x3585('0x3'));var rs=require(_0x3585('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3585('0x5'))['db'];var utils=require(_0x3585('0x6'));var logger=require(_0x3585('0x7'))(_0x3585('0x8'));var config=require(_0x3585('0x9'));var jayson=require(_0x3585('0xa'));var client=jayson['client'][_0x3585('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48b3ff,_0x5d8c2d,_0x1a97fd){return new BPromise(function(_0x5e78f3,_0x5910ab){return client[_0x3585('0xc')](_0x48b3ff,_0x1a97fd)[_0x3585('0xd')](function(_0x2febe8){logger[_0x3585('0xe')](_0x3585('0xf'),_0x5d8c2d,_0x3585('0x10'));logger['debug'](_0x3585('0x11'),_0x5d8c2d,_0x3585('0x10'),JSON[_0x3585('0x12')](_0x2febe8));if(_0x2febe8[_0x3585('0x13')]){if(_0x2febe8[_0x3585('0x13')][_0x3585('0x14')]===0x1f4){logger[_0x3585('0x13')]('Automation,\x20%s,\x20%s',_0x5d8c2d,_0x2febe8[_0x3585('0x13')]['message']);return _0x5910ab(_0x2febe8['error']['message']);}logger['error'](_0x3585('0xf'),_0x5d8c2d,_0x2febe8['error'][_0x3585('0x15')]);return _0x5e78f3(_0x2febe8[_0x3585('0x13')]['message']);}else{logger[_0x3585('0xe')](_0x3585('0xf'),_0x5d8c2d,'request\x20sent');_0x5e78f3(_0x2febe8[_0x3585('0x16')][_0x3585('0x15')]);}})[_0x3585('0x17')](function(_0x2beae5){logger[_0x3585('0x13')]('Automation,\x20%s,\x20%s',_0x5d8c2d,_0x2beae5);_0x5910ab(_0x2beae5);});});}