Built motion from commit (unavailable).|2.5.23
[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 _0x3e84=['stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x5a14de,_0x4badeb){var _0x291823=function(_0x2714c2){while(--_0x2714c2){_0x5a14de['push'](_0x5a14de['shift']());}};_0x291823(++_0x4badeb);}(_0x3e84,0xaf));var _0x43e8=function(_0x34ea3d,_0x1929e9){_0x34ea3d=_0x34ea3d-0x0;var _0x406193=_0x3e84[_0x34ea3d];return _0x406193;};'use strict';var _=require(_0x43e8('0x0'));var util=require(_0x43e8('0x1'));var moment=require(_0x43e8('0x2'));var BPromise=require(_0x43e8('0x3'));var rs=require(_0x43e8('0x4'));var fs=require('fs');var Redis=require(_0x43e8('0x5'));var db=require(_0x43e8('0x6'))['db'];var utils=require(_0x43e8('0x7'));var logger=require(_0x43e8('0x8'))(_0x43e8('0x9'));var config=require(_0x43e8('0xa'));var jayson=require(_0x43e8('0xb'));var client=jayson['client'][_0x43e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d1b5,_0x49f04e,_0x16bdd7){return new BPromise(function(_0x30667b,_0x10b6d9){return client['request'](_0x41d1b5,_0x16bdd7)[_0x43e8('0xd')](function(_0x3688c0){logger[_0x43e8('0xe')]('Automation,\x20%s,\x20%s',_0x49f04e,_0x43e8('0xf'));logger['debug'](_0x43e8('0x10'),_0x49f04e,_0x43e8('0xf'),JSON[_0x43e8('0x11')](_0x3688c0));if(_0x3688c0[_0x43e8('0x12')]){if(_0x3688c0[_0x43e8('0x12')][_0x43e8('0x13')]===0x1f4){logger[_0x43e8('0x12')]('Automation,\x20%s,\x20%s',_0x49f04e,_0x3688c0['error'][_0x43e8('0x14')]);return _0x10b6d9(_0x3688c0[_0x43e8('0x12')][_0x43e8('0x14')]);}logger[_0x43e8('0x12')](_0x43e8('0x15'),_0x49f04e,_0x3688c0[_0x43e8('0x12')][_0x43e8('0x14')]);return _0x30667b(_0x3688c0[_0x43e8('0x12')][_0x43e8('0x14')]);}else{logger['info'](_0x43e8('0x15'),_0x49f04e,_0x43e8('0xf'));_0x30667b(_0x3688c0[_0x43e8('0x16')][_0x43e8('0x14')]);}})[_0x43e8('0x17')](function(_0xeb1cb0){logger['error'](_0x43e8('0x15'),_0x49f04e,_0xeb1cb0);_0x10b6d9(_0xeb1cb0);});});}