Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / notification / notification.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 _0xec5a=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','./notification.socket','register','info','request\x20sent','debug','stringify','error','Notification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x4f324f,_0x3a91e6){var _0x416d43=function(_0x47b556){while(--_0x47b556){_0x4f324f['push'](_0x4f324f['shift']());}};_0x416d43(++_0x3a91e6);}(_0xec5a,0x1c2));var _0xaec5=function(_0x11b471,_0x292e04){_0x11b471=_0x11b471-0x0;var _0x43fb3a=_0xec5a[_0x11b471];return _0x43fb3a;};'use strict';var _=require(_0xaec5('0x0'));var util=require(_0xaec5('0x1'));var moment=require(_0xaec5('0x2'));var BPromise=require('bluebird');var rs=require(_0xaec5('0x3'));var fs=require('fs');var Redis=require(_0xaec5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaec5('0x5'));var logger=require('../../config/logger')(_0xaec5('0x6'));var config=require(_0xaec5('0x7'));var jayson=require(_0xaec5('0x8'));var client=jayson[_0xaec5('0x9')][_0xaec5('0xa')]({'port':0x232a});config['redis']=_[_0xaec5('0xb')](config['redis'],{'host':_0xaec5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaec5('0xd'))[_0xaec5('0xe')](socket);function respondWithRpcPromise(_0x421904,_0x28d084,_0x58ea37){return new BPromise(function(_0xff0a26,_0x4a98dd){return client['request'](_0x421904,_0x58ea37)['then'](function(_0x31ef7e){logger[_0xaec5('0xf')]('Notification,\x20%s,\x20%s',_0x28d084,_0xaec5('0x10'));logger[_0xaec5('0x11')]('Notification,\x20%s,\x20%s,\x20%s',_0x28d084,_0xaec5('0x10'),JSON[_0xaec5('0x12')](_0x31ef7e));if(_0x31ef7e[_0xaec5('0x13')]){if(_0x31ef7e[_0xaec5('0x13')]['code']===0x1f4){logger[_0xaec5('0x13')](_0xaec5('0x14'),_0x28d084,_0x31ef7e[_0xaec5('0x13')]['message']);return _0x4a98dd(_0x31ef7e[_0xaec5('0x13')][_0xaec5('0x15')]);}logger[_0xaec5('0x13')](_0xaec5('0x14'),_0x28d084,_0x31ef7e[_0xaec5('0x13')][_0xaec5('0x15')]);return _0xff0a26(_0x31ef7e[_0xaec5('0x13')][_0xaec5('0x15')]);}else{logger['info'](_0xaec5('0x14'),_0x28d084,_0xaec5('0x10'));_0xff0a26(_0x31ef7e[_0xaec5('0x16')]['message']);}})[_0xaec5('0x17')](function(_0x2d1fe1){logger[_0xaec5('0x13')](_0xaec5('0x14'),_0x28d084,_0x2d1fe1);_0x4a98dd(_0x2d1fe1);});});}