7b003b79407bbc5ddf7de9b028386e367b73289d
[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 _0xde1a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xde1a,0xfd));var _0xade1=function(_0x3897d2,_0x57147f){_0x3897d2=_0x3897d2-0x0;var _0x5ef6ac=_0xde1a[_0x3897d2];return _0x5ef6ac;};'use strict';var _=require('lodash');var util=require(_0xade1('0x0'));var moment=require(_0xade1('0x1'));var BPromise=require(_0xade1('0x2'));var rs=require(_0xade1('0x3'));var fs=require('fs');var Redis=require(_0xade1('0x4'));var db=require(_0xade1('0x5'))['db'];var utils=require(_0xade1('0x6'));var logger=require(_0xade1('0x7'))('rpc');var config=require(_0xade1('0x8'));var jayson=require(_0xade1('0x9'));var client=jayson[_0xade1('0xa')][_0xade1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3be6d5,_0x15e325,_0x5eb992){return new BPromise(function(_0x3a24e7,_0x41d069){return client[_0xade1('0xc')](_0x3be6d5,_0x5eb992)[_0xade1('0xd')](function(_0x120f47){logger[_0xade1('0xe')](_0xade1('0xf'),_0x15e325,_0xade1('0x10'));logger['debug'](_0xade1('0x11'),_0x15e325,_0xade1('0x10'),JSON['stringify'](_0x120f47));if(_0x120f47[_0xade1('0x12')]){if(_0x120f47[_0xade1('0x12')][_0xade1('0x13')]===0x1f4){logger['error'](_0xade1('0xf'),_0x15e325,_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);return _0x41d069(_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);}logger[_0xade1('0x12')]('Automation,\x20%s,\x20%s',_0x15e325,_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);return _0x3a24e7(_0x120f47[_0xade1('0x12')][_0xade1('0x14')]);}else{logger[_0xade1('0xe')]('Automation,\x20%s,\x20%s',_0x15e325,_0xade1('0x10'));_0x3a24e7(_0x120f47[_0xade1('0x15')][_0xade1('0x14')]);}})[_0xade1('0x16')](function(_0x994e75){logger['error'](_0xade1('0xf'),_0x15e325,_0x994e75);_0x41d069(_0x994e75);});});}