Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
471eeaed
Commit
471eeaed
authored
5 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge "app_voicemail.c: Support multiple file formats for forwarded messages."
parents
7b226c2c
2d67dbfe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/app_voicemail.c
+45
-3
45 additions, 3 deletions
apps/app_voicemail.c
with
45 additions
and
3 deletions
apps/app_voicemail.c
+
45
−
3
View file @
471eeaed
...
@@ -5398,12 +5398,33 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format,
...
@@ -5398,12 +5398,33 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format,
char sox_gain_tmpdir[PATH_MAX];
char sox_gain_tmpdir[PATH_MAX];
char *file_to_delete = NULL, *dir_to_delete = NULL;
char *file_to_delete = NULL, *dir_to_delete = NULL;
int res;
int res;
char altfname[PATH_MAX] = "";
int altused = 0;
char altformat[80] = "";
char *c = NULL;
/* Eww. We want formats to tell us their own MIME type */
/* Eww. We want formats to tell us their own MIME type */
char *mime_type = (!strcasecmp(format, "ogg")) ? "application/" : "audio/x-";
char *mime_type = (!strcasecmp(format, "ogg")) ? "application/" : "audio/x-";
/* Users of multiple file formats need special attention. */
snprintf(fname, sizeof(fname), "%s.%s", attach, format);
if (!ast_file_is_readable(fname)) {
ast_copy_string(altformat, vmfmts, sizeof(altformat));
c = strchr(altformat, '|');
if (c) {
*c = '\0';
}
ast_log(AST_LOG_WARNING, "Failed to open file: %s: %s - trying first/alternate format %s\n", fname, strerror(errno), altformat);
snprintf(altfname, sizeof(altfname), "%s.%s", attach, altformat);
if (!ast_file_is_readable(altfname)) {
ast_log(AST_LOG_WARNING, "Failed to open file: %s: %s - alternate format %s failure\n", altfname, strerror(errno), altformat);
} else {
altused = 1;
}
}
/* This 'while' loop will only execute once. We use it so that we can 'break' */
/* This 'while' loop will only execute once. We use it so that we can 'break' */
while (vmu->volgain < -.001 || vmu->volgain > .001) {
while (vmu->volgain < -.001 || vmu->volgain > .001
|| altused
) {
char tmpdir[PATH_MAX];
char tmpdir[PATH_MAX];
create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
...
@@ -5429,8 +5450,29 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format,
...
@@ -5429,8 +5450,29 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format,
break;
break;
}
}
res = snprintf(sox_gain_cmd, sizeof(sox_gain_cmd), "sox -v %.4f %s.%s %s",
if (!altused) {
vmu->volgain, attach, format, fname);
res = snprintf(sox_gain_cmd, sizeof(sox_gain_cmd), "sox -v %.4f %s.%s %s",
vmu->volgain, attach, format, fname);
} else {
if (!strcasecmp(format, "wav")) {
if (vmu->volgain < -.001 || vmu->volgain > .001) {
res = snprintf(sox_gain_cmd, sizeof(sox_gain_cmd), "sox -v %.4f %s.%s -e signed-integer -b 16 %s",
vmu->volgain, attach, altformat, fname);
} else {
res = snprintf(sox_gain_cmd, sizeof(sox_gain_cmd), "sox %s.%s -e signed-integer -b 16 %s",
attach, altformat, fname);
}
} else {
if (vmu->volgain < -.001 || vmu->volgain > .001) {
res = snprintf(sox_gain_cmd, sizeof(sox_gain_cmd), "sox -v %.4f %s.%s %s",
vmu->volgain, attach, altformat, fname);
} else {
res = snprintf(sox_gain_cmd, sizeof(sox_gain_cmd), "sox %s.%s %s",
attach, altformat, fname);
}
}
}
if (res >= sizeof(sox_gain_cmd)) {
if (res >= sizeof(sox_gain_cmd)) {
ast_log(LOG_ERROR, "Failed to generate sox command, out of buffer space\n");
ast_log(LOG_ERROR, "Failed to generate sox command, out of buffer space\n");
break;
break;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment