Built motion from commit (unavailable).|2.5.2
[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 _0xbf4b=['../../config/logger','rpc','../../config/environment','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e4934,_0x41fa5c){var _0x335f9e=function(_0x23f081){while(--_0x23f081){_0x4e4934['push'](_0x4e4934['shift']());}};_0x335f9e(++_0x41fa5c);}(_0xbf4b,0x99));var _0xbbf4=function(_0x129422,_0x4af03c){_0x129422=_0x129422-0x0;var _0x3f7f3a=_0xbf4b[_0x129422];return _0x3f7f3a;};'use strict';var _=require(_0xbbf4('0x0'));var util=require(_0xbbf4('0x1'));var moment=require('moment');var BPromise=require(_0xbbf4('0x2'));var rs=require(_0xbbf4('0x3'));var fs=require('fs');var Redis=require(_0xbbf4('0x4'));var db=require(_0xbbf4('0x5'))['db'];var utils=require(_0xbbf4('0x6'));var logger=require(_0xbbf4('0x7'))(_0xbbf4('0x8'));var config=require(_0xbbf4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbbf4('0xa')][_0xbbf4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf579b,_0x2acef4,_0x379880){return new BPromise(function(_0x4e5728,_0xccb54d){return client[_0xbbf4('0xc')](_0xf579b,_0x379880)['then'](function(_0x5c2583){logger[_0xbbf4('0xd')](_0xbbf4('0xe'),_0x2acef4,_0xbbf4('0xf'));logger['debug'](_0xbbf4('0x10'),_0x2acef4,_0xbbf4('0xf'),JSON['stringify'](_0x5c2583));if(_0x5c2583[_0xbbf4('0x11')]){if(_0x5c2583['error']['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x2acef4,_0x5c2583[_0xbbf4('0x11')]['message']);return _0xccb54d(_0x5c2583[_0xbbf4('0x11')][_0xbbf4('0x12')]);}logger['error'](_0xbbf4('0xe'),_0x2acef4,_0x5c2583[_0xbbf4('0x11')][_0xbbf4('0x12')]);return _0x4e5728(_0x5c2583[_0xbbf4('0x11')][_0xbbf4('0x12')]);}else{logger[_0xbbf4('0xd')](_0xbbf4('0xe'),_0x2acef4,'request\x20sent');_0x4e5728(_0x5c2583[_0xbbf4('0x13')][_0xbbf4('0x12')]);}})['catch'](function(_0x28e77b){logger['error'](_0xbbf4('0xe'),_0x2acef4,_0x28e77b);_0xccb54d(_0x28e77b);});});}