Built motion from commit 0900f080.|2.5.45
[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 _0x408f=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x26a709,_0x47c89f){var _0x5358d6=function(_0x53dfba){while(--_0x53dfba){_0x26a709['push'](_0x26a709['shift']());}};_0x5358d6(++_0x47c89f);}(_0x408f,0x1c1));var _0xf408=function(_0x284b35,_0x26cbfa){_0x284b35=_0x284b35-0x0;var _0x4fb5ab=_0x408f[_0x284b35];return _0x4fb5ab;};'use strict';var _=require(_0xf408('0x0'));var util=require(_0xf408('0x1'));var moment=require('moment');var BPromise=require(_0xf408('0x2'));var rs=require(_0xf408('0x3'));var fs=require('fs');var Redis=require(_0xf408('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf408('0x5'));var logger=require(_0xf408('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf408('0x7'));var client=jayson[_0xf408('0x8')][_0xf408('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe678ff,_0x2f1c04,_0x31d015){return new BPromise(function(_0x315c6e,_0x8baadd){return client[_0xf408('0xa')](_0xe678ff,_0x31d015)[_0xf408('0xb')](function(_0x2204c2){logger[_0xf408('0xc')](_0xf408('0xd'),_0x2f1c04,_0xf408('0xe'));logger[_0xf408('0xf')](_0xf408('0x10'),_0x2f1c04,_0xf408('0xe'),JSON[_0xf408('0x11')](_0x2204c2));if(_0x2204c2[_0xf408('0x12')]){if(_0x2204c2[_0xf408('0x12')][_0xf408('0x13')]===0x1f4){logger[_0xf408('0x12')](_0xf408('0xd'),_0x2f1c04,_0x2204c2[_0xf408('0x12')][_0xf408('0x14')]);return _0x8baadd(_0x2204c2['error'][_0xf408('0x14')]);}logger[_0xf408('0x12')](_0xf408('0xd'),_0x2f1c04,_0x2204c2[_0xf408('0x12')]['message']);return _0x315c6e(_0x2204c2[_0xf408('0x12')][_0xf408('0x14')]);}else{logger['info'](_0xf408('0xd'),_0x2f1c04,'request\x20sent');_0x315c6e(_0x2204c2[_0xf408('0x15')]['message']);}})[_0xf408('0x16')](function(_0xe499e0){logger['error'](_0xf408('0xd'),_0x2f1c04,_0xe499e0);_0x8baadd(_0xe499e0);});});}