Built motion from commit 43538d75.|2.5.35
[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 _0xe5e7=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xe5e7,0x10d));var _0x7e5e=function(_0x308fdf,_0x2e90de){_0x308fdf=_0x308fdf-0x0;var _0x4971c3=_0xe5e7[_0x308fdf];return _0x4971c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e5e('0x0'));var BPromise=require(_0x7e5e('0x1'));var rs=require(_0x7e5e('0x2'));var fs=require('fs');var Redis=require(_0x7e5e('0x3'));var db=require(_0x7e5e('0x4'))['db'];var utils=require(_0x7e5e('0x5'));var logger=require(_0x7e5e('0x6'))(_0x7e5e('0x7'));var config=require(_0x7e5e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555fae,_0x33ca4a,_0x3c72af){return new BPromise(function(_0x16823b,_0x2b9a0f){return client[_0x7e5e('0xa')](_0x555fae,_0x3c72af)['then'](function(_0x568bc6){logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x33ca4a,_0x7e5e('0xd'));logger['debug'](_0x7e5e('0xe'),_0x33ca4a,_0x7e5e('0xd'),JSON['stringify'](_0x568bc6));if(_0x568bc6['error']){if(_0x568bc6['error']['code']===0x1f4){logger[_0x7e5e('0xf')](_0x7e5e('0xc'),_0x33ca4a,_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);return _0x2b9a0f(_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);}logger[_0x7e5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca4a,_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);return _0x16823b(_0x568bc6['error']['message']);}else{logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x33ca4a,_0x7e5e('0xd'));_0x16823b(_0x568bc6[_0x7e5e('0x11')]['message']);}})[_0x7e5e('0x12')](function(_0x1f26b6){logger[_0x7e5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca4a,_0x1f26b6);_0x2b9a0f(_0x1f26b6);});});}