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 _0x8b33=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8b33,0x8f));var _0x38b3=function(_0x2f34d1,_0x3ca5f9){_0x2f34d1=_0x2f34d1-0x0;var _0x2d9e58=_0x8b33[_0x2f34d1];return _0x2d9e58;};'use strict';var _=require(_0x38b3('0x0'));var util=require(_0x38b3('0x1'));var moment=require('moment');var BPromise=require(_0x38b3('0x2'));var rs=require(_0x38b3('0x3'));var fs=require('fs');var Redis=require(_0x38b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x38b3('0x5'));var logger=require(_0x38b3('0x6'))(_0x38b3('0x7'));var config=require(_0x38b3('0x8'));var jayson=require(_0x38b3('0x9'));var client=jayson[_0x38b3('0xa')][_0x38b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c23ca,_0x259df8,_0x2cda72){return new BPromise(function(_0x20a7b3,_0xfaae6f){return client['request'](_0x3c23ca,_0x2cda72)['then'](function(_0x3ee26b){logger['info'](_0x38b3('0xc'),_0x259df8,_0x38b3('0xd'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x259df8,'request\x20sent',JSON[_0x38b3('0xe')](_0x3ee26b));if(_0x3ee26b[_0x38b3('0xf')]){if(_0x3ee26b['error'][_0x38b3('0x10')]===0x1f4){logger[_0x38b3('0xf')](_0x38b3('0xc'),_0x259df8,_0x3ee26b[_0x38b3('0xf')][_0x38b3('0x11')]);return _0xfaae6f(_0x3ee26b['error']['message']);}logger[_0x38b3('0xf')](_0x38b3('0xc'),_0x259df8,_0x3ee26b[_0x38b3('0xf')]['message']);return _0x20a7b3(_0x3ee26b[_0x38b3('0xf')][_0x38b3('0x11')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x259df8,'request\x20sent');_0x20a7b3(_0x3ee26b[_0x38b3('0x12')][_0x38b3('0x11')]);}})[_0x38b3('0x13')](function(_0x36de00){logger[_0x38b3('0xf')](_0x38b3('0xc'),_0x259df8,_0x36de00);_0xfaae6f(_0x36de00);});});}