From 0f0542b351cd6457e4fb131052bc3134ee4340be Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 24 Oct 2012 18:26:57 +0400
Subject: [PATCH 1/1] Dissector for RTPproxy added

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
 epan/dissectors/Makefile.common   |   1 +
 epan/dissectors/packet-rtpproxy.c | 817 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 818 insertions(+)
 create mode 100644 epan/dissectors/packet-rtpproxy.c

diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 0f9ef0b..f4a884e 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -997,6 +997,7 @@ DISSECTOR_SRC = \
 	packet-rtp-events.c	\
 	packet-rtp-midi.c	\
 	packet-rtp.c		\
+	packet-rtpproxy.c	\
 	packet-rtps.c		\
 	packet-rtps2.c		\
 	packet-rtsp.c		\
diff --git a/epan/dissectors/packet-rtpproxy.c b/epan/dissectors/packet-rtpproxy.c
new file mode 100644
index 0000000..b769790
--- /dev/null
+++ b/epan/dissectors/packet-rtpproxy.c
@@ -0,0 +1,817 @@
+/* packet-rtpproxy.c
+ * RTPproxy command protocol dissector
+ * Copyright 2013, Peter Lemenkov <lemenkov@gmail.com>
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1999 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <epan/packet.h>
+
+#define RTPPROXY_PORT 22222
+
+static int proto_rtpproxy = -1;
+
+static int hf_rtpproxy_cookie = -1;
+static int hf_rtpproxy_error = -1;
+static int hf_rtpproxy_version_ok = -1;
+static int hf_rtpproxy_status = -1;
+static int hf_rtpproxy_ok = -1;
+static int hf_rtpproxy_ipv4 = -1;
+static int hf_rtpproxy_ipv6 = -1;
+static int hf_rtpproxy_port = -1;
+static int hf_rtpproxy_lf = -1;
+static int hf_rtpproxy_request = -1;
+static int hf_rtpproxy_command = -1;
+static int hf_rtpproxy_command_parameters = -1;
+static int hf_rtpproxy_callid = -1;
+static int hf_rtpproxy_copy_target = -1;
+static int hf_rtpproxy_playback_filename = -1;
+static int hf_rtpproxy_playback_codec = -1;
+static int hf_rtpproxy_notify = -1;
+static int hf_rtpproxy_notify_ipv4 = -1;
+static int hf_rtpproxy_notify_port = -1;
+static int hf_rtpproxy_notify_tag = -1;
+static int hf_rtpproxy_tag = -1;
+static int hf_rtpproxy_mediaid = -1;
+static int hf_rtpproxy_reply = -1;
+static int hf_rtpproxy_handshake = -1;
+static int hf_rtpproxy_version_request = -1;
+static int hf_rtpproxy_version_supported = -1;
+
+static const value_string commandtypenames[] = {
+	{ 'U', "Offer/Update" },
+	{ 'u', "Offer/Update" },
+	{ 'L', "Answer/Lookup" },
+	{ 'l', "Answer/Lookup" },
+	{ 'I', "Information"},
+	{ 'i', "Information"},
+	{ 'X', "Close all active sessions"},
+	{ 'x', "Close all active sessions"},
+	{ 'D', "Delete an active session (Bye/Cancel/Error)"},
+	{ 'd', "Delete an active session (Bye/Cancel/Error)"},
+	{ 'P', "Start playback (music-on-hold)"},
+	{ 'p', "Start playback (music-on-hold)"},
+	{ 'S', "Stop playback (music-on-hold)"},
+	{ 's', "Stop playback (music-on-hold)"},
+	{ 'R', "Start recording"},
+	{ 'r', "Start recording"},
+	{ 'C', "Copy stream"},
+	{ 'c', "Copy stream"},
+	{ 'Q', "Query info about a session"},
+	{ 'q', "Query info about a session"},
+	{ 0, NULL }
+};
+
+static const value_string errortypenames[] = {
+	{ 1, "Syntax" },
+	{ 7, "Software" },
+	{ 8, "Not Found" },
+	{ 0, NULL }
+};
+
+static gint ett_rtpproxy = -1;
+
+static gint ett_rtpproxy_request = -1;
+static gint ett_rtpproxy_command = -1;
+static gint ett_rtpproxy_tag = -1;
+static gint ett_rtpproxy_notify = -1;
+
+static gint ett_rtpproxy_reply = -1;
+
+void
+rtpptoxy_add_tag(proto_tree *rtpproxy_tree, tvbuff_t *tvb, guint begin, guint end)
+{
+	proto_item *ti = NULL;
+	proto_tree *another_tree = NULL;
+	gint new_offset = tvb_find_guint8(tvb, begin, end, ';');
+	if(new_offset == -1){
+		ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_tag, tvb, begin, end - begin, ENC_ASCII);
+		another_tree = proto_item_add_subtree(ti, ett_rtpproxy_tag);
+		ti = proto_tree_add_item(another_tree, hf_rtpproxy_mediaid, tvb, new_offset+1, 0, ENC_ASCII);
+		proto_item_set_text(ti, "Media-ID: <skipped>");
+	}
+	else{
+		ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_tag, tvb, begin, new_offset - begin, ENC_ASCII);
+		another_tree = proto_item_add_subtree(ti, ett_rtpproxy_tag);
+		proto_tree_add_item(another_tree, hf_rtpproxy_mediaid, tvb, new_offset+1, end - (new_offset+1), ENC_ASCII);
+	}
+	return;
+}
+
+static void
+dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+	guint offset = 0;
+	gint new_offset = 0;
+	guint tmp = 0;
+	guint realsize = 0;
+	guint8* rawstr = NULL;
+
+	/* Clear out stuff in the info column - we''l set it later */
+	col_clear(pinfo->cinfo, COL_INFO);
+
+	if (tree) { /* we are being asked for details */
+		proto_item *ti = NULL;
+		proto_tree *rtpproxy_tree = NULL;
+		ti = proto_tree_add_item(tree, proto_rtpproxy, tvb, 0, -1, ENC_NA);
+		rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy);
+
+		/* Extract Cookie */
+		offset = tvb_find_guint8(tvb, offset, -1, ' ');
+		ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_cookie, tvb, 0, offset, ENC_ASCII);
+
+		/* Skip whitespace */
+		offset = tvb_skip_wsp(tvb, offset+1, -1);
+
+		if (tvb_find_guint8(tvb, offset, -1, '\n') == -1){
+			col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTPproxy (no LF)");
+			rawstr = tvb_get_string(tvb, offset, tvb_length(tvb) - offset);
+			realsize = tvb_length(tvb);
+		}
+		else{
+			col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTPproxy");
+			rawstr = tvb_get_string(tvb, offset, tvb_length(tvb) - (offset+1));
+			realsize = tvb_length(tvb) - 1;
+		}
+
+		/* Extract command */
+		tmp = tvb_get_guint8(tvb, offset);
+		switch (tmp)
+		{
+			case 'V':
+			case 'v':
+			case 'I':
+			case 'i':
+			case 'X':
+			case 'x':
+			case 'U':
+			case 'u':
+			case 'L':
+			case 'l':
+			case 'D':
+			case 'd':
+			case 'P':
+			case 'p':
+			case 'S':
+			case 's':
+				/* A specific case - Status answer */
+				if ('e' == tvb_get_guint8(tvb, offset+1)){
+					col_add_fstr(pinfo->cinfo, COL_INFO, "Reply: %s", rawstr);
+					ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_reply, tvb, offset, -1, ENC_NA);
+					proto_item_set_text(ti, "Reply");
+
+					rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_reply);
+
+					new_offset = tvb_find_guint8(tvb, offset, -1, '\n');
+					if(new_offset == -1)
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_status, tvb, offset, -1, ENC_NA);
+					else{
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_status, tvb, offset, new_offset - offset, ENC_NA);
+						offset = new_offset;
+					}
+					break;
+				}
+			case 'R':
+			case 'r':
+			case 'C':
+			case 'c':
+			case 'Q':
+			case 'q':
+				col_add_fstr(pinfo->cinfo, COL_INFO, "Request: %s", rawstr);
+				ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_request, tvb, offset, -1, ENC_NA);
+				proto_item_set_text(ti, "Request");
+				rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_request);
+
+				/* A specific case - version */
+				if ((tmp == 'v') || (tmp == 'V')){
+					if ('F' == tvb_get_guint8(tvb, offset+1)){
+						/* Skip whitespace */
+						new_offset = tvb_skip_wsp(tvb, offset+(2+1), -1);
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_version_request, tvb, offset, new_offset+8 - offset, ENC_ASCII);
+						offset = new_offset+8;
+					}
+					else{
+						ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_handshake, tvb, offset, 1, ENC_ASCII);
+						proto_item_set_text(ti, "Handshake");
+						/* Skip 'V' */
+						offset++;
+					}
+					break;
+				}
+
+				/* All other commands */
+				ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_command, tvb, offset, 1, ENC_NA);
+				proto_item_set_text(ti, "Command: %s", val_to_str(tmp, commandtypenames, "Unknown (0x%02x)"));
+
+				/* Another specific case - query information */
+				if ((tmp == 'I') || (tmp == 'i')){
+					/* Check for 'brief' parameter */
+					new_offset = tvb_find_guint8(tvb, offset, -1, 'b');
+					if(new_offset != -1){
+						rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_command);
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_command_parameters, tvb, offset+1, 1, ENC_ASCII);
+						rtpproxy_tree = proto_item_get_parent(ti);
+						offset = new_offset;
+					}
+					/* Skip one space forward */
+					offset++;
+					break;
+				}
+
+				/* Extract parameters */
+				new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+
+				if(new_offset == -1){
+					/* No more parameters */
+					break;
+				}
+				if (new_offset != (gint)offset + 1){
+					rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_command);
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_command_parameters, tvb, offset+1, new_offset - (offset+1), ENC_ASCII);
+					rtpproxy_tree = proto_item_get_parent(ti);
+				}
+				/* Skip whitespace */
+				offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+				/* Extract Call-ID */
+				new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+				proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_callid, tvb, offset, new_offset - offset, ENC_ASCII);
+				/* Skip whitespace */
+				offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+				/* Extract IP and Port in case of Offer/Answer */
+				if ((tmp == 'U') || (tmp == 'u') || (tmp == 'L') || (tmp == 'l')){
+					/* Extract IP */
+					new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+					if (tvb_find_guint8(tvb, offset, new_offset - offset, ':') == -1)
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv4, tvb, offset, new_offset - offset, ENC_ASCII);
+					else
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv6, tvb, offset, new_offset - offset, ENC_ASCII);
+					/* Skip whitespace */
+					offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+					/* Extract Port */
+					new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_port, tvb, offset, new_offset - offset, ENC_ASCII);
+					/* Skip whitespace */
+					offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+				}
+
+				/* Extract Copy target */
+				if ((tmp == 'C') || (tmp == 'c')){
+					new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_copy_target, tvb, offset, new_offset - offset, ENC_ASCII);
+					/* Skip whitespace */
+					offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+				}
+
+				/* Extract Playback file and codecs */
+				if ((tmp == 'P') || (tmp == 'p')){
+					/* Extract filename */
+					new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_playback_filename, tvb, offset, new_offset - offset, ENC_ASCII);
+					/* Skip whitespace */
+					offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+					/* Extract codec */
+					new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_playback_codec, tvb, offset, new_offset - offset, ENC_ASCII);
+					/* Skip whitespace */
+					offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+				}
+
+				/* Extract first tag */
+				new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+				if(new_offset == -1){
+					rtpptoxy_add_tag(rtpproxy_tree, tvb, offset, realsize);
+					/* No more parameters */
+					break;
+				}
+				rtpptoxy_add_tag(rtpproxy_tree, tvb, offset, (guint)new_offset);
+				/* Skip whitespace */
+				offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+				/* Extract second tag */
+				new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+				if(new_offset == -1){
+					rtpptoxy_add_tag(rtpproxy_tree, tvb, offset, realsize);
+					/* No more parameters */
+					break;
+				}
+				rtpptoxy_add_tag(rtpproxy_tree, tvb, offset, (guint)new_offset);
+				/* Skip whitespace */
+				offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+				/* Extract Notification address */
+				if ((tmp == 'U') || (tmp == 'u')){
+					new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+					ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify, tvb, offset, realsize - offset, ENC_NA);
+					proto_item_set_text(ti, "Notify");
+					rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_notify);
+					if(new_offset == -1){
+						/* FIXME only IPv4 is supported */
+						new_offset = tvb_find_guint8(tvb, offset, -1, ':');
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, offset, new_offset - offset, ENC_ASCII);
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, new_offset+1, realsize - (new_offset+1), ENC_ASCII);
+						/* No more parameters */
+						break;
+					}
+					if(new_offset - offset < 6){
+						/* Only port is supplied */
+						ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, offset, 0, ENC_ASCII);
+						proto_item_set_text(ti, "Notification IPv4: <skipped>");
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, offset, new_offset - offset, ENC_ASCII);
+					}
+					else{
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, offset, new_offset - offset, ENC_ASCII);
+						proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_port, tvb, new_offset+1, realsize - (new_offset+1), ENC_ASCII);
+					}
+					/* Skip whitespace */
+					offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_notify_tag, tvb, offset, realsize - offset, ENC_ASCII);
+				}
+				break;
+			case 'a':
+				col_add_fstr(pinfo->cinfo, COL_INFO, "Reply: %s", rawstr);
+				ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_reply, tvb, offset, -1, ENC_NA);
+				proto_item_set_text(ti, "Reply");
+
+				rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_reply);
+
+				new_offset = tvb_find_guint8(tvb, offset, -1, '\n');
+				if(new_offset == -1)
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_status, tvb, offset, -1, ENC_NA);
+				else{
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_status, tvb, offset, new_offset - offset, ENC_NA);
+					offset = new_offset;
+				}
+				break;
+			case '0':
+			case '1':
+			case '2':
+			case '3':
+			case '4':
+			case '5':
+			case '6':
+			case '7':
+			case '8':
+			case '9':
+				col_add_fstr(pinfo->cinfo, COL_INFO, "Reply: %s", rawstr);
+				ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_reply, tvb, offset, -1, ENC_NA);
+				proto_item_set_text(ti, "Reply");
+
+				rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_reply);
+
+				if ((tmp == '0')&& ((tvb_length(tvb) == offset+1)||(tvb_length(tvb) == offset+2))){
+					ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ok, tvb, offset, 1, ENC_ASCII);
+					proto_item_set_text(ti, "Reply: Ok");
+					offset++;
+					break;
+				}
+				if ((tmp == '1') && ((tvb_length(tvb) == offset+1)||(tvb_length(tvb) == offset+2))){
+					ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_version_ok, tvb, offset, 1, ENC_ASCII);
+					proto_item_set_text(ti, "Version supported: Yes");
+					offset++;
+					break;
+				}
+				if (tvb_length(tvb) == offset+9){
+					ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_version_supported, tvb, offset, 8, ENC_ASCII);
+					offset += 8;
+					break;
+				}
+
+				/* Extract Port */
+				new_offset = tvb_find_guint8(tvb, offset, -1, ' ');
+				proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_port, tvb, offset, new_offset - offset, ENC_ASCII);
+				/* Skip whitespace */
+				offset = tvb_skip_wsp(tvb, new_offset+1, -1);
+
+				/* Extract IP */
+				tmp = tvb_find_line_end(tvb, offset, -1, &new_offset, FALSE);
+				if (tvb_find_guint8(tvb, offset, -1, ':') == -1)
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv4, tvb, offset, tmp, ENC_ASCII);
+				else
+					proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_ipv6, tvb, offset, tmp, ENC_ASCII);
+				offset = offset + tmp;
+				break;
+			case 'E':
+			case 'e':
+				col_add_fstr(pinfo->cinfo, COL_INFO, "Error reply: %s", rawstr);
+				ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_reply, tvb, offset, -1, ENC_NA);
+				proto_item_set_text(ti, "Error Reply");
+				rtpproxy_tree = proto_item_add_subtree(ti, ett_rtpproxy_reply);
+				ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_error, tvb, offset, 2, ENC_NA);
+				tmp = tvb_get_guint8(tvb, offset+1) - 48;
+				proto_item_set_text(ti, "Error type: %s", val_to_str(tmp, errortypenames, "Unknown (0x%02x)"));
+				offset += 2;
+				break;
+			default:
+				break;
+		}
+		new_offset = tvb_find_guint8(tvb, offset, -1, '\n');
+		if (new_offset != -1){
+			ti = proto_tree_add_item(rtpproxy_tree, hf_rtpproxy_lf, tvb, new_offset, -1, ENC_NA);
+			proto_item_set_text(ti, "LF (optional)");
+		}
+
+		g_free(rawstr);
+	}
+
+	return;
+}
+
+void
+proto_register_rtpproxy(void)
+{
+	static hf_register_info hf[] = {
+		{
+			&hf_rtpproxy_cookie,
+			{
+				"Cookie",
+				"rtpproxy.cookie",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_handshake,
+			{
+				"Handshake",
+				"rtpproxy.handshake",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_version_request,
+			{
+				"Version Request",
+				"rtpproxy.version",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_version_supported,
+			{
+				"Version Supported",
+				"rtpproxy.version_supported",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_error,
+			{
+				"Error",
+				"rtpproxy.error",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_ok,
+			{
+				"Ok",
+				"rtpproxy.ok",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_version_ok,
+			{
+				"Version Ok",
+				"rtpproxy.version_ok",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_status,
+			{
+				"Status",
+				"rtpproxy.status",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_ipv4,
+			{
+				"IPv4",
+				"rtpproxy.ipv4",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_ipv6,
+			{
+				"IPv6",
+				"rtpproxy.ipv6",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_port,
+			{
+				"Port",
+				"rtpproxy.port",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_request,
+			{
+				"Request",
+				"rtpproxy.request",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_command,
+			{
+				"Command",
+				"rtpproxy.command",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_command_parameters,
+			{
+				"Command parameters",
+				"rtpproxy.command_parameters",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_copy_target,
+			{
+				"Copy target",
+				"rtpproxy.copy_target",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_playback_filename,
+			{
+				"Playback filename",
+				"rtpproxy.playback_filename",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_playback_codec,
+			{
+				"Playback codec",
+				"rtpproxy.playback_codec",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_callid,
+			{
+				"Call-ID",
+				"rtpproxy.callid",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_notify,
+			{
+				"Notify",
+				"rtpproxy.notify",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_tag,
+			{
+				"Tag",
+				"rtpproxy.tag",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_mediaid,
+			{
+				"Media-ID",
+				"rtpproxy.mediaid",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_notify_ipv4,
+			{
+				"Notification IPv4",
+				"rtpproxy.notify_ipv4",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_notify_port,
+			{
+				"Notification Port",
+				"rtpproxy.notify_port",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_notify_tag,
+			{
+				"Notification Tag",
+				"rtpproxy.notify_tag",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_reply,
+			{
+				"Reply",
+				"rtpproxy.reply",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+		{
+			&hf_rtpproxy_lf,
+			{
+				"LF",
+				"rtpproxy.lf",
+				FT_STRING,
+				BASE_NONE,
+				NULL,
+				0x0,
+				NULL,
+				HFILL
+			}
+		},
+	};
+
+	/* Setup protocol subtree array */
+	static gint *ett[] = {
+		&ett_rtpproxy,
+		&ett_rtpproxy_request,
+		&ett_rtpproxy_command,
+		&ett_rtpproxy_tag,
+		&ett_rtpproxy_notify,
+		&ett_rtpproxy_reply
+	};
+
+	proto_rtpproxy = proto_register_protocol (
+			"Sippy RTPproxy Protocol", /* name       */
+			"RTPproxy",      /* short name */
+			"rtpproxy"       /* abbrev     */
+			);
+
+	proto_register_field_array(proto_rtpproxy, hf, array_length(hf));
+	proto_register_subtree_array(ett, array_length(ett));
+}
+
+void
+proto_reg_handoff_rtpproxy(void)
+{
+	static dissector_handle_t rtpproxy_handle;
+
+	rtpproxy_handle = create_dissector_handle(dissect_rtpproxy, proto_rtpproxy);
+
+	dissector_add_uint("tcp.port", RTPPROXY_PORT, rtpproxy_handle);
+	dissector_add_uint("udp.port", RTPPROXY_PORT, rtpproxy_handle);
+}
-- 
1.8.1.2

