Built motion from commit (unavailable).|2.5.14
[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 _0xefca=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch'];(function(_0x233d92,_0x2b3694){var _0x33e488=function(_0x3e492f){while(--_0x3e492f){_0x233d92['push'](_0x233d92['shift']());}};_0x33e488(++_0x2b3694);}(_0xefca,0xe7));var _0xaefc=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xefca[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require(_0xaefc('0x0'));var moment=require(_0xaefc('0x1'));var BPromise=require(_0xaefc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaefc('0x3'));var db=require(_0xaefc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaefc('0x5'))(_0xaefc('0x6'));var config=require(_0xaefc('0x7'));var jayson=require(_0xaefc('0x8'));var client=jayson[_0xaefc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590411,_0x50dc09,_0x4b0c33){return new BPromise(function(_0x1013cb,_0x50c0fd){return client[_0xaefc('0xa')](_0x590411,_0x4b0c33)[_0xaefc('0xb')](function(_0x351a34){logger[_0xaefc('0xc')]('Automation,\x20%s,\x20%s',_0x50dc09,_0xaefc('0xd'));logger['debug'](_0xaefc('0xe'),_0x50dc09,_0xaefc('0xd'),JSON['stringify'](_0x351a34));if(_0x351a34[_0xaefc('0xf')]){if(_0x351a34[_0xaefc('0xf')][_0xaefc('0x10')]===0x1f4){logger['error'](_0xaefc('0x11'),_0x50dc09,_0x351a34[_0xaefc('0xf')][_0xaefc('0x12')]);return _0x50c0fd(_0x351a34['error'][_0xaefc('0x12')]);}logger['error'](_0xaefc('0x11'),_0x50dc09,_0x351a34[_0xaefc('0xf')][_0xaefc('0x12')]);return _0x1013cb(_0x351a34['error']['message']);}else{logger[_0xaefc('0xc')]('Automation,\x20%s,\x20%s',_0x50dc09,_0xaefc('0xd'));_0x1013cb(_0x351a34[_0xaefc('0x13')][_0xaefc('0x12')]);}})[_0xaefc('0x14')](function(_0x4671f5){logger[_0xaefc('0xf')]('Automation,\x20%s,\x20%s',_0x50dc09,_0x4671f5);_0x50c0fd(_0x4671f5);});});}