diff --git a/dns.c b/dns.c
index 83b27c3d227fb7f7a294dfd27c8a096bdb529976..d3393267eb0ff61666f2a2903c754ac57bf68c3a 100644
--- a/dns.c
+++ b/dns.c
@@ -91,7 +91,7 @@ struct dn_answer {
 	unsigned short size;
 } __attribute__ ((__packed__));
 
-static int skip_name(char *s, int len)
+static int skip_name(unsigned char *s, int len)
 {
 	int x = 0;
 
@@ -116,10 +116,10 @@ static int skip_name(char *s, int len)
 
 /*! \brief Parse DNS lookup result, call callback */
 static int dns_parse_answer(void *context,
-	int class, int type, char *answer, int len,
-	int (*callback)(void *context, char *answer, int len, char *fullanswer))
+	int class, int type, unsigned char *answer, int len,
+	int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer))
 {
-	char *fullanswer = answer;
+	unsigned char *fullanswer = answer;
 	struct dn_answer *ans;
 	dns_HEADER *h;
 	int res;
@@ -192,12 +192,12 @@ not work properly, Asterisk might not start properly or a channel may lock.
 */
 int ast_search_dns(void *context,
 	   const char *dname, int class, int type,
-	   int (*callback)(void *context, char *answer, int len, char *fullanswer))
+	   int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer))
 {
 #ifdef HAS_RES_NINIT
 	struct __res_state dnsstate;
 #endif
-	char answer[MAX_SIZE];
+	unsigned char answer[MAX_SIZE];
 	int res, ret = -1;
 
 #ifdef HAS_RES_NINIT
@@ -205,7 +205,7 @@ int ast_search_dns(void *context,
 	memset(&dnsstate, 0, sizeof(dnsstate));
 #endif	
 	res_ninit(&dnsstate);
-	res = res_nsearch(&dnsstate, dname, class, type, (unsigned char *)answer, sizeof(answer));
+	res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer));
 #else
 	ast_mutex_lock(&res_lock);
 	res_init();
diff --git a/enum.c b/enum.c
index 1cf76ef1a54bf3d27b53f450e5dc04096608fbaa..1ec5589b1b24893e356d0306c8f5d11dad600b20 100644
--- a/enum.c
+++ b/enum.c
@@ -95,7 +95,7 @@ struct naptr {
 } __attribute__ ((__packed__));
 
 /*! \brief Parse NAPTR record information elements */
-static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, unsigned int srclen)
+static unsigned int parse_ie(char *data, unsigned int maxdatalen, unsigned char *src, unsigned int srclen)
 {
 	unsigned int len, olen;
 
@@ -116,10 +116,10 @@ static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, uns
 }
 
 /*! \brief Parse DNS NAPTR record used in ENUM ---*/
-static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, unsigned char *naptrinput)
+static int parse_naptr(char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, char *naptrinput)
 {
 	char tech_return[80];
-	char *oanswer = answer;
+	unsigned char *oanswer = answer;
 	char flags[512] = "";
 	char services[512] = "";
 	char *p;
@@ -167,7 +167,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
 		len -= res;
 	}
 
-	if ((res = dn_expand((unsigned char *)oanswer, (unsigned char *)answer + len, (unsigned char *)answer, repl, sizeof(repl) - 1)) < 0) {
+	if ((res = dn_expand(oanswer, answer + len, answer, repl, sizeof(repl) - 1)) < 0) {
 		ast_log(LOG_WARNING, "Failed to expand hostname\n");
 		return -1;
 	}
@@ -324,7 +324,7 @@ struct enum_context {
 };
 
 /*! \brief Callback for TXT record lookup */
-static int txt_callback(void *context, char *answer, int len, char *fullanswer)
+static int txt_callback(void *context, unsigned char *answer, int len, unsigned char *fullanswer)
 {
 	struct enum_context *c = (struct enum_context *)context;
 #if 0
@@ -350,7 +350,7 @@ static int txt_callback(void *context, char *answer, int len, char *fullanswer)
 	len +=1;
 
 	/* finally, copy the answer into c->txt */
-	ast_copy_string(c->txt, answer, len < c->txtlen ? len : (c->txtlen));
+	ast_copy_string(c->txt, (const char *) answer, len < c->txtlen ? len : (c->txtlen));
 
 	/* just to be safe, let's make sure c->txt is null terminated */
 	c->txt[(c->txtlen)-1] = '\0';
@@ -359,7 +359,7 @@ static int txt_callback(void *context, char *answer, int len, char *fullanswer)
 }
 
 /*! \brief Callback from ENUM lookup function */
-static int enum_callback(void *context, char *answer, int len, char *fullanswer)
+static int enum_callback(void *context, unsigned char *answer, int len, unsigned char *fullanswer)
 {
        struct enum_context *c = context;
        void *p = NULL;
diff --git a/include/asterisk/dns.h b/include/asterisk/dns.h
index a549f5edbf6766ed2bcb6f490e25b9d11e56b988..60209509d1364187fb6ec8b132c85367d90323ee 100644
--- a/include/asterisk/dns.h
+++ b/include/asterisk/dns.h
@@ -36,6 +36,6 @@ struct ast_channel;
 		services does not work, Asterisk may lock while waiting for response.
 */
 int ast_search_dns(void *context, const char *dname, int class, int type,
-	 int (*callback)(void *context, char *answer, int len, char *fullanswer));
+	 int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer));
 
 #endif /* _ASTERISK_DNS_H */