Built motion from commit ff426b3f.|2.6.29
[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 _0xf569=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x38061e,_0x4f6c6f){var _0x545d9c=function(_0x23fd1e){while(--_0x23fd1e){_0x38061e['push'](_0x38061e['shift']());}};_0x545d9c(++_0x4f6c6f);}(_0xf569,0xd0));var _0x9f56=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf569[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require(_0x9f56('0x7'))('rpc');var config=require(_0x9f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f56('0x9')][_0x9f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5e5f,_0x1bcede,_0x73c3b4){return new BPromise(function(_0x5980f2,_0x46fd92){return client[_0x9f56('0xb')](_0x5c5e5f,_0x73c3b4)[_0x9f56('0xc')](function(_0x4f398b){logger['info'](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));logger['debug'](_0x9f56('0xf'),_0x1bcede,_0x9f56('0xe'),JSON[_0x9f56('0x10')](_0x4f398b));if(_0x4f398b['error']){if(_0x4f398b['error'][_0x9f56('0x11')]===0x1f4){logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b['error']['message']);return _0x46fd92(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);return _0x5980f2(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}else{logger[_0x9f56('0x14')](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));_0x5980f2(_0x4f398b[_0x9f56('0x15')][_0x9f56('0x13')]);}})[_0x9f56('0x16')](function(_0x13ebfa){logger[_0x9f56('0x12')](_0x9f56('0xd'),_0x1bcede,_0x13ebfa);_0x46fd92(_0x13ebfa);});});}