b9b547a69335a3881e036be9e9aaf1793dfff5dd
[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 _0x153a=['Automation,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf175ff,_0x2ec742){var _0x34f944=function(_0x3e245a){while(--_0x3e245a){_0xf175ff['push'](_0xf175ff['shift']());}};_0x34f944(++_0x2ec742);}(_0x153a,0x172));var _0xa153=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x153a[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0xa153('0x0'));var util=require(_0xa153('0x1'));var moment=require(_0xa153('0x2'));var BPromise=require(_0xa153('0x3'));var rs=require(_0xa153('0x4'));var fs=require('fs');var Redis=require(_0xa153('0x5'));var db=require(_0xa153('0x6'))['db'];var utils=require(_0xa153('0x7'));var logger=require(_0xa153('0x8'))(_0xa153('0x9'));var config=require(_0xa153('0xa'));var jayson=require(_0xa153('0xb'));var client=jayson['client'][_0xa153('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ca177,_0x36c970,_0x11457a){return new BPromise(function(_0x5b2676,_0x5423f7){return client['request'](_0x3ca177,_0x11457a)[_0xa153('0xd')](function(_0x3e7328){logger[_0xa153('0xe')]('Automation,\x20%s,\x20%s',_0x36c970,_0xa153('0xf'));logger[_0xa153('0x10')](_0xa153('0x11'),_0x36c970,_0xa153('0xf'),JSON[_0xa153('0x12')](_0x3e7328));if(_0x3e7328[_0xa153('0x13')]){if(_0x3e7328[_0xa153('0x13')][_0xa153('0x14')]===0x1f4){logger['error'](_0xa153('0x15'),_0x36c970,_0x3e7328[_0xa153('0x13')][_0xa153('0x16')]);return _0x5423f7(_0x3e7328[_0xa153('0x13')][_0xa153('0x16')]);}logger[_0xa153('0x13')]('Automation,\x20%s,\x20%s',_0x36c970,_0x3e7328['error'][_0xa153('0x16')]);return _0x5b2676(_0x3e7328[_0xa153('0x13')][_0xa153('0x16')]);}else{logger[_0xa153('0xe')](_0xa153('0x15'),_0x36c970,_0xa153('0xf'));_0x5b2676(_0x3e7328['result'][_0xa153('0x16')]);}})['catch'](function(_0x13e807){logger[_0xa153('0x13')](_0xa153('0x15'),_0x36c970,_0x13e807);_0x5423f7(_0x13e807);});});}