*/
int ast_context_remove_include2(struct ast_context *con, char *include, char *registrar);
+//! Verifies includes in an ast_contect structure
+/*!
+ * \param con context in which to verify the includes
+ * Returns 0 if no problems found, -1 if there were any missing context
+ */
+int ast_context_verify_includes(struct ast_context *con);
+
//! Add a switch
/*!
* \param context context to which to add the switch
else
return ip->next;
}
+
+int ast_context_verify_includes(struct ast_context *con)
+{
+ struct ast_include *inc;
+ int res = 0;
+
+ for (inc = ast_walk_context_includes(con, NULL); inc; inc = ast_walk_context_includes(con, inc))
+ if (!ast_context_find(inc->rname)) {
+ res = -1;
+ ast_log(LOG_WARNING, "Context '%s' tries includes non-existant context '%s'\n",
+ ast_get_context_name(con), inc->rname);
+ }
+ return res;
+}
ast_destroy(cfg);
}
ast_merge_contexts_and_delete(&local_contexts,registrar);
+
+ for (con = ast_walk_contexts(NULL); con; con = ast_walk_contexts(con))
+ ast_context_verify_includes(con);
+
return 0;
}