cc582314a9c4bcf0cb75becba2c72ac88e07f4fd
[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 _0xd5b1=['error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../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','stringify'];(function(_0x4f983b,_0x93c5f1){var _0x5e5442=function(_0x1a962b){while(--_0x1a962b){_0x4f983b['push'](_0x4f983b['shift']());}};_0x5e5442(++_0x93c5f1);}(_0xd5b1,0x116));var _0x1d5b=function(_0x3f9e98,_0x4320a6){_0x3f9e98=_0x3f9e98-0x0;var _0x248234=_0xd5b1[_0x3f9e98];return _0x248234;};'use strict';var _=require(_0x1d5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1d5b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d5b('0x2'));var db=require(_0x1d5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d5b('0x4'))('rpc');var config=require(_0x1d5b('0x5'));var jayson=require(_0x1d5b('0x6'));var client=jayson[_0x1d5b('0x7')][_0x1d5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1aba5a,_0x29b1c6,_0x4a8370){return new BPromise(function(_0x7c8b0e,_0x23f05a){return client[_0x1d5b('0x9')](_0x1aba5a,_0x4a8370)[_0x1d5b('0xa')](function(_0x32066f){logger[_0x1d5b('0xb')](_0x1d5b('0xc'),_0x29b1c6,_0x1d5b('0xd'));logger['debug'](_0x1d5b('0xe'),_0x29b1c6,'request\x20sent',JSON[_0x1d5b('0xf')](_0x32066f));if(_0x32066f[_0x1d5b('0x10')]){if(_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x11')]===0x1f4){logger[_0x1d5b('0x10')]('Automation,\x20%s,\x20%s',_0x29b1c6,_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x12')]);return _0x23f05a(_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x12')]);}logger[_0x1d5b('0x10')]('Automation,\x20%s,\x20%s',_0x29b1c6,_0x32066f[_0x1d5b('0x10')][_0x1d5b('0x12')]);return _0x7c8b0e(_0x32066f[_0x1d5b('0x10')]['message']);}else{logger[_0x1d5b('0xb')]('Automation,\x20%s,\x20%s',_0x29b1c6,_0x1d5b('0xd'));_0x7c8b0e(_0x32066f[_0x1d5b('0x13')][_0x1d5b('0x12')]);}})[_0x1d5b('0x14')](function(_0x22ff82){logger[_0x1d5b('0x10')]('Automation,\x20%s,\x20%s',_0x29b1c6,_0x22ff82);_0x23f05a(_0x22ff82);});});}