Ethereal-dev: [Ethereal-dev] patch to IAX2 dissector

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Kenny Shumard <kshumard@xxxxxxxxx>
Date: Fri, 1 Apr 2005 18:33:24 -0500
This upgrade includes updated IAX commands and IEs, as well as some
minor formatting fixes. Also included is a list of #defines for hangup
cause codes, needed for a new IE.
--- packet-iax2.c	2005-03-10 10:53:43.000000000 -0500
+++ packet-iax2.c.patched	2005-04-01 18:15:22.000000000 -0500
@@ -43,7 +43,7 @@
 #include "iax2_codec_type.h"
 
 #define IAX2_PORT		4569
-#define PROTO_TAG_IAX2	"IAX2"
+#define PROTO_TAG_IAX2		"IAX2"
 
 /* #define DEBUG_HASHING */
 
@@ -121,6 +121,30 @@
 static int hf_IAX_IE_MUSICONHOLD = -1;
 static int hf_IAX_IE_TRANSFERID = -1;
 static int hf_IAX_IE_RDNIS = -1;
+static int hf_IAX_IE_PROVISIONING = -1;
+static int hf_IAX_IE_AESPROVISIONING = -1;
+static int hf_IAX_IE_DATETIME = -1;
+static int hf_IAX_IE_DEVICETYPE = -1;
+static int hf_IAX_IE_SERVICEIDENT = -1;
+static int hf_IAX_IE_FIRMWAREVER = -1;
+static int hf_IAX_IE_FWBLOCKDESC = -1;
+static int hf_IAX_IE_FWBLOCKDATA = -1;
+static int hf_IAX_IE_PROVVER = -1;
+static int hf_IAX_IE_CALLINGPRES = -1;
+static int hf_IAX_IE_CALLINGTON = -1;
+static int hf_IAX_IE_CALLINGTNS = -1;
+static int hf_IAX_IE_SAMPLINGRATE = -1;
+static int hf_IAX_IE_CAUSECODE = -1;
+static int hf_IAX_IE_ENCRYPTION = -1;
+static int hf_IAX_IE_ENCKEY = -1;
+static int hf_IAX_IE_CODEC_PREFS = -1;
+static int hf_IAX_IE_RR_JITTER = -1;
+static int hf_IAX_IE_RR_LOSS = -1;
+static int hf_IAX_IE_RR_PKTS = -1;
+static int hf_IAX_IE_RR_DELAY = -1;
+static int hf_IAX_IE_RR_DROPPED = -1;
+static int hf_IAX_IE_RR_OOO = -1;
+
 static int hf_IAX_IE_DATAFORMAT = -1;
 static int hf_IAX_IE_UNKNOWN_BYTE = -1;
 static int hf_IAX_IE_UNKNOWN_I16 = -1;
@@ -193,6 +217,9 @@
   {32, "MWI"},
   {33, "UNSUPPORTED"},
   {34, "TRANSFER"},
+  {35, "PROVISION"},
+  {36, "FWDOWNL"},
+  {37, "FWDATA"},
   {0,NULL}
 };
 
@@ -243,6 +270,26 @@
   {IAX_IE_PROVISIONING, "Provisioning info"},
   {IAX_IE_AESPROVISIONING, "AES Provisioning info"},
   {IAX_IE_DATETIME,"Date/Time"},
+  {IAX_IE_DEVICETYPE, "Device type"},
+  {IAX_IE_SERVICEIDENT, "Service Identifier"},
+  {IAX_IE_FIRMWAREVER, "Firmware revision"},
+  {IAX_IE_FWBLOCKDESC, "Firmware block description"},
+  {IAX_IE_FWBLOCKDATA, "Firmware block of data"},
+  {IAX_IE_PROVVER, "Provisioning version"},
+  {IAX_IE_CALLINGPRES, "Calling presentation"},
+  {IAX_IE_CALLINGTON, "Calling type of number"},
+  {IAX_IE_CALLINGTNS, "Calling transit network select"},
+  {IAX_IE_SAMPLINGRATE, "Supported sampling rates"},
+  {IAX_IE_CAUSECODE, "Hangup cause"},
+  {IAX_IE_ENCRYPTION, "Encryption format"},
+  {IAX_IE_ENCKEY, "Raw encryption key"},
+  {IAX_IE_CODEC_PREFS, "Codec preferences"},
+  {IAX_IE_RR_JITTER, "Received jitter"},
+  {IAX_IE_RR_LOSS, "Received loss"},
+  {IAX_IE_RR_PKTS, "Received frames"},
+  {IAX_IE_RR_DELAY, "Max playout delay in ms for received frames"},
+  {IAX_IE_RR_DROPPED, "Dropped frames"},
+  {IAX_IE_RR_OOO, "Frames received out of order"},
   {IAX_IE_DATAFORMAT, "Data call format"},
   {0,NULL}
 };
@@ -288,6 +335,53 @@
   {0,NULL}
 };
   
+static const value_string iax_causecodes[] = {
+  {AST_CAUSE_UNALLOCATED, "Unallocated"},
+  {AST_CAUSE_NO_ROUTE_TRANSIT_NET, "No route transit net"},
+  {AST_CAUSE_NO_ROUTE_DESTINATION, "No route to destination"},
+  {AST_CAUSE_CHANNEL_UNACCEPTABLE, "Channel unacceptable"},
+  {AST_CAUSE_CALL_AWARDED_DELIVERED, "Call awarded delivered"},
+  {AST_CAUSE_NORMAL_CLEARING, "Normal clearing"},
+  {AST_CAUSE_USER_BUSY, "User busy"},
+  {AST_CAUSE_NO_USER_RESPONSE, "No user response"},
+  {AST_CAUSE_NO_ANSWER, "No answer"},
+  {AST_CAUSE_CALL_REJECTED, "Call rejected"},
+  {AST_CAUSE_NUMBER_CHANGED, "Number changed"},
+  {AST_CAUSE_DESTINATION_OUT_OF_ORDER, "Destination out of order"},
+  {AST_CAUSE_INVALID_NUMBER_FORMAT, "Invalid number format"},
+  {AST_CAUSE_FACILITY_REJECTED, "Facility rejected"},
+  {AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY, "Response to status inquiry"},
+  {AST_CAUSE_NORMAL_UNSPECIFIED, "Normal unspecified"},
+  {AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, "Normal circuit congestion"},
+  {AST_CAUSE_NETWORK_OUT_OF_ORDER, "Network out of order"},
+  {AST_CAUSE_NORMAL_TEMPORARY_FAILURE, "Normal temporary failure"},
+  {AST_CAUSE_SWITCH_CONGESTION, "Switch congestion"},
+  {AST_CAUSE_ACCESS_INFO_DISCARDED, "Access info discarded"},
+  {AST_CAUSE_REQUESTED_CHAN_UNAVAIL, "Requested channel unavailable"},
+  {AST_CAUSE_PRE_EMPTED, "Preempted"},
+  {AST_CAUSE_FACILITY_NOT_SUBSCRIBED, "Facility not subscribed"},
+  {AST_CAUSE_OUTGOING_CALL_BARRED, "Outgoing call barred"},
+  {AST_CAUSE_INCOMING_CALL_BARRED, "Incoming call barred"},
+  {AST_CAUSE_BEARERCAPABILITY_NOTAUTH, "Bearer capability not authorized"},
+  {AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "Bearer capability not available"},
+  {AST_CAUSE_BEARERCAPABILITY_NOTIMPL, "Bearer capability not implemented"},
+  {AST_CAUSE_CHAN_NOT_IMPLEMENTED, "Channel not implemented"},
+  {AST_CAUSE_FACILITY_NOT_IMPLEMENTED, "Facility not implemented"},
+  {AST_CAUSE_INVALID_CALL_REFERENCE, "Invalid call reference"},
+  {AST_CAUSE_INCOMPATIBLE_DESTINATION, "Incompatible destination"},
+  {AST_CAUSE_INVALID_MSG_UNSPECIFIED, "Invalid message unspecified"},
+  {AST_CAUSE_MANDATORY_IE_MISSING, "Mandatory IE missing"},
+  {AST_CAUSE_MESSAGE_TYPE_NONEXIST, "Message type nonexistent"},
+  {AST_CAUSE_WRONG_MESSAGE, "Wrong message"},
+  {AST_CAUSE_IE_NONEXIST, "IE nonexistent"},
+  {AST_CAUSE_INVALID_IE_CONTENTS, "Invalid IE contents"},
+  {AST_CAUSE_WRONG_CALL_STATE, "Wrong call state"},
+  {AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "Recovery on timer expire"},
+  {AST_CAUSE_MANDATORY_IE_LENGTH_ERROR, "Mandatory IE length error"},
+  {AST_CAUSE_PROTOCOL_ERROR, "Protocol error"},
+  {AST_CAUSE_INTERWORKING, "Interworking"},
+};
+
 
 /* ************************************************************************* */
 
@@ -1065,6 +1159,98 @@
 	      proto_tree_add_item (ies_tree, hf_IAX_IE_TRANSFERID, tvb,
 				   offset + 2, ies_len, FALSE);
 	      break;
+	    case IAX_IE_PROVISIONING:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_PROVISIONING, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_AESPROVISIONING:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_AESPROVISIONING, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_DATETIME:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_DATETIME, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_DEVICETYPE:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_DEVICETYPE, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_SERVICEIDENT:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_SERVICEIDENT, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_FIRMWAREVER:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_FIRMWAREVER, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_FWBLOCKDESC:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_FWBLOCKDESC, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_FWBLOCKDATA:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_FWBLOCKDATA, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_PROVVER:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_PROVVER, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_CALLINGPRES:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_CALLINGPRES, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_CALLINGTON:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_CALLINGTON, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_CALLINGTNS:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_CALLINGTNS, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_SAMPLINGRATE:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_SAMPLINGRATE, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_CAUSECODE:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_CAUSECODE, tvb,
+				   offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_ENCRYPTION:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_ENCRYPTION, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_ENCKEY:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_ENCKEY, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_CODEC_PREFS:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_CODEC_PREFS, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_RR_JITTER:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_RR_JITTER, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_RR_LOSS:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_RR_LOSS, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_RR_PKTS:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_RR_PKTS, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_RR_DELAY:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_RR_DELAY, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_RR_DROPPED:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_RR_DROPPED, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
+	    case IAX_IE_RR_OOO:
+	      proto_tree_add_item (ies_tree, hf_IAX_IE_RR_OOO, tvb,
+				  offset +2, ies_len, FALSE);
+	      break;
 	      
       case IAX_IE_DATAFORMAT:
 	proto_tree_add_item (ies_tree, hf_IAX_IE_DATAFORMAT, tvb,
@@ -1736,6 +1922,79 @@
       0x0, "",
       HFILL}},
 
+    {&hf_IAX_IE_PROVISIONING,
+     {"Provisioning info","iax2.iax.provisioning", FT_STRING, BASE_NONE,
+       NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_AESPROVISIONING,
+     {"AES Provisioning info","iax2.iax.aesprovisioning", FT_STRING, BASE_NONE,
+       NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_DATETIME,
+     {"Date/Time", "iax2.iax.datetime", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_DEVICETYPE,
+     {"Device type", "iax2.iax.devicetype", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_SERVICEIDENT,
+     {"Service identifier", "iax2.iax.serviceident", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_FIRMWAREVER,
+     {"Firmware version", "iax2.iax.firmwarever", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_FWBLOCKDESC,
+     {"Firmware block description", "iax2.iax.fwblockdesc", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_FWBLOCKDATA,
+     {"Firmware block of data", "iax2.iax.fwblockdata", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_PROVVER,
+     {"Provisioning version", "iax2.iax.provver", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_CALLINGPRES,
+     {"Calling presentation", "iax2.iax.callingpres", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_CALLINGTON,
+     {"Calling type of number", "iax2.iax.callington", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_CALLINGTNS,
+     {"Calling transit network select", "iax2.iax.callingtns", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_SAMPLINGRATE,
+     {"Supported sampling rates", "iax2.iax.samplingrate", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_CAUSECODE,
+     {"Hangup cause", "iax2.iax.causecode", FT_UINT8, BASE_HEX, VALS(iax_causecodes),
+       0x0, "", HFILL}},
+
+    {&hf_IAX_IE_ENCRYPTION,
+     {"Encryption format", "iax2.iax.encryption", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_ENCKEY,
+     {"Encryption key", "iax2.iax.enckey", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_CODEC_PREFS,
+     {"Codec negotiation", "iax2.iax.codecprefs", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_RR_JITTER,
+     {"Received jitter (as in RFC1889)", "iax2.iax.rrjitter", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_RR_LOSS,
+     {"Received loss (high byte loss pct, low 24 bits loss count, as in rfc1889)", "iax2.iax.rrloss",
+       FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_RR_PKTS,
+     {"Total frames received", "iax2.iax.rrpkts", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_RR_DELAY,
+     {"Max playout delay in ms for received frames", "iax2.iax.rrdelay", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_RR_DROPPED,
+     {"Dropped frames (presumably by jitterbuffer)", "iax2.iax.rrdropped", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
+    {&hf_IAX_IE_RR_OOO,
+     {"Frame received out of order", "iax2.iax.rrooo", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL}},
+
     {&hf_IAX_IE_DATAFORMAT,
      {"Data call format", "iax2.iax.dataformat", FT_UINT32, BASE_HEX,
       VALS(iax_dataformats), 0x0, "", HFILL}},
--- packet-iax2.h	2005-03-10 10:53:43.000000000 -0500
+++ packet-iax2.h.patched	2005-04-01 18:06:49.000000000 -0500
@@ -17,9 +17,9 @@
 #define _PACKET_IAX2_H
 
 /* Max version of IAX protocol we support */
-#define IAX_PROTO_VERSION 2
+#define IAX_PROTO_VERSION	2
 
-#define IAX_MAX_CALLS 32768
+#define IAX_MAX_CALLS		32768
 
 #define IAX_FLAG_FULL		0x8000
 
@@ -29,7 +29,7 @@
 
 #define IAX_MAX_SHIFT		0x1F
 
-#define IAX_WINDOW			64
+#define IAX_WINDOW		64
 
 #define AST_FRAME_DTMF      1       /* A DTMF digit, subclass is the digit */
 #define AST_FRAME_VOICE     2       /* Voice data, subclass is AST_FORMAT_* */
@@ -70,52 +70,121 @@
 #define IAX_COMMAND_TXREL	26	/* Transfer release */
 #define IAX_COMMAND_TXREJ	27	/* Transfer reject */
 #define IAX_COMMAND_QUELCH	28	/* Stop audio/video transmission */
-#define IAX_COMMAND_UNQUELCH 29	/* Resume audio/video transmission */
-#define IAX_COMMAND_POKE    30  /* Like ping, but does not require an open connection */
+#define IAX_COMMAND_UNQUELCH	29	/* Resume audio/video transmission */
+#define IAX_COMMAND_POKE	30	/* Like ping, but does not require an open connection */
 #define IAX_COMMAND_PAGE	31	/* Paging description */
-#define IAX_COMMAND_MWI	32	/* Stand-alone message waiting indicator */
+#define IAX_COMMAND_MWI		32	/* Stand-alone message waiting indicator */
 #define IAX_COMMAND_UNSUPPORT	33	/* Unsupported message received */
 #define IAX_COMMAND_TRANSFER	34	/* Request remote transfer */
+#define IAX_COMMAND_PROVISION   35      /* Provision device */
+#define IAX_COMMAND_FWDOWNL     36      /* Download firmware */
+#define IAX_COMMAND_FWDATA      37      /* Firmware Data */
 
 #define IAX_DEFAULT_REG_EXPIRE  60	/* By default require re-registration once per minute */
 
-#define IAX_LINGER_TIMEOUT		10 /* How long to wait before closing bridged call */
+#define IAX_LINGER_TIMEOUT	10	/* How long to wait before closing bridged call */
 
-#define IAX_DEFAULT_PORTNO		4569
+#define IAX_DEFAULT_PORTNO	4569
 
 /* IAX Information elements */
 #define IAX_IE_CALLED_NUMBER		1		/* Number/extension being called - string */
 #define IAX_IE_CALLING_NUMBER		2		/* Calling number - string */
-#define IAX_IE_CALLING_ANI			3		/* Calling number ANI for billing  - string */
-#define IAX_IE_CALLING_NAME			4		/* Name of caller - string */
+#define IAX_IE_CALLING_ANI		3		/* Calling number ANI for billing  - string */
+#define IAX_IE_CALLING_NAME		4		/* Name of caller - string */
 #define IAX_IE_CALLED_CONTEXT		5		/* Context for number - string */
-#define IAX_IE_USERNAME				6		/* Username (peer or user) for authentication - string */
-#define IAX_IE_PASSWORD				7		/* Password for authentication - string */
-#define IAX_IE_CAPABILITY			8		/* Actual codec capability - unsigned int */
-#define IAX_IE_FORMAT				9		/* Desired codec format - unsigned int */
-#define IAX_IE_LANGUAGE				10		/* Desired language - string */
-#define IAX_IE_VERSION				11		/* Protocol version - short */
-#define IAX_IE_ADSICPE				12		/* CPE ADSI capability - short */
-#define IAX_IE_DNID					13		/* Originally dialed DNID - string */
-#define IAX_IE_AUTHMETHODS			14		/* Authentication method(s) - short */
-#define IAX_IE_CHALLENGE			15		/* Challenge data for MD5/RSA - string */
-#define IAX_IE_MD5_RESULT			16		/* MD5 challenge result - string */
-#define IAX_IE_RSA_RESULT			17		/* RSA challenge result - string */
+#define IAX_IE_USERNAME			6		/* Username (peer or user) for authentication - string */
+#define IAX_IE_PASSWORD			7		/* Password for authentication - string */
+#define IAX_IE_CAPABILITY		8		/* Actual codec capability - unsigned int */
+#define IAX_IE_FORMAT			9		/* Desired codec format - unsigned int */
+#define IAX_IE_LANGUAGE			10		/* Desired language - string */
+#define IAX_IE_VERSION			11		/* Protocol version - short */
+#define IAX_IE_ADSICPE			12		/* CPE ADSI capability - short */
+#define IAX_IE_DNID			13		/* Originally dialed DNID - string */
+#define IAX_IE_AUTHMETHODS		14		/* Authentication method(s) - short */
+#define IAX_IE_CHALLENGE		15		/* Challenge data for MD5/RSA - string */
+#define IAX_IE_MD5_RESULT		16		/* MD5 challenge result - string */
+#define IAX_IE_RSA_RESULT		17		/* RSA challenge result - string */
 #define IAX_IE_APPARENT_ADDR		18		/* Apparent address of peer - struct sockaddr_in */
-#define IAX_IE_REFRESH				19		/* When to refresh registration - short */
-#define IAX_IE_DPSTATUS				20		/* Dialplan status - short */
-#define IAX_IE_CALLNO				21		/* Call number of peer - short */
-#define IAX_IE_CAUSE				22		/* Cause - string */
-#define IAX_IE_IAX_UNKNOWN			23		/* Unknown IAX command - byte */
-#define IAX_IE_MSGCOUNT				24		/* How many messages waiting - short */
-#define IAX_IE_AUTOANSWER			25		/* Request auto-answering -- none */
-#define IAX_IE_MUSICONHOLD			26		/* Request musiconhold with QUELCH -- none or string */
-#define IAX_IE_TRANSFERID			27		/* Transfer Request Identifier -- int */
-#define IAX_IE_RDNIS				28		/* Referring DNIS -- string */
-#define IAX_IE_PROVISIONING			29		/* Provisioning info */
-#define IAX_IE_AESPROVISIONING			30		/* AES Provisioning info */
-#define IAX_IE_DATETIME				31		/* Date/Time */
-#define IAX_IE_DATAFORMAT			255		/* Data call format -- iax_dataformat_t */
+#define IAX_IE_REFRESH			19		/* When to refresh registration - short */
+#define IAX_IE_DPSTATUS			20		/* Dialplan status - short */
+#define IAX_IE_CALLNO			21		/* Call number of peer - short */
+#define IAX_IE_CAUSE			22		/* Cause - string */
+#define IAX_IE_IAX_UNKNOWN		23		/* Unknown IAX command - byte */
+#define IAX_IE_MSGCOUNT			24		/* How many messages waiting - short */
+#define IAX_IE_AUTOANSWER		25		/* Request auto-answering -- none */
+#define IAX_IE_MUSICONHOLD		26		/* Request musiconhold with QUELCH -- none or string */
+#define IAX_IE_TRANSFERID		27		/* Transfer Request Identifier -- int */
+#define IAX_IE_RDNIS			28		/* Referring DNIS -- string */
+#define IAX_IE_PROVISIONING		29		/* Provisioning info */
+#define IAX_IE_AESPROVISIONING		30		/* AES Provisioning info */
+#define IAX_IE_DATETIME			31		/* Date/Time -- unsigned int */
+#define IAX_IE_DEVICETYPE		32		/* Device Type -- string */
+#define IAX_IE_SERVICEIDENT		33		/* Service Identifier -- string */
+#define IAX_IE_FIRMWAREVER		34		/* Firmware revision -- u16 */
+#define IAX_IE_FWBLOCKDESC		35		/* Firmware block description -- u32 */
+#define IAX_IE_FWBLOCKDATA		36		/* Firmware block of data -- raw */
+#define IAX_IE_PROVVER			37		/* Provisioning Version (u32) */
+#define IAX_IE_CALLINGPRES		38		/* Calling presentation (u8) */
+#define IAX_IE_CALLINGTON		39		/* Calling type of number (u8) */
+#define IAX_IE_CALLINGTNS		40		/* Calling transit network select (u16) */
+#define IAX_IE_SAMPLINGRATE		41		/* Supported sampling rates (u16) */
+#define IAX_IE_CAUSECODE		42		/* Hangup cause (u8) */
+#define IAX_IE_ENCRYPTION		43		/* Encryption format (u16) */
+#define IAX_IE_ENCKEY			44		/* Encryption key (raw) */
+#define IAX_IE_CODEC_PREFS		45		/* Codec Negotiation */
+#define IAX_IE_RR_JITTER		46		/* Received jitter (as in RFC1889) u32 */
+#define IAX_IE_RR_LOSS			47		/* Received loss (high byte loss pct, low 24 bits loss count, as in rfc1889 */
+#define IAX_IE_RR_PKTS			48		/* Received frames (total frames received) u32 */
+#define IAX_IE_RR_DELAY			49		/* Max playout delay for received frames (in ms) u16 */
+#define IAX_IE_RR_DROPPED		50		/* Dropped frames (presumably by jitterbuf) u32 */
+#define IAX_IE_RR_OOO			51		/* Frames received Out of Order u32 */
+#define IAX_IE_DATAFORMAT		255		/* Data call format -- iax_dataformat_t */
+
+/* hangup cause codes */
+#define AST_CAUSE_UNALLOCATED				1
+#define AST_CAUSE_NO_ROUTE_TRANSIT_NET			2
+#define AST_CAUSE_NO_ROUTE_DESTINATION			3
+#define AST_CAUSE_CHANNEL_UNACCEPTABLE			6
+#define AST_CAUSE_CALL_AWARDED_DELIVERED		7
+#define AST_CAUSE_NORMAL_CLEARING			16
+#define AST_CAUSE_USER_BUSY				17
+#define AST_CAUSE_NO_USER_RESPONSE			18
+#define AST_CAUSE_NO_ANSWER				19
+#define AST_CAUSE_CALL_REJECTED				21
+#define AST_CAUSE_NUMBER_CHANGED			22
+#define AST_CAUSE_DESTINATION_OUT_OF_ORDER		27
+#define AST_CAUSE_INVALID_NUMBER_FORMAT			28
+#define AST_CAUSE_FACILITY_REJECTED			29
+#define AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY		30
+#define AST_CAUSE_NORMAL_UNSPECIFIED			31
+#define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION		34
+#define AST_CAUSE_NETWORK_OUT_OF_ORDER			38
+#define AST_CAUSE_NORMAL_TEMPORARY_FAILURE		41
+#define AST_CAUSE_SWITCH_CONGESTION			42
+#define AST_CAUSE_ACCESS_INFO_DISCARDED			43
+#define AST_CAUSE_REQUESTED_CHAN_UNAVAIL		44
+#define AST_CAUSE_PRE_EMPTED				45
+#define AST_CAUSE_FACILITY_NOT_SUBSCRIBED		50
+#define AST_CAUSE_OUTGOING_CALL_BARRED			52
+#define AST_CAUSE_INCOMING_CALL_BARRED			54
+#define AST_CAUSE_BEARERCAPABILITY_NOTAUTH		57
+#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL		58
+#define AST_CAUSE_BEARERCAPABILITY_NOTIMPL		65
+#define AST_CAUSE_CHAN_NOT_IMPLEMENTED			66
+#define AST_CAUSE_FACILITY_NOT_IMPLEMENTED		69
+#define AST_CAUSE_INVALID_CALL_REFERENCE		81
+#define AST_CAUSE_INCOMPATIBLE_DESTINATION		88
+#define AST_CAUSE_INVALID_MSG_UNSPECIFIED		95
+#define AST_CAUSE_MANDATORY_IE_MISSING			96
+#define AST_CAUSE_MESSAGE_TYPE_NONEXIST			97
+#define AST_CAUSE_WRONG_MESSAGE				98
+#define AST_CAUSE_IE_NONEXIST				99
+#define AST_CAUSE_INVALID_IE_CONTENTS			100
+#define AST_CAUSE_WRONG_CALL_STATE			101
+#define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE		102
+#define AST_CAUSE_MANDATORY_IE_LENGTH_ERROR		103
+#define AST_CAUSE_PROTOCOL_ERROR			111
+#define AST_CAUSE_INTERWORKING				127
 
 #define IAX_AUTH_PLAINTEXT			(1 << 0)
 #define IAX_AUTH_MD5				(1 << 1)
@@ -124,7 +193,7 @@
 #define IAX_META_TRUNK				1		/* Trunk meta-message */
 #define IAX_META_VIDEO				2		/* Video frame */
 
-#define IAX_DPSTATUS_EXISTS			(1 << 0)
+#define IAX_DPSTATUS_EXISTS		(1 << 0)
 #define IAX_DPSTATUS_CANEXIST		(1 << 1)
 #define IAX_DPSTATUS_NONEXISTANT	(1 << 2)
 #define IAX_DPSTATUS_IGNOREPAT		(1 << 14)