Built motion from commit da24aabd.|2.6.20
[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 _0x5eb0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3a916b,_0x52c081){var _0xd79daa=function(_0x54fc6b){while(--_0x54fc6b){_0x3a916b['push'](_0x3a916b['shift']());}};_0xd79daa(++_0x52c081);}(_0x5eb0,0x1c6));var _0x05eb=function(_0x1c54d9,_0x103787){_0x1c54d9=_0x1c54d9-0x0;var _0x5cfd93=_0x5eb0[_0x1c54d9];return _0x5cfd93;};'use strict';var _=require(_0x05eb('0x0'));var util=require(_0x05eb('0x1'));var moment=require(_0x05eb('0x2'));var BPromise=require(_0x05eb('0x3'));var rs=require(_0x05eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05eb('0x5'))['db'];var utils=require(_0x05eb('0x6'));var logger=require('../../config/logger')(_0x05eb('0x7'));var config=require(_0x05eb('0x8'));var jayson=require(_0x05eb('0x9'));var client=jayson[_0x05eb('0xa')][_0x05eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24e619,_0x2cb40a,_0xd9edd9){return new BPromise(function(_0x1be049,_0x2b591c){return client[_0x05eb('0xc')](_0x24e619,_0xd9edd9)['then'](function(_0x4f9c8a){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x2cb40a,_0x05eb('0xd'));logger[_0x05eb('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2cb40a,'request\x20sent',JSON[_0x05eb('0xf')](_0x4f9c8a));if(_0x4f9c8a[_0x05eb('0x10')]){if(_0x4f9c8a[_0x05eb('0x10')]['code']===0x1f4){logger[_0x05eb('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2cb40a,_0x4f9c8a[_0x05eb('0x10')][_0x05eb('0x11')]);return _0x2b591c(_0x4f9c8a[_0x05eb('0x10')][_0x05eb('0x11')]);}logger[_0x05eb('0x10')](_0x05eb('0x12'),_0x2cb40a,_0x4f9c8a['error'][_0x05eb('0x11')]);return _0x1be049(_0x4f9c8a[_0x05eb('0x10')]['message']);}else{logger['info'](_0x05eb('0x12'),_0x2cb40a,_0x05eb('0xd'));_0x1be049(_0x4f9c8a['result'][_0x05eb('0x11')]);}})[_0x05eb('0x13')](function(_0x90fc54){logger[_0x05eb('0x10')](_0x05eb('0x12'),_0x2cb40a,_0x90fc54);_0x2b591c(_0x90fc54);});});}