diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index 5e658f5e5b08344777293c04eccc7480edbdedc5..5d9ec27e3efbdbd0d9ac0f4281e841798068858c 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -731,7 +731,10 @@ static struct extension *build_extension(struct ast_config *cfg, const char *nam
 		} else if (i == PP_TIMEZONE) {
 			/* perfectly ok if tmp is NULL, will set variables based on server's time zone */
 			set_timezone_variables(exten->headp, tmp);
-		} else if (i == PP_LINENUMBER && tmp) {
+		} else if (i == PP_LINENUMBER) {
+			if (!tmp) {
+				tmp = "1";
+			}
 			exten->index = atoi(tmp);
 		}