diff --git a/apps/app_macro.c b/apps/app_macro.c
index fb48edc21669f7b8984ae9cd97cfb5dc2f0502e7..a8065f6ed54495663e6809b6bb7c3850d550e0f5 100755
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -88,7 +88,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
 	char oldexten[256]="";
 	int oldpriority;
 	char pc[80];
-	char oldcontext[256] = "";
+	char oldcontext[AST_MAX_CONTEXT] = "";
 	char *offsets;
 	int offset;
 	int setmacrocontext=0;
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 2a71606021ecbae608f30349d6aa96ea58e3e1a9..fadd5f544b8734aa3e5591d9d65e7f298bd4592a 100755
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -642,7 +642,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
 	char *agifile;
 	char *agifiledefault = "conf-background.agi";
 	char meetmesecs[30] = "";
-	char exitcontext[AST_MAX_EXTENSION] = "";
+	char exitcontext[AST_MAX_CONTEXT] = "";
 	char recordingtmp[AST_MAX_EXTENSION] = "";
 	int dtmf;
 
diff --git a/apps/app_queue.c b/apps/app_queue.c
index cae7e5ef636bc98b0ee41ce48adf73062b135143..2ea4e849a3233f4eff76d26da5911a8bfe2cc21a 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -233,7 +233,7 @@ struct queue_ent {
 	struct ast_call_queue *parent;	/* What queue is our parent */
 	char moh[80];			/* Name of musiconhold to be used */
 	char announce[80];		/* Announcement to play for member when call is answered */
-	char context[80];		/* Context when user exits queue */
+	char context[AST_MAX_CONTEXT];	/* Context when user exits queue */
 	int pos;			/* Where we are in the queue */
 	int prio;			/* Our priority */
 	int last_pos_said;              /* Last position we told the user */
@@ -269,7 +269,7 @@ struct ast_call_queue {
 	char name[80];			/* Name */
 	char moh[80];			/* Music On Hold class to be used */
 	char announce[80];		/* Announcement to play when call is answered */
-	char context[80];		/* Exit context */
+	char context[AST_MAX_CONTEXT];	/* Exit context */
 		unsigned int monjoin:1;
 		unsigned int dead:1;
 		unsigned int joinempty:2;
@@ -1853,7 +1853,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
 	int to;
 	char restofit[AST_MAX_EXTENSION];
 	char oldexten[AST_MAX_EXTENSION]="";
-	char oldcontext[AST_MAX_EXTENSION]="";
+	char oldcontext[AST_MAX_CONTEXT]="";
 	char queuename[256]="";
 	char *newnum;
 	char *monitorfilename;
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 2d33d55efcb7a3b87463738546c0416ec9e521e4..c65d504b1809e52ff437158aa1a65a43cd2535b8 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -158,8 +158,8 @@ struct baseio {
 
 /* Structure for linked list of users */
 struct ast_vm_user {
-	char context[80];		/* Voicemail context */
-	char mailbox[80];		/* Mailbox id, unique within vm context */
+	char context[AST_MAX_CONTEXT];	/* Voicemail context */
+	char mailbox[AST_MAX_EXTENSION];/* Mailbox id, unique within vm context */
 	char password[80];		/* Secret pin code, numbers only */
 	char fullname[80];		/* Full name, for directory app */
 	char email[80];			/* E-mail address */
@@ -321,9 +321,9 @@ static struct ast_flags globalflags = {0};
 
 static int saydurationminfo;
 
-static char dialcontext[80];
-static char callcontext[80];
-static char exitcontext[80];
+static char dialcontext[AST_MAX_CONTEXT];
+static char callcontext[AST_MAX_CONTEXT];
+static char exitcontext[AST_MAX_CONTEXT];
 
 static char cidinternalcontexts[MAX_NUM_CID_CONTEXTS][64];
 
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index bdf273ec027bd3ad42b51f4369b34ed3332cad18..0fd44922bf167bcc7f0aea593e10dc77ef891e32 100755
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -91,7 +91,7 @@ static const char desc[] = "ALSA Console Channel Driver";
 static const char tdesc[] = "ALSA Console Channel Driver";
 static const char config[] = "alsa.conf";
 
-static char context[AST_MAX_EXTENSION] = "default";
+static char context[AST_MAX_CONTEXT] = "default";
 static char language[MAX_LANGUAGE] = "";
 static char exten[AST_MAX_EXTENSION] = "s";
 
@@ -124,7 +124,7 @@ static struct chan_alsa_pvt {
 	   keeps this driver as simple as possible -- as it should be. */
 	struct ast_channel *owner;
 	char exten[AST_MAX_EXTENSION];
-	char context[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
 #if 0
 	snd_pcm_t *card;
 #endif
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 671e9e40177150886f9d039a26bccff0e2fa5085..e306131d4386601799f08d0c0c96337bac62883b 100755
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -98,7 +98,7 @@ static const char type[] = "H323";
 static const char desc[] = "The NuFone Network's Open H.323 Channel Driver";
 static const char tdesc[] = "The NuFone Network's Open H.323 Channel Driver";
 static const char config[] = "h323.conf";
-static char default_context[AST_MAX_EXTENSION] = "default";
+static char default_context[AST_MAX_CONTEXT] = "default";
 static struct sockaddr_in bindaddr;
 
 /** H.323 configuration values */
@@ -129,7 +129,7 @@ struct oh323_pvt {
 	int nonCodecCapability;					/* non-audio capability */
 	int outgoing;						/* Outgoing or incoming call? */
 	char exten[AST_MAX_EXTENSION];				/* Requested extension */
-	char context[AST_MAX_EXTENSION];			/* Context where to start */
+	char context[AST_MAX_CONTEXT];				/* Context where to start */
 	char accountcode[256];					/* Account code */
 	char cid_num[80];					/* Caller*id number, if available */
 	char cid_name[80];					/* Caller*id name, if available */
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 7b4f556e981e8ca3251717671d7b9676126f223b..4889d4efdccbef687db498273ee0f346409d9dc1 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -127,7 +127,7 @@ static const char channeltype[] = "IAX2";
 static char context[80] = "default";
 
 static char language[MAX_LANGUAGE] = "";
-static char regcontext[AST_MAX_EXTENSION] = "";
+static char regcontext[AST_MAX_CONTEXT] = "";
 
 static int max_retries = 4;
 static int ping_time = 20;
@@ -217,7 +217,7 @@ static pthread_t netthreadid = AST_PTHREADT_NULL;
 #define IAX_STATE_TBD			(1 << 2)
 
 struct iax2_context {
-	char context[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
 	struct iax2_context *next;
 };
 
@@ -277,7 +277,7 @@ struct iax2_peer {
 	char secret[80];
 	char dbsecret[80];
 	char outkey[80];				/* What key we use to talk to this peer */
-	char context[AST_MAX_EXTENSION];		/* For transfers only */
+	char context[AST_MAX_CONTEXT];			/* For transfers only */
 	char regexten[AST_MAX_EXTENSION];		/* Extension to register (if regcontext is used) */
 	char peercontext[AST_MAX_EXTENSION];		/* Context to pass to peer */
 	char mailbox[AST_MAX_EXTENSION];		/* Mailbox */
@@ -605,7 +605,7 @@ static struct ast_firmware_list {
 #define CACHE_FLAG_MATCHMORE	(1 << 7)
 
 static struct iax2_dpcache {
-	char peercontext[AST_MAX_EXTENSION];
+	char peercontext[AST_MAX_CONTEXT];
 	char exten[AST_MAX_EXTENSION];
 	struct timeval orig;
 	struct timeval expirey;
@@ -2654,8 +2654,8 @@ struct create_addr_info {
 	char outkey[80];
 	char timezone[80];
 	char prefs[32];
-	char context[AST_MAX_EXTENSION];
-	char peercontext[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
+	char peercontext[AST_MAX_CONTEXT];
 };
 
 static int create_addr(const char *peername, struct sockaddr_in *sin, struct create_addr_info *cai)
diff --git a/channels/chan_local.c b/channels/chan_local.c
index a16e07ed2eba6ee5f1071fbf9b99f843d2484574..fd8c7f318d0cd3e631ea8bd1c22be01f8f4877ad 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -87,18 +87,18 @@ static const struct ast_channel_tech local_tech = {
 };
 
 static struct local_pvt {
-	ast_mutex_t lock;				/* Channel private lock */
-	char context[AST_MAX_EXTENSION];	/* Context to call */
+	ast_mutex_t lock;			/* Channel private lock */
+	char context[AST_MAX_CONTEXT];		/* Context to call */
 	char exten[AST_MAX_EXTENSION];		/* Extension to call */
-	int reqformat;						/* Requested format */
-	int glaredetect;					/* Detect glare on hangup */
-	int cancelqueue;					/* Cancel queue */
-	int alreadymasqed;					/* Already masqueraded */
-	int launchedpbx;					/* Did we launch the PBX */
+	int reqformat;				/* Requested format */
+	int glaredetect;			/* Detect glare on hangup */
+	int cancelqueue;			/* Cancel queue */
+	int alreadymasqed;			/* Already masqueraded */
+	int launchedpbx;			/* Did we launch the PBX */
 	int nooptimization;
-	struct ast_channel *owner;			/* Master Channel */
-	struct ast_channel *chan;			/* Outbound channel */
-	struct local_pvt *next;				/* Next entity */
+	struct ast_channel *owner;		/* Master Channel */
+	struct ast_channel *chan;		/* Outbound channel */
+	struct local_pvt *next;			/* Next entity */
 } *locals = NULL;
 
 static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index c4b05101e77383639d972a4cd1fa1a2e5dda8d08..8b61abf87b012f1cb78fd50f6f4b4722594d0bf5 100755
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -87,7 +87,7 @@ static const char desc[] = "OSS Console Channel Driver";
 static const char tdesc[] = "OSS Console Channel Driver";
 static const char config[] = "oss.conf";
 
-static char context[AST_MAX_EXTENSION] = "default";
+static char context[AST_MAX_CONTEXT] = "default";
 static char language[MAX_LANGUAGE] = "";
 static char exten[AST_MAX_EXTENSION] = "s";
 
@@ -120,7 +120,7 @@ static struct chan_oss_pvt {
 	   keeps this driver as simple as possible -- as it should be. */
 	struct ast_channel *owner;
 	char exten[AST_MAX_EXTENSION];
-	char context[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
 } oss;
 
 static struct ast_channel *oss_request(const char *type, int format, void *data, int *cause);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5ed890f2b234fe5fc737d8ae24f5c934fd4686c9..80374497cc71e55ebfe0e7c50c3b76ad262b758b 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -262,7 +262,7 @@ const struct cfsip_options {
 static char default_useragent[AST_MAX_EXTENSION] = DEFAULT_USERAGENT;
 
 #define DEFAULT_CONTEXT "default"
-static char default_context[AST_MAX_EXTENSION] = DEFAULT_CONTEXT;
+static char default_context[AST_MAX_CONTEXT] = DEFAULT_CONTEXT;
 
 static char default_language[MAX_LANGUAGE] = "";
 
@@ -351,7 +351,7 @@ static int recordhistory = 0;				/* Record SIP history. Off by default */
 static char global_musicclass[MAX_MUSICCLASS] = "";	/* Global music on hold class */
 #define DEFAULT_REALM	"asterisk"
 static char global_realm[MAXHOSTNAMELEN] = DEFAULT_REALM; 	/* Default realm */
-static char regcontext[AST_MAX_EXTENSION] = "";		/* Context for auto-extensions */
+static char regcontext[AST_MAX_CONTEXT] = "";		/* Context for auto-extensions */
 
 /* Expire slowly */
 #define DEFAULT_EXPIRY 900
@@ -516,7 +516,7 @@ static struct sip_pvt {
 	int route_persistant;			/* Is this the "real" route? */
 	char from[256];				/* The From: header */
 	char useragent[256];			/* User agent in SIP request */
-	char context[AST_MAX_EXTENSION];	/* Context for this call */
+	char context[AST_MAX_CONTEXT];		/* Context for this call */
 	char fromdomain[MAXHOSTNAMELEN];	/* Domain to show in the from field */
 	char fromuser[AST_MAX_EXTENSION];	/* User to show in the user field */
 	char fromname[AST_MAX_EXTENSION];	/* Name to show in the user field */
@@ -600,7 +600,7 @@ struct sip_user {
 	ASTOBJ_COMPONENTS(struct sip_user);
 	char secret[80];		/* Password */
 	char md5secret[80];		/* Password in md5 */
-	char context[AST_MAX_EXTENSION];	/* Default context for incoming calls */
+	char context[AST_MAX_CONTEXT];	/* Default context for incoming calls */
 	char cid_num[80];		/* Caller ID num */
 	char cid_name[80];		/* Caller ID name */
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/* Account code */
@@ -631,7 +631,7 @@ struct sip_peer {
 	char secret[80];		/* Password */
 	char md5secret[80];		/* Password in MD5 */
 	struct sip_auth *auth;		/* Realm authentication list */
-	char context[AST_MAX_EXTENSION];	/* Default context for incoming calls */
+	char context[AST_MAX_CONTEXT];	/* Default context for incoming calls */
 	char username[80];		/* Temporary username until registration */ 
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/* Account code */
 	int amaflags;			/* AMA Flags (for billing) */
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 45d5db23d8c833c53304197e81936a78185c20fb..545dc29dd3b3fda4678bf28169d90b8ebe414286 100755
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -672,7 +672,7 @@ struct ast_hostent ahp; struct hostent *hp;
 static int skinnysock  = -1;
 static pthread_t tcp_thread;
 static pthread_t accept_t;
-static char context[AST_MAX_EXTENSION] = "default";
+static char context[AST_MAX_CONTEXT] = "default";
 static char language[MAX_LANGUAGE] = "";
 static char musicclass[MAX_MUSICCLASS] = "";
 static char cid_num[AST_MAX_EXTENSION] = "";
@@ -816,7 +816,7 @@ struct skinny_line {
   	struct skinny_subchannel *sub;			/* pointer to our current connection, channel and stuff */
 	char accountcode[AST_MAX_ACCOUNT_CODE];
 	char exten[AST_MAX_EXTENSION];			/* Extention where to start */
-	char context[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
 	char language[MAX_LANGUAGE];
 	char cid_num[AST_MAX_EXTENSION];		/* Caller*ID */
 	char cid_name[AST_MAX_EXTENSION];		/* Caller*ID */
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index e3ac80dc4e8e4a5db916bf602d5b9b2153715b4e..f1ff5ffa8bce3513613a397693f03204c94318d0 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -165,7 +165,7 @@ static const char config[] = "zapata.conf";
 
 static int cur_emdigitwait = 250; /* Wait time in ms for digits on EM channel */
 
-static char context[AST_MAX_EXTENSION] = "default";
+static char context[AST_MAX_CONTEXT] = "default";
 static char cid_num[256] = "";
 static char cid_name[256] = "";
 static char defaultcic[64] = "";
@@ -371,7 +371,7 @@ struct zt_pri {
 	pthread_t master;						/* Thread of master */
 	ast_mutex_t lock;						/* Mutex */
 	char idleext[AST_MAX_EXTENSION];				/* Where to idle extra calls */
-	char idlecontext[AST_MAX_EXTENSION];				/* What context to use for idle */
+	char idlecontext[AST_MAX_CONTEXT];				/* What context to use for idle */
 	char idledial[AST_MAX_EXTENSION];				/* What to dial before dumping */
 	int minunused;							/* Min # of channels to keep empty */
 	int minidle;							/* Min # of "idling" calls to keep active */
@@ -449,7 +449,7 @@ struct distRingData {
 	int ring[3];
 };
 struct ringContextData {
-	char contextData[AST_MAX_EXTENSION];
+	char contextData[AST_MAX_CONTEXT];
 };
 struct zt_distRings {
 	struct distRingData ringnum[3];
@@ -562,8 +562,8 @@ static struct zt_pvt {
 
 	struct zt_distRings drings;
 
-	char context[AST_MAX_EXTENSION];
-	char defcontext[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
+	char defcontext[AST_MAX_CONTEXT];
 	char exten[AST_MAX_EXTENSION];
 	char language[MAX_LANGUAGE];
 	char musicclass[MAX_MUSICCLASS];
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 9380d7884d99c6c5aa709ba88134eb1ed92583cf..49a73420e3f8c8d7e71c139b1f35459e863fb165 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -36,20 +36,21 @@ extern "C" {
 #include "asterisk/lock.h"
 
 /*! Max length of an extension */
-#define AST_MAX_EXTENSION 80
+#define AST_MAX_EXTENSION	80
+
+#define AST_MAX_CONTEXT		80
 
 #include "asterisk/cdr.h"
 #include "asterisk/monitor.h"
 #include "asterisk/utils.h"
 
+#define AST_CHANNEL_NAME	80
 
-#define AST_CHANNEL_NAME 80
-
-#define MAX_LANGUAGE 20
+#define MAX_LANGUAGE		20
 
-#define MAX_MUSICCLASS 20
+#define MAX_MUSICCLASS		20
 
-#define AST_MAX_FDS 8
+#define AST_MAX_FDS		8
 
 typedef unsigned long long ast_group_t;
 
@@ -256,9 +257,9 @@ struct ast_channel {
 	struct ast_callerid cid;
 		
 	/*! Current extension context */
-	char context[AST_MAX_EXTENSION];	
+	char context[AST_MAX_CONTEXT];
 	/*! Current non-macro context */
-	char macrocontext[AST_MAX_EXTENSION];	
+	char macrocontext[AST_MAX_CONTEXT];	
 	/*! Current non-macro extension */
 	char macroexten[AST_MAX_EXTENSION];
 	/*! Current non-macro priority */
diff --git a/pbx.c b/pbx.c
index f4deb884dcc5ac8476544a9ed86ef0c39b8f13d3..d872bd2333e9cf07ba3fc4de5176205eef8753e1 100755
--- a/pbx.c
+++ b/pbx.c
@@ -4632,7 +4632,7 @@ int ast_add_extension2(struct ast_context *con,
 struct async_stat {
 	pthread_t p;
 	struct ast_channel *chan;
-	char context[AST_MAX_EXTENSION];
+	char context[AST_MAX_CONTEXT];
 	char exten[AST_MAX_EXTENSION];
 	int priority;
 	int timeout;