diff --git a/apps/app_agi.c b/apps/app_agi.c
index 7c7b653f2314639a57da1ac04be4504fa4d2c664..3e332afc5224692c80eb4489fdec4c0cb07c6a0f 100755
--- a/apps/app_agi.c
+++ b/apps/app_agi.c
@@ -452,13 +452,13 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
 	int res = 0;
 	int ms;
 
-        struct ast_dsp *sildet;         /* silence detector dsp */
+        struct ast_dsp *sildet=NULL;         /* silence detector dsp */
         int totalsilence = 0;
         int dspsilence = 0;
         int silence = 0;                /* amount of silence to allow */
         int gotsilence = 0;             /* did we timeout for silence? */
-        char *silencestr;
-        int rfmt;
+        char *silencestr=NULL;
+        int rfmt=0;
 
 
 	/* XXX EAGI FIXME XXX */
diff --git a/apps/app_enumlookup.c b/apps/app_enumlookup.c
index d547f8a7c9bbf75cce89bb2652e3f556f5e0d23f..4f132a5183f010e6fe4daa82fb0a21bcb4e956ce 100755
--- a/apps/app_enumlookup.c
+++ b/apps/app_enumlookup.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 
 #include <pthread.h>
 
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 23d7dc10f0b9a6f4df9ec6ec08eb715f5316d143..acc268e3600db0af6110eb759439650df325d2d8 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -48,7 +48,7 @@ static char *synopsis = "Say text to the user";
 static char *descrip = 
 "  Festival(text[|intkeys]):  Connect to Festival, send the argument, get back the waveform,"
 "play it to the user, allowing any given interrupt keys to immediately terminate and return\n"
-"the value.\n";
+"the value, or 'any' to allow any number back (useful in dialplan)\n";
 
 STANDARD_LOCAL_USER;
 
@@ -122,7 +122,7 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
 }
 
 
-static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length) {
+static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys) {
 	int res=0;
 	int fds[2];
 	int ms = -1;
@@ -170,9 +170,11 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
 			}
 			if (f->frametype == AST_FRAME_DTMF) {
 				ast_log(LOG_DEBUG, "User pressed a key\n");
-				ast_frfree(f);
-				res = 0;
-				break;
+				if (strchr(intkeys, f->subclass)) {
+					res = f->subclass;
+					ast_frfree(f);
+					break;
+				}
 			}
 			if (f->frametype == AST_FRAME_VOICE) {
 				/* Treat as a generator */
@@ -224,7 +226,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
 
 
 
-static int festival_exec(struct ast_channel *chan, void *data)
+static int festival_exec(struct ast_channel *chan, void *vdata)
 {
 	int usecache;
 	int res=0;
@@ -253,9 +255,11 @@ static int festival_exec(struct ast_channel *chan, void *data)
 	int readcache=0;
 	int writecache=0;
 	int strln;
-	int fdesc;
+	int fdesc = -1;
 	char buffer[16384];
-	int seekpos;	
+	int seekpos = 0;	
+	char data[256] = "";
+	char *intstr;
 	
 	struct ast_config *cfg;
 	cfg = ast_load(FESTIVAL_CONFIG);
@@ -285,10 +289,17 @@ static int festival_exec(struct ast_channel *chan, void *data)
 	
 		
 
-	if (!data) {
+	if (!vdata || !strlen(vdata)) {
 		ast_log(LOG_WARNING, "festival requires an argument (text)\n");
 		return -1;
 	}
+	strncpy(data, vdata, sizeof(data) - 1);
+	if ((intstr = strchr(data, '|'))) {
+		*intstr = '\0';
+		intstr++;
+		if (!strcasecmp(intstr, "any"))
+			intstr = AST_DIGIT_ANY;
+	}
 	LOCAL_USER_ADD(u);
 	ast_log(LOG_WARNING, "Text passed to festival server : %s\n",(char *)data);
 	/* Connect to local festival server */
@@ -398,7 +409,7 @@ static int festival_exec(struct ast_channel *chan, void *data)
 		if (strcmp(ack,"WV\n") == 0) {         /* receive a waveform */
 			ast_log(LOG_WARNING,"Festival WV command");
 			waveform = socket_receive_file_to_buff(fd,&filesize);
-			send_waveform_to_channel(chan,waveform,filesize);
+			send_waveform_to_channel(chan,waveform,filesize, intstr);
 			free(waveform);
 			res=0;
 			break;
diff --git a/apps/app_queue.c b/apps/app_queue.c
index e4dc2a4ff26598ec3923f2c3248e69d0696a5ad3..1b5088c9567457e08a2b8380a7345bc45244f03f 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -140,6 +140,7 @@ struct member {
 	char loc[256];				/* Location */
 	int penalty;				/* Are we a last resort? */
 	int calls;
+	int dynamic;				/* Are we dynamically added? */
 	time_t lastcall;	/* When last successful call was hungup */
 	struct member *next;		/* Next member */
 };
@@ -245,14 +246,22 @@ ast_log(LOG_NOTICE, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, q
 
 static void free_members(struct ast_call_queue *q)
 {
-	struct member *curm, *next;
+	/* Free non-dynamic members */
+	struct member *curm, *next, *prev;
 	curm = q->members;
+	prev = NULL;
 	while(curm) {
 		next = curm->next;
-		free(curm);
+		if (!curm->dynamic) {
+			if (prev)
+				prev->next = next;
+			else
+				q->members = next;
+			free(curm);
+		} else 
+			prev = curm;
 		curm = next;
 	}
-	q->members = NULL;
 }
 
 static void destroy_queue(struct ast_call_queue *q)
@@ -1044,9 +1053,10 @@ static int aqm_exec(struct ast_channel *chan, void *data)
 					save = q->members ;
 					q->members = create_queue_node( interface ) ;
 
-					if( q->members != NULL )
+					if( q->members != NULL ) {
+						q->members->dynamic = 1;
 						q->members->next = save ;
-					else
+					} else
 						q->members = save ;
 
 					ast_log(LOG_NOTICE, "Added interface '%s' to queue '%s'\n", interface, queuename);
@@ -1182,7 +1192,6 @@ static void reload_queues(void)
 	/* Mark all queues as dead for the moment */
 	q = queues;
 	while(q) {
-		q->dead = 1;
 		q = q->next;
 	}
 	/* Chug through config file */
@@ -1340,9 +1349,11 @@ static int queues_show(int fd, int argc, char **argv)
 			ast_cli(fd, "   Members: \n");
 			for (mem = q->members; mem; mem = mem->next) {
 				if (mem->penalty)
-					snprintf(max, sizeof(max), " with penalty %d", mem->penalty);
+					snprintf(max, sizeof(max) - 20, " with penalty %d", mem->penalty);
 				else
 					strcpy(max, "");
+				if (mem->dynamic)
+					strcat(max, " (dynamic)");
 				if (mem->calls) {
 					snprintf(calls, sizeof(calls), " has taken %d calls (last was %ld secs ago)",
 							mem->calls, time(NULL) - mem->lastcall);
diff --git a/apps/app_voicemail2.c b/apps/app_voicemail2.c
index 2dd8d07471c644c26e03dfbe3f488fded4ff5176..08fe3bc84902419124b774f86c3b6b23b1c7750e 100755
--- a/apps/app_voicemail2.c
+++ b/apps/app_voicemail2.c
@@ -1793,7 +1793,6 @@ forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg,
 		if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0))
 			break;
 		if ((receiver = find_user(&srec, context, username))) {
-			printf("Got %d\n", atoi(username));
 			/* if (play_and_wait(chan, "vm-savedto"))
 				break;
 			*/
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b4602275a66854fc258017f6640897cef34a3b93..fd5971e0f3b8db1b600ac4e4c853b91318da2c34 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2833,6 +2833,9 @@ static int transmit_register(struct sip_registry *r, char *cmd, char *auth)
 			strncpy(p->peername, r->username, sizeof(p->peername)-1);
 		strncpy(p->username, r->username, sizeof(p->username)-1);
 		strncpy(p->exten, r->contact, sizeof(p->exten) - 1);
+		/* Always bind to our IP if specified */
+		if (bindaddr.sin_addr.s_addr)
+			memcpy(&p->ourip, &bindaddr.sin_addr, sizeof(p->ourip));
 		build_contact(p);
 	}
 
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index fe490c5d7f69a55a74edc100c97db6256ed87557..25b25f2af90eb0b8a1451a4c49081ec02ae358c3 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -4348,7 +4348,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
 				}
 			} else {
 				/* Check for callerid, digits, etc */
-				chan = zt_new(i, AST_STATE_DOWN, 0, SUB_REAL, 0);
+				chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0);
 				if (chan) {
 					if (has_voicemail(i))
 #ifdef ZT_TONE_STUTTER
@@ -4560,7 +4560,7 @@ static void *do_monitor(void *data)
 							if (last->msgstate != res) {
 								int x;
 								ast_log(LOG_DEBUG, "Message status for %s changed from %d to %d on %d\n", last->mailbox, last->msgstate, res, last->channel);
-								x = ZT_FLUSH_WRITE;
+								x = ZT_FLUSH_BOTH;
 								res2 = ioctl(last->subs[SUB_REAL].zfd, ZT_FLUSH, &x);
 								if (res2)
 									ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", last->channel);
diff --git a/codecs/ilbc/FrameClassify.c b/codecs/ilbc/FrameClassify.c
index 61ede133b05b5f40999d4128c36cc4a04c02a660..9e8299cd0f789bf1853b9a5d566f8513a92d01cc 100755
--- a/codecs/ilbc/FrameClassify.c
+++ b/codecs/ilbc/FrameClassify.c
@@ -12,6 +12,7 @@
 ******************************************************************/ 
  
 #include "iLBC_define.h" 
+#include "FrameClassify.h"
  
 /*----------------------------------------------------------------* 
  *  Classification of subframes to localize start state                           
diff --git a/codecs/ilbc/LPCdecode.c b/codecs/ilbc/LPCdecode.c
index 5ca53d055bc64dce0f6133a13687e90e795c2e99..b0d273b32dac3c545b73694f412e8d893768e594 100755
--- a/codecs/ilbc/LPCdecode.c
+++ b/codecs/ilbc/LPCdecode.c
@@ -18,6 +18,7 @@
 #include "lsf.h" 
 #include "iLBC_define.h" 
 #include "constants.h" 
+#include "LPCdecode.h"
  
 /*----------------------------------------------------------------* 
  *  interpolation of lsf coefficients for the decoder                            
diff --git a/codecs/ilbc/LPCencode.c b/codecs/ilbc/LPCencode.c
index 251cd3fe5b97496e5175ad8cfed3e836552889c3..eeac4bd4d80a81ddfbb9f93139d3520885bbe2b6 100755
--- a/codecs/ilbc/LPCencode.c
+++ b/codecs/ilbc/LPCencode.c
@@ -17,12 +17,13 @@
 #include "helpfun.h" 
 #include "lsf.h" 
 #include "constants.h" 
+#include "LPCencode.h"
  
 /*----------------------------------------------------------------* 
  *  lpc analysis (subrutine to LPCencode)                            
  *---------------------------------------------------------------*/ 
  
-void SimpleAnalysis( 
+static void SimpleAnalysis( 
     float *lsf,         /* (o) lsf coefficients */ 
     float *data,    /* (i) new data vector */ 
     float *lpc_buffer   /* (i) buffer containing old data */  
@@ -63,7 +64,7 @@ void SimpleAnalysis(
  *  (subrutine to SimpleInterpolateLSF)                            
  *---------------------------------------------------------------*/ 
  
-void LSFinterpolate2a_enc( 
+static void LSFinterpolate2a_enc( 
     float *a,       /* (o) lpc coefficients */  
     float *lsf1,/* (i) first set of lsf coefficients */ 
     float *lsf2,/* (i) second set of lsf coefficients */ 
@@ -81,7 +82,7 @@ void LSFinterpolate2a_enc(
  *  lsf interpolator (subrutine to LPCencode)                            
  *---------------------------------------------------------------*/ 
  
-void SimpleInterpolateLSF( 
+static void SimpleInterpolateLSF( 
     float *syntdenum,   /* (o) the synthesis filter denominator  
                                resulting from the quantized  
                                interpolated lsf */ 
@@ -138,7 +139,7 @@ void SimpleInterpolateLSF(
  *  lsf quantizer (subrutine to LPCencode)                            
  *---------------------------------------------------------------*/ 
  
-void SimplelsfQ( 
+static void SimplelsfQ( 
     float *lsfdeq,  /* (o) dequantized lsf coefficients  
                            (dimension FILTERORDER) */ 
     int *index,     /* (o) quantization index */ 
diff --git a/codecs/ilbc/StateConstructW.c b/codecs/ilbc/StateConstructW.c
index c694106aee60a49b8566df5671cddb07c1d74db2..2b2114f3ce47d394aace6bd15a7bbf9ca6235a4a 100755
--- a/codecs/ilbc/StateConstructW.c
+++ b/codecs/ilbc/StateConstructW.c
@@ -17,6 +17,7 @@
 #include "iLBC_define.h" 
 #include "constants.h" 
 #include "filter.h" 
+#include "StateConstructW.h"
  
 /*----------------------------------------------------------------* 
  *  decoding of the start state 
diff --git a/codecs/ilbc/StateSearchW.c b/codecs/ilbc/StateSearchW.c
index 3a761d5afa04c85a5bd3ba0500b35d0b685807f1..e1134ae56b13c37ca3442a192d271908915eaa04 100755
--- a/codecs/ilbc/StateSearchW.c
+++ b/codecs/ilbc/StateSearchW.c
@@ -18,6 +18,7 @@
 #include "constants.h" 
 #include "filter.h" 
 #include "helpfun.h" 
+#include "StateSearchW.h"
  
 /*----------------------------------------------------------------* 
  *  predictive noise shaping encoding of scaled start state  
diff --git a/codecs/ilbc/anaFilter.c b/codecs/ilbc/anaFilter.c
index 19b502ef0b22f1b8182f579fc229c511a80d5cfd..268c9266c849e55f041d5b102c6a38e2b2a36ba5 100755
--- a/codecs/ilbc/anaFilter.c
+++ b/codecs/ilbc/anaFilter.c
@@ -13,6 +13,7 @@
  
 #include <string.h> 
 #include "iLBC_define.h" 
+#include "anaFilter.h"
  
 /*----------------------------------------------------------------* 
  *  LP analysis filter. 
diff --git a/codecs/ilbc/createCB.c b/codecs/ilbc/createCB.c
index b16ef4610ce595b0f7c31b966e8066722b03db9d..4d95b7513cb0fd14f4e596bb9c00eec770f1c045 100755
--- a/codecs/ilbc/createCB.c
+++ b/codecs/ilbc/createCB.c
@@ -13,6 +13,7 @@
  
 #include "iLBC_define.h" 
 #include "constants.h" 
+#include "createCB.h"
 #include <string.h> 
 #include <math.h> 
  
diff --git a/codecs/ilbc/doCPLC.c b/codecs/ilbc/doCPLC.c
index 0b0083b097faf4a0a3d87aea77d8b33c17bfedf9..863d6e0eddfc8bacdab9f7693ef40e09ce621f27 100755
--- a/codecs/ilbc/doCPLC.c
+++ b/codecs/ilbc/doCPLC.c
@@ -15,13 +15,14 @@
 #include <string.h> 
  
 #include "iLBC_define.h" 
+#include "doCPLC.h"
  
 /*----------------------------------------------------------------* 
  *  Compute cross correlation and pitch gain for pitch prediction 
  *  of last subframe at given lag. 
  *---------------------------------------------------------------*/ 
  
-void compCorr( 
+static void compCorr( 
     float *cc,      /* (o) cross correlation coefficient */ 
     float *gc,      /* (o) gain */ 
     float *buffer,  /* (i) signal buffer */ 
diff --git a/codecs/ilbc/enhancer.c b/codecs/ilbc/enhancer.c
index a2878cce0fdf7f0b8ad1585e609fa3d4d4cab1a0..86c4a85c04c90fb9d101e7469e6074fae23caf6d 100755
--- a/codecs/ilbc/enhancer.c
+++ b/codecs/ilbc/enhancer.c
@@ -16,6 +16,7 @@
 #include "iLBC_define.h" 
 #include "constants.h" 
 #include "filter.h" 
+#include "enhancer.h"
  
 /*----------------------------------------------------------------* 
  * Find index in array such that the array element with said 
@@ -23,7 +24,7 @@
  * according to the squared-error criterion 
  *---------------------------------------------------------------*/ 
  
-void NearestNeighbor( 
+static void NearestNeighbor( 
     int   *index,   /* (o) index of array element closest to value */ 
     float *array,   /* (i) data array */ 
     float value,/* (i) value */ 
@@ -50,7 +51,7 @@ void NearestNeighbor(
  * compute cross correlation between sequences 
  *---------------------------------------------------------------*/ 
  
-void mycorr1(  
+static void mycorr1(  
     float* corr,    /* (o) correlation of seq1 and seq2 */ 
     float* seq1,    /* (i) first sequence */ 
     int dim1,           /* (i) dimension first seq1 */ 
@@ -71,7 +72,7 @@ void mycorr1(
  * upsample finite array assuming zeros outside bounds 
  *---------------------------------------------------------------*/ 
  
-void enh_upsample(  
+static void enh_upsample(  
     float* useq1,   /* (o) upsampled output sequence */ 
     float* seq1,/* (i) unupsampled sequence */ 
     int dim1,       /* (i) dimension seq1 */ 
@@ -153,7 +154,7 @@ void enh_upsample(
  * sampling rate 
  *---------------------------------------------------------------*/ 
  
-void refiner( 
+static void refiner( 
     float *seg,         /* (o) segment array */ 
     float *updStartPos, /* (o) updated start point */ 
     float* idata,       /* (i) original data buffer */ 
@@ -240,7 +241,7 @@ void refiner(
  * find the smoothed output data 
  *---------------------------------------------------------------*/ 
  
-void smath( 
+static void smath( 
     float *odata,   /* (o) smoothed output */ 
     float *sseq,/* (i) said second sequence of waveforms */ 
     int hl,         /* (i) 2*hl+1 is sseq dimension */ 
@@ -335,7 +336,7 @@ void smath(
  * get the pitch-synchronous sample sequence 
  *---------------------------------------------------------------*/ 
  
-void getsseq( 
+static void getsseq( 
     float *sseq,    /* (o) the pitch-synchronous sequence */ 
     float *idata,       /* (i) original data */ 
     int idatal,         /* (i) dimension of data */ 
@@ -411,7 +412,7 @@ void getsseq(
  * idata+centerStartPos+ENH_BLOCKL-1 
  *---------------------------------------------------------------*/ 
  
-void enhancer( 
+static void enhancer( 
     float *odata,       /* (o) smoothed block, dimension blockl */ 
     float *idata,       /* (i) data buffer used for enhancing */ 
     int idatal,         /* (i) dimension idata */ 
diff --git a/codecs/ilbc/filter.c b/codecs/ilbc/filter.c
index c74e9cfc5f679ed6802b5e8afae5e80e59568c23..2249555af1029a873a9d128aa49106540844256d 100755
--- a/codecs/ilbc/filter.c
+++ b/codecs/ilbc/filter.c
@@ -12,7 +12,8 @@
 ******************************************************************/ 
  
 #include "iLBC_define.h" 
- 
+#include "filter.h"
+
 /*----------------------------------------------------------------* 
  *  all-pole filter 
  *---------------------------------------------------------------*/ 
diff --git a/codecs/ilbc/gainquant.c b/codecs/ilbc/gainquant.c
index be64f8a6733bc2bb88a563c0b3f5adc45e9c7164..e0085c688f80d343ee9a01054693e6c83f6149fb 100755
--- a/codecs/ilbc/gainquant.c
+++ b/codecs/ilbc/gainquant.c
@@ -15,6 +15,7 @@
 #include <math.h> 
 #include "constants.h" 
 #include "filter.h" 
+#include "gainquant.h"
  
 /*----------------------------------------------------------------* 
  *  quantizer for the gain in the gain-shape coding of residual 
diff --git a/codecs/ilbc/getCBvec.c b/codecs/ilbc/getCBvec.c
index 07e9f2d3c8d55792305758e53e389cf65473e3fb..9c57f7bf9788297d624a2170e40c4a257f4f861e 100755
--- a/codecs/ilbc/getCBvec.c
+++ b/codecs/ilbc/getCBvec.c
@@ -13,6 +13,7 @@
  
 #include "iLBC_define.h" 
 #include "constants.h" 
+#include "getCBvec.h"
 #include <string.h> 
  
 /*----------------------------------------------------------------* 
diff --git a/codecs/ilbc/helpfun.c b/codecs/ilbc/helpfun.c
index 936afd614bc974cab18d2fc9ef08e489ab86ec92..67d63c2be94c0a5d1e0ceabce03737c86741d968 100755
--- a/codecs/ilbc/helpfun.c
+++ b/codecs/ilbc/helpfun.c
@@ -14,6 +14,7 @@
 #include <math.h> 
  
 #include "iLBC_define.h" 
+#include "helpfun.h"
 #include "constants.h" 
  
 /*----------------------------------------------------------------* 
diff --git a/codecs/ilbc/hpInput.c b/codecs/ilbc/hpInput.c
index 1599c292359f7b9152339ee9619f020f6b4cdcb9..1947e757e59a9829ae88de5923f247c536cf98fc 100755
--- a/codecs/ilbc/hpInput.c
+++ b/codecs/ilbc/hpInput.c
@@ -12,6 +12,7 @@
 ******************************************************************/ 
  
 #include "constants.h" 
+#include "hpInput.h"
  
 /*----------------------------------------------------------------* 
  *  Input high-pass filter                           
diff --git a/codecs/ilbc/hpOutput.c b/codecs/ilbc/hpOutput.c
index fa75f2578233ccdbce1754c6388ad939337fcdf7..60a78d2781df508dace1ab993c09d2a300f9d49a 100755
--- a/codecs/ilbc/hpOutput.c
+++ b/codecs/ilbc/hpOutput.c
@@ -12,6 +12,7 @@
 ******************************************************************/ 
  
 #include "constants.h" 
+#include "hpOutput.h"
  
 /*----------------------------------------------------------------* 
  *  Output high-pass filter                           
diff --git a/codecs/ilbc/iCBConstruct.c b/codecs/ilbc/iCBConstruct.c
index ccb3f663b5853e1370eb911782b9fa840011e153..acbf54e3cc81b848f1dede8f728018b4142fbfa9 100755
--- a/codecs/ilbc/iCBConstruct.c
+++ b/codecs/ilbc/iCBConstruct.c
@@ -16,6 +16,7 @@
 #include "iLBC_define.h" 
 #include "gainquant.h" 
 #include "getCBvec.h" 
+#include "iCBConstruct.h"
  
 /*----------------------------------------------------------------* 
  *  Convert the codebook indexes to make the search easier 
diff --git a/codecs/ilbc/iCBSearch.c b/codecs/ilbc/iCBSearch.c
index a6f3030fa45f7d149b0eef4f5abfb8fb179b24b1..2279deb733a162034f97f0288b1e2eee75cdb531 100755
--- a/codecs/ilbc/iCBSearch.c
+++ b/codecs/ilbc/iCBSearch.c
@@ -15,6 +15,7 @@
 #include <string.h> 
  
 #include "iLBC_define.h" 
+#include "iCBSearch.h"
 #include "gainquant.h" 
 #include "createCB.h" 
 #include "filter.h" 
diff --git a/codecs/ilbc/iLBC_decode.c b/codecs/ilbc/iLBC_decode.c
index 2347ab83ae552a0f3ca47f65ad84144f0f0b36b1..06602ff0af55fb8f480da181b1cbdd08427dd47e 100755
--- a/codecs/ilbc/iLBC_decode.c
+++ b/codecs/ilbc/iLBC_decode.c
@@ -22,6 +22,7 @@
 #include "helpfun.h" 
 #include "constants.h" 
 #include "packing.h" 
+#include "iLBC_decode.h"
 #include "string.h" 
 #include "enhancer.h" 
 #include "hpOutput.h" 
@@ -78,7 +79,7 @@ short initDecode(                   /* (o) Number of decoded
  *  frame residual decoder function (subrutine to iLBC_decode)  
  *---------------------------------------------------------------*/ 
  
-void Decode( 
+static void Decode( 
     float *decresidual,     /* (o) decoded residual frame */ 
     int start,              /* (i) location of start state */ 
     int idxForMax,          /* (i) codebook index for the maximum  
diff --git a/codecs/ilbc/iLBC_encode.c b/codecs/ilbc/iLBC_encode.c
index 6d8e043457f483fecabaafb126923ef44673b9d3..5a921e7bec56606e985b1cff7e93da02a0a3076d 100755
--- a/codecs/ilbc/iLBC_encode.c
+++ b/codecs/ilbc/iLBC_encode.c
@@ -22,6 +22,7 @@
 #include "helpfun.h" 
 #include "constants.h" 
 #include "packing.h" 
+#include "iLBC_encode.h"
 #include "iCBSearch.h" 
 #include "iCBConstruct.h" 
 #include "hpInput.h" 
diff --git a/codecs/ilbc/lsf.c b/codecs/ilbc/lsf.c
index f768b7782773a3d03ac4983b8f6254acf3519780..b0429e05b9ab8af427984a883ec8d5b049ceb54b 100755
--- a/codecs/ilbc/lsf.c
+++ b/codecs/ilbc/lsf.c
@@ -15,6 +15,7 @@
 #include <math.h> 
  
 #include "iLBC_define.h" 
+#include "lsf.h"
  
 /*----------------------------------------------------------------* 
  *  conversion from lpc coefficients to lsf coefficients  
diff --git a/codecs/ilbc/packing.c b/codecs/ilbc/packing.c
index 6449e55ffdb3224d9dfc5f17cafb44dbbbd35620..3818840bb10d20bf9a7fa30ecf45aa93d40b0c78 100755
--- a/codecs/ilbc/packing.c
+++ b/codecs/ilbc/packing.c
@@ -18,6 +18,7 @@
 #include "constants.h" 
 #include "helpfun.h" 
 #include "string.h" 
+#include "packing.h"
  
 /*----------------------------------------------------------------* 
  *  splitting an integer into first most significant bits and  
diff --git a/codecs/ilbc/syntFilter.c b/codecs/ilbc/syntFilter.c
index fe61eaa46e3e644420cc433bd1ec2978e1226937..121d1f508d61d50e71e4cd7b68dc9f5a0c806629 100755
--- a/codecs/ilbc/syntFilter.c
+++ b/codecs/ilbc/syntFilter.c
@@ -12,6 +12,7 @@
 ******************************************************************/ 
  
 #include "iLBC_define.h" 
+#include "syntFilter.h"
  
 /*----------------------------------------------------------------* 
  *  LP synthesis filter. 
diff --git a/pbx/pbx_gtkconsole.c b/pbx/pbx_gtkconsole.c
index 13e29097bdf9834b467ebc6d2fc5e430f5fdfc6f..e6388bbbf8b76d84f7a1fdfadba6f31aca7c6f72 100755
--- a/pbx/pbx_gtkconsole.c
+++ b/pbx/pbx_gtkconsole.c
@@ -93,7 +93,7 @@ static int cleanup(void *useless)
 }
 
 
-static void __verboser(char *stuff, int opos, int replacelast, int complete)
+static void __verboser(const char *stuff, int opos, int replacelast, int complete)
 {
 	char *s2[2];
 	struct timeval tv;
@@ -123,7 +123,7 @@ static void __verboser(char *stuff, int opos, int replacelast, int complete)
 	}
 }
 
-static void verboser(char *stuff, int opos, int replacelast, int complete) 
+static void verboser(const char *stuff, int opos, int replacelast, int complete) 
 {
 	ast_mutex_lock(&verb_lock);
 	/* Lock appropriately if we're really being called in verbose mode */