Built motion from commit (unavailable).|2.4.19
[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 _0x4f4c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','ChatOfflineMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','moment'];(function(_0x29c228,_0x45b402){var _0x24c88b=function(_0x488d31){while(--_0x488d31){_0x29c228['push'](_0x29c228['shift']());}};_0x24c88b(++_0x45b402);}(_0x4f4c,0x186));var _0xc4f4=function(_0x180450,_0xfa60f2){_0x180450=_0x180450-0x0;var _0x43d9f2=_0x4f4c[_0x180450];return _0x43d9f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc4f4('0x0'));var BPromise=require(_0xc4f4('0x1'));var rs=require(_0xc4f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4f4('0x3'))['db'];var utils=require(_0xc4f4('0x4'));var logger=require(_0xc4f4('0x5'))('rpc');var config=require(_0xc4f4('0x6'));var jayson=require(_0xc4f4('0x7'));var client=jayson['client'][_0xc4f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xca5150,_0x137f94,_0x593327){return new BPromise(function(_0x300edf,_0x463627){return client['request'](_0xca5150,_0x593327)['then'](function(_0x2aeff6){logger['info'](_0xc4f4('0x9'),_0x137f94,'request\x20sent');logger[_0xc4f4('0xa')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x137f94,'request\x20sent',JSON[_0xc4f4('0xb')](_0x2aeff6));if(_0x2aeff6[_0xc4f4('0xc')]){if(_0x2aeff6['error'][_0xc4f4('0xd')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x137f94,_0x2aeff6[_0xc4f4('0xc')][_0xc4f4('0xe')]);return _0x463627(_0x2aeff6[_0xc4f4('0xc')]['message']);}logger[_0xc4f4('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x137f94,_0x2aeff6['error']['message']);return _0x300edf(_0x2aeff6[_0xc4f4('0xc')][_0xc4f4('0xe')]);}else{logger[_0xc4f4('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x137f94,'request\x20sent');_0x300edf(_0x2aeff6['result'][_0xc4f4('0xe')]);}})[_0xc4f4('0x10')](function(_0x58aa83){logger[_0xc4f4('0xc')](_0xc4f4('0x9'),_0x137f94,_0x58aa83);_0x463627(_0x58aa83);});});}