Built motion from commit bbec7235.|2.6.20
[motion2.git] / server / api / userNotification / userNotification.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 _0xfc7b=['redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','request\x20sent','debug','stringify','error','UserNotification,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0xfc7b,0x19e));var _0xbfc7=function(_0x37fe9a,_0x5f4d04){_0x37fe9a=_0x37fe9a-0x0;var _0x49b067=_0xfc7b[_0x37fe9a];return _0x49b067;};'use strict';var _=require(_0xbfc7('0x0'));var util=require(_0xbfc7('0x1'));var moment=require(_0xbfc7('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfc7('0x3'));var fs=require('fs');var Redis=require(_0xbfc7('0x4'));var db=require(_0xbfc7('0x5'))['db'];var utils=require(_0xbfc7('0x6'));var logger=require('../../config/logger')(_0xbfc7('0x7'));var config=require(_0xbfc7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfc7('0x9')][_0xbfc7('0xa')]({'port':0x232a});config[_0xbfc7('0xb')]=_[_0xbfc7('0xc')](config[_0xbfc7('0xb')],{'host':_0xbfc7('0xd'),'port':0x18eb});var socket=require(_0xbfc7('0xe'))(new Redis(config[_0xbfc7('0xb')]));require(_0xbfc7('0xf'))['register'](socket);function respondWithRpcPromise(_0x22415f,_0xfaa95c,_0x1f84f1){return new BPromise(function(_0x2e4cd9,_0x5d939b){return client[_0xbfc7('0x10')](_0x22415f,_0x1f84f1)[_0xbfc7('0x11')](function(_0x2262c3){logger[_0xbfc7('0x12')]('UserNotification,\x20%s,\x20%s',_0xfaa95c,_0xbfc7('0x13'));logger[_0xbfc7('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xfaa95c,_0xbfc7('0x13'),JSON[_0xbfc7('0x15')](_0x2262c3));if(_0x2262c3[_0xbfc7('0x16')]){if(_0x2262c3['error']['code']===0x1f4){logger[_0xbfc7('0x16')]('UserNotification,\x20%s,\x20%s',_0xfaa95c,_0x2262c3[_0xbfc7('0x16')]['message']);return _0x5d939b(_0x2262c3[_0xbfc7('0x16')]['message']);}logger[_0xbfc7('0x16')]('UserNotification,\x20%s,\x20%s',_0xfaa95c,_0x2262c3[_0xbfc7('0x16')]['message']);return _0x2e4cd9(_0x2262c3[_0xbfc7('0x16')]['message']);}else{logger['info'](_0xbfc7('0x17'),_0xfaa95c,_0xbfc7('0x13'));_0x2e4cd9(_0x2262c3[_0xbfc7('0x18')]['message']);}})['catch'](function(_0x41e2e4){logger['error'](_0xbfc7('0x17'),_0xfaa95c,_0x41e2e4);_0x5d939b(_0x41e2e4);});});}