diff --git a/res/res_http_post.c b/res/res_http_post.c
index 8450fb7ebb6b10ad1cfa55b8c00db8a52d5b6218..0d9ca571c626aca130a72bc124aca90de9546ef0 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -37,6 +37,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 111213 $")
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <gmime/gmime.h>
+#if defined (__OpenBSD__)
+#include <libgen.h>
+#endif
 
 #include "asterisk/linkedlists.h"
 #include "asterisk/http.h"