Built motion from commit (unavailable).|2.5.22
[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 _0x6e37=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6e37,0x18f));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76e3('0x0'));var util=require(_0x76e3('0x1'));var moment=require(_0x76e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x76e3('0x3'));var fs=require('fs');var Redis=require(_0x76e3('0x4'));var db=require(_0x76e3('0x5'))['db'];var utils=require(_0x76e3('0x6'));var logger=require(_0x76e3('0x7'))(_0x76e3('0x8'));var config=require(_0x76e3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b159d,_0xde4c5,_0x48d098){return new BPromise(function(_0x1ffa49,_0x3975c6){return client[_0x76e3('0xb')](_0x2b159d,_0x48d098)['then'](function(_0x2e10e8){logger[_0x76e3('0xc')](_0x76e3('0xd'),_0xde4c5,_0x76e3('0xe'));logger['debug'](_0x76e3('0xf'),_0xde4c5,'request\x20sent',JSON[_0x76e3('0x10')](_0x2e10e8));if(_0x2e10e8[_0x76e3('0x11')]){if(_0x2e10e8[_0x76e3('0x11')]['code']===0x1f4){logger['error'](_0x76e3('0xd'),_0xde4c5,_0x2e10e8['error'][_0x76e3('0x12')]);return _0x3975c6(_0x2e10e8[_0x76e3('0x11')][_0x76e3('0x12')]);}logger[_0x76e3('0x11')]('Schedule,\x20%s,\x20%s',_0xde4c5,_0x2e10e8['error'][_0x76e3('0x12')]);return _0x1ffa49(_0x2e10e8[_0x76e3('0x11')]['message']);}else{logger[_0x76e3('0xc')](_0x76e3('0xd'),_0xde4c5,_0x76e3('0xe'));_0x1ffa49(_0x2e10e8['result']['message']);}})['catch'](function(_0x23d709){logger[_0x76e3('0x11')]('Schedule,\x20%s,\x20%s',_0xde4c5,_0x23d709);_0x3975c6(_0x23d709);});});}