Built motion from commit (unavailable).|2.5.22
[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 _0x6acf=['request\x20sent','debug','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6acf,0x6f));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf6ac('0x1'));var rs=require(_0xf6ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6ac('0x3'))['db'];var utils=require(_0xf6ac('0x4'));var logger=require(_0xf6ac('0x5'))(_0xf6ac('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6ac('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a8592,_0x172ff4,_0x54e9e0){return new BPromise(function(_0x29dd73,_0x326b8a){return client['request'](_0x1a8592,_0x54e9e0)[_0xf6ac('0x8')](function(_0x2cd18d){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x172ff4,_0xf6ac('0x9'));logger[_0xf6ac('0xa')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x172ff4,_0xf6ac('0x9'),JSON['stringify'](_0x2cd18d));if(_0x2cd18d[_0xf6ac('0xb')]){if(_0x2cd18d[_0xf6ac('0xb')][_0xf6ac('0xc')]===0x1f4){logger[_0xf6ac('0xb')](_0xf6ac('0xd'),_0x172ff4,_0x2cd18d['error'][_0xf6ac('0xe')]);return _0x326b8a(_0x2cd18d[_0xf6ac('0xb')][_0xf6ac('0xe')]);}logger[_0xf6ac('0xb')](_0xf6ac('0xd'),_0x172ff4,_0x2cd18d[_0xf6ac('0xb')][_0xf6ac('0xe')]);return _0x29dd73(_0x2cd18d['error'][_0xf6ac('0xe')]);}else{logger['info'](_0xf6ac('0xd'),_0x172ff4,'request\x20sent');_0x29dd73(_0x2cd18d['result']['message']);}})['catch'](function(_0xd93424){logger['error'](_0xf6ac('0xd'),_0x172ff4,_0xd93424);_0x326b8a(_0xd93424);});});}