diff --git a/cli.c b/cli.c
index 333286dad96e0bcb3c70113c2e9483e39bc1946f..09803954f58ccd6d2fd8f26651400aa4bfcc898f 100644
--- a/cli.c
+++ b/cli.c
@@ -44,7 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
 #include "asterisk/channel.h"
-#include "asterisk/manager.h"
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
 #include "asterisk/lock.h"
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index 4541e7f173777e0466dd4a4aeee90a3ee1fd0c69..71b5a59662ec68a8f1f1e712b7e7313bff4ff2e6 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -81,8 +81,6 @@ struct manager_action {
 	struct manager_action *next;
 };
 
-int ast_carefulwrite(int fd, char *s, int len, int timeoutms);
-
 /* External routines may register/unregister manager callbacks this way */
 #define ast_manager_register(a, b, c, d) ast_manager_register2(a, b, c, d, NULL)
 
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 9a61f573b77ded115f4cbf7cfc20b8e8652d878f..d2db42e07dccb2e35d58eae8963329dad6e28075 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -217,6 +217,17 @@ const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
 int ast_utils_init(void);
 int ast_wait_for_input(int fd, int ms);
 
+/*! ast_carefulwrite
+	\brief Try to write string, but wait no more than ms milliseconds
+	before timing out.
+
+	\note If you are calling ast_carefulwrite, it is assumed that you are calling
+	it on a file descriptor that _DOES_ have NONBLOCK set.  This way,
+	there is only one system call made to do a write, unless we actually
+	have a need to wait.  This way, we get better performance.
+*/
+int ast_carefulwrite(int fd, char *s, int len, int timeoutms);
+
 /*! Compares the source address and port of two sockaddr_in */
 static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
 {
diff --git a/manager.c b/manager.c
index 06f996ab08616ae6b95ccc486c0a46252cb37a4f..bf701667265b9a0c10db4c1855376c20d0b269f0 100644
--- a/manager.c
+++ b/manager.c
@@ -168,38 +168,6 @@ static struct mansession {
 static struct manager_action *first_action = NULL;
 AST_MUTEX_DEFINE_STATIC(actionlock);
 
-/*! If you are calling ast_carefulwrite, it is assumed that you are calling
-   it on a file descriptor that _DOES_ have NONBLOCK set.  This way,
-   there is only one system call made to do a write, unless we actually
-   have a need to wait.  This way, we get better performance. */
-int ast_carefulwrite(int fd, char *s, int len, int timeoutms) 
-{
-	/* Try to write string, but wait no more than ms milliseconds
-	   before timing out */
-	int res = 0;
-	struct pollfd fds[1];
-	while (len) {
-		res = write(fd, s, len);
-		if ((res < 0) && (errno != EAGAIN)) {
-			return -1;
-		}
-		if (res < 0)
-			res = 0;
-		len -= res;
-		s += res;
-		res = 0;
-		if (len) {
-			fds[0].fd = fd;
-			fds[0].events = POLLOUT;
-			/* Wait until writable again */
-			res = poll(fds, 1, timeoutms);
-			if (res < 1)
-				return -1;
-		}
-	}
-	return res;
-}
-
 /*! authority_to_str: Convert authority code to string with serveral options */
 static char *authority_to_str(int authority, char *res, int reslen)
 {
diff --git a/res/res_agi.c b/res/res_agi.c
index 0b88b892c6ea4832c4f22712c9dc31325efd5cea..c4df2421e10c91b916d2c201bb0a7b59b5de3fe7 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -59,7 +59,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/app.h"
 #include "asterisk/dsp.h"
 #include "asterisk/musiconhold.h"
-#include "asterisk/manager.h"
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
 #include "asterisk/strings.h"
diff --git a/utils.c b/utils.c
index 807df16b2bc90592a8b4f53ccd7ea0bf58b759ad..ccc87f21dd18c635f3e5d2b7d2dedc0d4c4082cd 100644
--- a/utils.c
+++ b/utils.c
@@ -591,6 +591,34 @@ int ast_wait_for_input(int fd, int ms)
 	return poll(pfd, 1, ms);
 }
 
+int ast_carefulwrite(int fd, char *s, int len, int timeoutms) 
+{
+	/* Try to write string, but wait no more than ms milliseconds
+	   before timing out */
+	int res = 0;
+	struct pollfd fds[1];
+	while (len) {
+		res = write(fd, s, len);
+		if ((res < 0) && (errno != EAGAIN)) {
+			return -1;
+		}
+		if (res < 0)
+			res = 0;
+		len -= res;
+		s += res;
+		res = 0;
+		if (len) {
+			fds[0].fd = fd;
+			fds[0].events = POLLOUT;
+			/* Wait until writable again */
+			res = poll(fds, 1, timeoutms);
+			if (res < 1)
+				return -1;
+		}
+	}
+	return res;
+}
+
 char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
 {
 	char *e;