Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / chatOfflineMessage / chatOfflineMessage.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 _0xf212=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis'];(function(_0xd7845b,_0x3d84e8){var _0x53a9df=function(_0x58b910){while(--_0x58b910){_0xd7845b['push'](_0xd7845b['shift']());}};_0x53a9df(++_0x3d84e8);}(_0xf212,0x122));var _0x2f21=function(_0x294ff8,_0x51a22e){_0x294ff8=_0x294ff8-0x0;var _0x7e3eb7=_0xf212[_0x294ff8];return _0x7e3eb7;};'use strict';var _=require(_0x2f21('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f21('0x1'));var rs=require(_0x2f21('0x2'));var fs=require('fs');var Redis=require(_0x2f21('0x3'));var db=require(_0x2f21('0x4'))['db'];var utils=require(_0x2f21('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f21('0x6'));var jayson=require(_0x2f21('0x7'));var client=jayson[_0x2f21('0x8')][_0x2f21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d0d82,_0xa0021e,_0x44006e){return new BPromise(function(_0x2e5915,_0x5090d5){return client[_0x2f21('0xa')](_0x6d0d82,_0x44006e)[_0x2f21('0xb')](function(_0x35d8cb){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xa0021e,_0x2f21('0xc'));logger[_0x2f21('0xd')](_0x2f21('0xe'),_0xa0021e,'request\x20sent',JSON[_0x2f21('0xf')](_0x35d8cb));if(_0x35d8cb[_0x2f21('0x10')]){if(_0x35d8cb[_0x2f21('0x10')]['code']===0x1f4){logger[_0x2f21('0x10')](_0x2f21('0x11'),_0xa0021e,_0x35d8cb[_0x2f21('0x10')][_0x2f21('0x12')]);return _0x5090d5(_0x35d8cb['error'][_0x2f21('0x12')]);}logger[_0x2f21('0x10')](_0x2f21('0x11'),_0xa0021e,_0x35d8cb[_0x2f21('0x10')]['message']);return _0x2e5915(_0x35d8cb[_0x2f21('0x10')][_0x2f21('0x12')]);}else{logger[_0x2f21('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0xa0021e,'request\x20sent');_0x2e5915(_0x35d8cb['result'][_0x2f21('0x12')]);}})[_0x2f21('0x14')](function(_0x2ff624){logger['error'](_0x2f21('0x11'),_0xa0021e,_0x2ff624);_0x5090d5(_0x2ff624);});});}