app_voicemail: Refactor email generation functions

Refactors generic functions used for email generation
into utils.c so that they can be used by multiple
modules, including app_voicemail and app_minivm,
to avoid code duplication.

ASTERISK-29715 #close

Change-Id: I1de0ed3483623e9599711129edc817c45ad237ee
This commit is contained in:
Naveen Albert
2021-11-01 15:40:42 +00:00
committed by George Joseph
parent b290bb1251
commit 70cdb0f9a8
6 changed files with 193 additions and 300 deletions

View File

@@ -184,6 +184,21 @@ int ast_format_def_unregister(const char *name)
return res;
}
FILE *ast_file_mkftemp(char *template, mode_t mode)
{
FILE *p = NULL;
int pfd = mkstemp(template);
chmod(template, mode);
if (pfd > -1) {
p = fdopen(pfd, "w+");
if (!p) {
close(pfd);
pfd = -1;
}
}
return p;
}
int ast_stopstream(struct ast_channel *tmp)
{
ast_channel_lock(tmp);