Built motion from commit da24aabd.|2.6.20
[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 _0xf954=['error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x335c07,_0x6e82f2){var _0x24ddf0=function(_0x5b08c1){while(--_0x5b08c1){_0x335c07['push'](_0x335c07['shift']());}};_0x24ddf0(++_0x6e82f2);}(_0xf954,0x10e));var _0x4f95=function(_0x33cb97,_0x2be8e8){_0x33cb97=_0x33cb97-0x0;var _0xe85595=_0xf954[_0x33cb97];return _0xe85595;};'use strict';var _=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var moment=require(_0x4f95('0x2'));var BPromise=require(_0x4f95('0x3'));var rs=require(_0x4f95('0x4'));var fs=require('fs');var Redis=require(_0x4f95('0x5'));var db=require(_0x4f95('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f95('0x7'));var config=require(_0x4f95('0x8'));var jayson=require(_0x4f95('0x9'));var client=jayson[_0x4f95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d6129,_0x414fb1,_0x2b4724){return new BPromise(function(_0x3f8c9a,_0x4a61f7){return client['request'](_0x9d6129,_0x2b4724)[_0x4f95('0xb')](function(_0x22ecb1){logger[_0x4f95('0xc')]('Automation,\x20%s,\x20%s',_0x414fb1,'request\x20sent');logger['debug'](_0x4f95('0xd'),_0x414fb1,_0x4f95('0xe'),JSON[_0x4f95('0xf')](_0x22ecb1));if(_0x22ecb1[_0x4f95('0x10')]){if(_0x22ecb1['error'][_0x4f95('0x11')]===0x1f4){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);return _0x4a61f7(_0x22ecb1['error'][_0x4f95('0x13')]);}logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')]['message']);return _0x3f8c9a(_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);}else{logger[_0x4f95('0xc')]('Automation,\x20%s,\x20%s',_0x414fb1,_0x4f95('0xe'));_0x3f8c9a(_0x22ecb1[_0x4f95('0x14')][_0x4f95('0x13')]);}})[_0x4f95('0x15')](function(_0x3ea415){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x3ea415);_0x4a61f7(_0x3ea415);});});}