Built motion from commit 9e1399f3.|2.5.37
[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 _0xbecf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x144b9d,_0x6329cc){var _0x3ccfc1=function(_0x7ce284){while(--_0x7ce284){_0x144b9d['push'](_0x144b9d['shift']());}};_0x3ccfc1(++_0x6329cc);}(_0xbecf,0x15c));var _0xfbec=function(_0x2de6f5,_0x1fcd85){_0x2de6f5=_0x2de6f5-0x0;var _0x377e6e=_0xbecf[_0x2de6f5];return _0x377e6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbec('0x0'));var BPromise=require(_0xfbec('0x1'));var rs=require(_0xfbec('0x2'));var fs=require('fs');var Redis=require(_0xfbec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbec('0x4'));var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require(_0xfbec('0x7'));var jayson=require(_0xfbec('0x8'));var client=jayson['client'][_0xfbec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a717,_0x33c701,_0x410cab){return new BPromise(function(_0x43bc5b,_0x312ad1){return client[_0xfbec('0xa')](_0x34a717,_0x410cab)[_0xfbec('0xb')](function(_0x21863f){logger['info']('Automation,\x20%s,\x20%s',_0x33c701,'request\x20sent');logger[_0xfbec('0xc')](_0xfbec('0xd'),_0x33c701,_0xfbec('0xe'),JSON[_0xfbec('0xf')](_0x21863f));if(_0x21863f[_0xfbec('0x10')]){if(_0x21863f['error'][_0xfbec('0x11')]===0x1f4){logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f[_0xfbec('0x10')]['message']);return _0x312ad1(_0x21863f[_0xfbec('0x10')][_0xfbec('0x13')]);}logger[_0xfbec('0x10')](_0xfbec('0x12'),_0x33c701,_0x21863f['error'][_0xfbec('0x13')]);return _0x43bc5b(_0x21863f['error'][_0xfbec('0x13')]);}else{logger['info'](_0xfbec('0x12'),_0x33c701,_0xfbec('0xe'));_0x43bc5b(_0x21863f[_0xfbec('0x14')]['message']);}})[_0xfbec('0x15')](function(_0x2a3329){logger[_0xfbec('0x10')]('Automation,\x20%s,\x20%s',_0x33c701,_0x2a3329);_0x312ad1(_0x2a3329);});});}