Built motion from commit (unavailable).|2.5.4
[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 _0xe93b=['client','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x28ffe7,_0x37530c){var _0x4dd6ba=function(_0x1c6a6a){while(--_0x1c6a6a){_0x28ffe7['push'](_0x28ffe7['shift']());}};_0x4dd6ba(++_0x37530c);}(_0xe93b,0x1c2));var _0xbe93=function(_0x13e8e1,_0x36032d){_0x13e8e1=_0x13e8e1-0x0;var _0x507f03=_0xe93b[_0x13e8e1];return _0x507f03;};'use strict';var _=require('lodash');var util=require(_0xbe93('0x0'));var moment=require(_0xbe93('0x1'));var BPromise=require(_0xbe93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe93('0x3'));var db=require(_0xbe93('0x4'))['db'];var utils=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require(_0xbe93('0x9'));var client=jayson[_0xbe93('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d79b4,_0x29bc15,_0x317a09){return new BPromise(function(_0xb5f3bb,_0x3832c0){return client[_0xbe93('0xb')](_0x1d79b4,_0x317a09)[_0xbe93('0xc')](function(_0x3ed10a){logger[_0xbe93('0xd')]('Automation,\x20%s,\x20%s',_0x29bc15,_0xbe93('0xe'));logger[_0xbe93('0xf')](_0xbe93('0x10'),_0x29bc15,_0xbe93('0xe'),JSON[_0xbe93('0x11')](_0x3ed10a));if(_0x3ed10a[_0xbe93('0x12')]){if(_0x3ed10a['error'][_0xbe93('0x13')]===0x1f4){logger[_0xbe93('0x12')](_0xbe93('0x14'),_0x29bc15,_0x3ed10a['error']['message']);return _0x3832c0(_0x3ed10a[_0xbe93('0x12')][_0xbe93('0x15')]);}logger[_0xbe93('0x12')]('Automation,\x20%s,\x20%s',_0x29bc15,_0x3ed10a['error'][_0xbe93('0x15')]);return _0xb5f3bb(_0x3ed10a[_0xbe93('0x12')][_0xbe93('0x15')]);}else{logger[_0xbe93('0xd')](_0xbe93('0x14'),_0x29bc15,_0xbe93('0xe'));_0xb5f3bb(_0x3ed10a['result'][_0xbe93('0x15')]);}})[_0xbe93('0x16')](function(_0x481af3){logger[_0xbe93('0x12')](_0xbe93('0x14'),_0x29bc15,_0x481af3);_0x3832c0(_0x481af3);});});}