Built motion from commit ab870f9e.|2.5.44
[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 _0x20df=['debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Automation,\x20%s,\x20%s'];(function(_0x3b3047,_0x1800ab){var _0x123ae8=function(_0x30e52d){while(--_0x30e52d){_0x3b3047['push'](_0x3b3047['shift']());}};_0x123ae8(++_0x1800ab);}(_0x20df,0x7c));var _0xf20d=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0x20df[_0x5d61b4];return _0x183fc5;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var moment=require(_0xf20d('0x2'));var BPromise=require(_0xf20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20d('0x4'));var db=require(_0xf20d('0x5'))['db'];var utils=require(_0xf20d('0x6'));var logger=require(_0xf20d('0x7'))(_0xf20d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf20d('0x9'));var client=jayson['client'][_0xf20d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d0da,_0x53a7b5,_0x184c8d){return new BPromise(function(_0x5f0353,_0x4f36d1){return client['request'](_0x41d0da,_0x184c8d)[_0xf20d('0xb')](function(_0x22b427){logger[_0xf20d('0xc')](_0xf20d('0xd'),_0x53a7b5,'request\x20sent');logger[_0xf20d('0xe')](_0xf20d('0xf'),_0x53a7b5,_0xf20d('0x10'),JSON[_0xf20d('0x11')](_0x22b427));if(_0x22b427[_0xf20d('0x12')]){if(_0x22b427[_0xf20d('0x12')][_0xf20d('0x13')]===0x1f4){logger[_0xf20d('0x12')]('Automation,\x20%s,\x20%s',_0x53a7b5,_0x22b427[_0xf20d('0x12')]['message']);return _0x4f36d1(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}logger['error'](_0xf20d('0xd'),_0x53a7b5,_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);return _0x5f0353(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x53a7b5,_0xf20d('0x10'));_0x5f0353(_0x22b427[_0xf20d('0x15')][_0xf20d('0x14')]);}})[_0xf20d('0x16')](function(_0x53c164){logger[_0xf20d('0x12')]('Automation,\x20%s,\x20%s',_0x53a7b5,_0x53c164);_0x4f36d1(_0x53c164);});});}