Index: apps/app_record.c =================================================================== --- apps/app_record.c (revision 71720) +++ apps/app_record.c (working copy) @@ -81,6 +81,7 @@ int count = 0; int percentflag = 0; char *filename, *ext = NULL, *silstr, *maxstr, *options; + char *slash, *dir; char *vdata, *p; int i = 0; char tmp[256]; @@ -263,8 +264,13 @@ } ast_dsp_set_threshold(sildet, 256); } - - + + /* Create the directory if it does not exist. */ + dir = ast_strdupa(tmp); + if ((slash = strrchr(dir, '/'))) + *slash = '\0'; + ast_mkdir (dir, 0777); + flags = option_append ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY; s = ast_writefile( tmp, ext, NULL, flags , 0, AST_FILE_MODE);