Built motion from commit 25580385.|2.6.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 _0x556a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2a7d88,_0x655229){var _0x26a5bb=function(_0x1f96e1){while(--_0x1f96e1){_0x2a7d88['push'](_0x2a7d88['shift']());}};_0x26a5bb(++_0x655229);}(_0x556a,0x1dd));var _0xa556=function(_0x45e83a,_0x430070){_0x45e83a=_0x45e83a-0x0;var _0x2e46e9=_0x556a[_0x45e83a];return _0x2e46e9;};'use strict';var _=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var moment=require(_0xa556('0x2'));var BPromise=require(_0xa556('0x3'));var rs=require(_0xa556('0x4'));var fs=require('fs');var Redis=require(_0xa556('0x5'));var db=require(_0xa556('0x6'))['db'];var utils=require(_0xa556('0x7'));var logger=require(_0xa556('0x8'))('rpc');var config=require(_0xa556('0x9'));var jayson=require(_0xa556('0xa'));var client=jayson[_0xa556('0xb')][_0xa556('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x358b8c,_0x5a745c,_0x2c9a0c){return new BPromise(function(_0x644538,_0x17c2c2){return client[_0xa556('0xd')](_0x358b8c,_0x2c9a0c)['then'](function(_0x44ea8e){logger[_0xa556('0xe')](_0xa556('0xf'),_0x5a745c,_0xa556('0x10'));logger[_0xa556('0x11')](_0xa556('0x12'),_0x5a745c,_0xa556('0x10'),JSON[_0xa556('0x13')](_0x44ea8e));if(_0x44ea8e['error']){if(_0x44ea8e[_0xa556('0x14')]['code']===0x1f4){logger[_0xa556('0x14')]('Automation,\x20%s,\x20%s',_0x5a745c,_0x44ea8e['error'][_0xa556('0x15')]);return _0x17c2c2(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}logger[_0xa556('0x14')]('Automation,\x20%s,\x20%s',_0x5a745c,_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);return _0x644538(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}else{logger[_0xa556('0xe')]('Automation,\x20%s,\x20%s',_0x5a745c,'request\x20sent');_0x644538(_0x44ea8e[_0xa556('0x16')][_0xa556('0x15')]);}})['catch'](function(_0x3f8bd7){logger['error']('Automation,\x20%s,\x20%s',_0x5a745c,_0x3f8bd7);_0x17c2c2(_0x3f8bd7);});});}