Built motion from commit (unavailable).|2.5.11
[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 _0x5b0e=['ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x5e74a5,_0x150257){var _0x2b1172=function(_0xe202a2){while(--_0xe202a2){_0x5e74a5['push'](_0x5e74a5['shift']());}};_0x2b1172(++_0x150257);}(_0x5b0e,0x8e));var _0xe5b0=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x5b0e[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require('lodash');var util=require(_0xe5b0('0x0'));var moment=require('moment');var BPromise=require(_0xe5b0('0x1'));var rs=require(_0xe5b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe5b0('0x3'));var logger=require(_0xe5b0('0x4'))(_0xe5b0('0x5'));var config=require('../../config/environment');var jayson=require(_0xe5b0('0x6'));var client=jayson['client'][_0xe5b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x490a99,_0x55f7ec,_0x3ac72c){return new BPromise(function(_0x3429b4,_0x2e353b){return client[_0xe5b0('0x8')](_0x490a99,_0x3ac72c)[_0xe5b0('0x9')](function(_0x4ef294){logger['info'](_0xe5b0('0xa'),_0x55f7ec,'request\x20sent');logger['debug'](_0xe5b0('0xb'),_0x55f7ec,_0xe5b0('0xc'),JSON[_0xe5b0('0xd')](_0x4ef294));if(_0x4ef294[_0xe5b0('0xe')]){if(_0x4ef294[_0xe5b0('0xe')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x55f7ec,_0x4ef294[_0xe5b0('0xe')][_0xe5b0('0xf')]);return _0x2e353b(_0x4ef294[_0xe5b0('0xe')][_0xe5b0('0xf')]);}logger[_0xe5b0('0xe')](_0xe5b0('0xa'),_0x55f7ec,_0x4ef294[_0xe5b0('0xe')][_0xe5b0('0xf')]);return _0x3429b4(_0x4ef294[_0xe5b0('0xe')]['message']);}else{logger[_0xe5b0('0x10')](_0xe5b0('0xa'),_0x55f7ec,_0xe5b0('0xc'));_0x3429b4(_0x4ef294[_0xe5b0('0x11')]['message']);}})[_0xe5b0('0x12')](function(_0x288355){logger['error'](_0xe5b0('0xa'),_0x55f7ec,_0x288355);_0x2e353b(_0x288355);});});}