[Asterisk-code-review] lib/python/asterisk/pcap: Add a UDP proxy for VoIP packet an... (testsuite[master])

Matt Jordan asteriskteam at digium.com
Sun Nov 22 20:18:51 CST 2015


Hello Anonymous Coward #1000019,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/1685

to look at the new patch set (#3).

Change subject: lib/python/asterisk/pcap: Add a UDP proxy for VoIP packet analysis
......................................................................

lib/python/asterisk/pcap: Add a UDP proxy for VoIP packet analysis

This patch adds a UDP proxy for VoIP packet analysis, VOIPProxy. The proxy
will forward received packets to some destination, based on some set of
rules that map a received port to a destination address/port tuple. Default
rules will forward packets from 5060 to 127.0.0.1:5062 and vice versa, with
the proxy listening on 5061.

Other tests may extend the VOIPProxy class or use it to verify received
packets. This patch refactors the existing VOIPListener into two classes:
VOIPListener, which continues to act as an extension of a PcapListener, and
a new base class, VOIPSniffer. The VOIPSniffer class merely provides the
mechanisms for registering callbacks and calling them with parsed packets
(SIPPacket, etc.). Both VOIPProxy and VOIPListener inherit from VOIPSniffer
to use this functionality.

Note that since twisted will return UDP packets to us parsed as a 'string'
object if the packet data is an ASCII string, we can no longer rely on either
obtaining the Layer 2 - Layer 4 headers, nor can we expect to get the UDP data
as binary data. As such, some of the Packet derived classes are now tolerant
to receiving a string, where appropriate. Those classes that are not explicitly
will throw if passed a string because their data should never be of type 'str'.

ASTERISK-25430

Change-Id: I7753a6ab33df88e7634c339adb8532d1b0b35d78
---
M lib/python/asterisk/pcap.py
1 file changed, 164 insertions(+), 58 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/85/1685/3
-- 
To view, visit https://gerrit.asterisk.org/1685
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7753a6ab33df88e7634c339adb8532d1b0b35d78
Gerrit-PatchSet: 3
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019



More information about the asterisk-code-review mailing list