Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / schedule / schedule.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 _0xa188=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','randomstring','ioredis'];(function(_0x59a40c,_0x35999f){var _0x3cf340=function(_0x3d2c47){while(--_0x3d2c47){_0x59a40c['push'](_0x59a40c['shift']());}};_0x3cf340(++_0x35999f);}(_0xa188,0xb0));var _0x8a18=function(_0x53d740,_0x4f76d0){_0x53d740=_0x53d740-0x0;var _0x261538=_0xa188[_0x53d740];return _0x261538;};'use strict';var _=require(_0x8a18('0x0'));var util=require(_0x8a18('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a18('0x2'));var fs=require('fs');var Redis=require(_0x8a18('0x3'));var db=require(_0x8a18('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a18('0x5'))(_0x8a18('0x6'));var config=require(_0x8a18('0x7'));var jayson=require(_0x8a18('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x404b7a,_0x35714c,_0xffe82a){return new BPromise(function(_0x31c4c0,_0x5121f3){return client[_0x8a18('0x9')](_0x404b7a,_0xffe82a)[_0x8a18('0xa')](function(_0x4f1d05){logger[_0x8a18('0xb')](_0x8a18('0xc'),_0x35714c,_0x8a18('0xd'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x35714c,_0x8a18('0xd'),JSON['stringify'](_0x4f1d05));if(_0x4f1d05[_0x8a18('0xe')]){if(_0x4f1d05[_0x8a18('0xe')][_0x8a18('0xf')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x35714c,_0x4f1d05[_0x8a18('0xe')][_0x8a18('0x10')]);return _0x5121f3(_0x4f1d05[_0x8a18('0xe')]['message']);}logger['error'](_0x8a18('0xc'),_0x35714c,_0x4f1d05['error'][_0x8a18('0x10')]);return _0x31c4c0(_0x4f1d05[_0x8a18('0xe')][_0x8a18('0x10')]);}else{logger['info'](_0x8a18('0xc'),_0x35714c,_0x8a18('0xd'));_0x31c4c0(_0x4f1d05[_0x8a18('0x11')][_0x8a18('0x10')]);}})['catch'](function(_0x236863){logger[_0x8a18('0xe')]('Schedule,\x20%s,\x20%s',_0x35714c,_0x236863);_0x5121f3(_0x236863);});});}