# Intercepting UDP packets with IRTPDePacketizerWrapper

**URL:** <https://community.wowza.com/t/intercepting-udp-packets-with-irtpdepacketizerwrapper/47876>\
**Category:** Wowza Streaming Engine\
**Created:** [January 11, 2017, 10:50am UTC](https://community.wowza.com/t/intercepting-udp-packets-with-irtpdepacketizerwrapper/47876 "2017-01-11T10:50:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlie\_Walker](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@Charlie\_Walker](https://community.wowza.com/u/Charlie_Walker)\
**Post date:** [January 11, 2017, 10:50am UTC](https://community.wowza.com/t/intercepting-udp-packets-with-irtpdepacketizerwrapper/47876/1 "2017-01-11T10:50:09Z")

</div>

I am trying to intercept UDP packets from an RTSP encoder following [this article](https://www.wowza.com/docs/how-to-intercept-and-block-incoming-udp-packets-for-an-rtp-or-mpeg-ts-stream). I am trying to implement a decryption mechanism for the RTP stream received but it looks like my code is never called.

Following the article, I have built my .jar file, confirmed it is loaded into [Wowza install dir]/lib/ and modified [Wowza install dir]/conf/live/Application.xml with the correct property. It looks like Wowza is successfully loading my package because I see a ClassNotFoundException in the logs when I misspell my entry in Application.xml and I do not see any error when I remove the misspelling.

I don’t think my code is being called for a couple reasons. I have added log statements that never appear in the Wowza logs and I have also tried to garble the stream with no success. I am not testing with an encrypted stream and I have used both RTSP encoders and a simple RTP stream from ffmpeg.

Can anyone help me get this working? I have barely found any information on intercepting packets. I’m working on Windows 10 64-bit and I’ve copied my code below. Let me know if there is anything else that would be helpful to provide.

```auto
package depacketizer;
import java.net.*;
import com.wowza.wms.application.*;
import com.wowza.wms.logging.WMSLoggerFactory;
import com.wowza.wms.rtp.depacketizer.*;
import com.wowza.wms.rtp.model.*;
public class RTPDePacketizerWrapperFilter implements IRTPDePacketizerWrapper
{
	private IRTPDePacketizer rtpDePacketizer = null;
	
	public void setDePacketizer(IRTPDePacketizer rtpDePacketizer)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER setDePacketizer");
		this.rtpDePacketizer = rtpDePacketizer;
	}
	public boolean canHandle(RTPTrack rtpTrack)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER canHandle");
		return rtpDePacketizer.canHandle(rtpTrack);
	}
	public void handleRTCPPacket(SocketAddress socketAddr, RTPTrack rtpTrack, byte[] bytes, int offset, int len)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER handleRTCPPacket");
		// filter here based on socketAddr
		rtpDePacketizer.handleRTCPPacket(socketAddr, rtpTrack, bytes, offset, len);
	}
	public void handleRTPPacket(SocketAddress socketAddr, RTPTrack rtpTrack, byte[] bytes, int offset, int len)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER handleRTPPacket");
		
		for(int i = offset; i < len; i++)
		{
			bytes[i] = (byte) 0; // try to destroy stream
		}
		
		// process RTP packets
		rtpDePacketizer.handleRTPPacket(socketAddr, rtpTrack, bytes, offset, len);
	}
	public void init(RTPContext rtpContext, RTPDePacketizerItem rtpDePacketizerItem)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER init");
		rtpDePacketizer.init(rtpContext, rtpDePacketizerItem);
	}
	public void setProperties(WMSProperties properties)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER set properties");
		rtpDePacketizer.setProperties(properties);
	}
	public void shutdown(RTPTrack rtpTrack)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER shutdown");
		rtpDePacketizer.shutdown(rtpTrack);
	}
	public void startup(RTPTrack rtpTrack)
	{
		WMSLoggerFactory.getLogger(null).info("RTPDEPACKETIZERWRAPPERFILTER startup");
		rtpDePacketizer.startup(rtpTrack);
	}
}

```

---

<div class="post-metadata">

**Author:** ![Jermaine\_Hemby](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@Jermaine\_Hemby](https://community.wowza.com/u/Jermaine_Hemby)\
**Post date:** [January 22, 2017, 9:17am UTC](https://community.wowza.com/t/intercepting-udp-packets-with-irtpdepacketizerwrapper/47876/2 "2017-01-22T09:17:43Z")

</div>

Hello!

Thanks for contacting Wowza Forums!

In regards to the code and decryption of the RTP stream, Wowza does not support encrypted ingest streams. I understand you are implementing code to decrypt the files, but the files need to be decrypted before getting to Wowza, I presume.

I suggest opening a ticket [HERE](https://www.wowza.com/support/open-ticket) and then we can have an Engineer confirm this for you.

regards,

Jermaine
