aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-05 18:32:50 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-05 18:32:50 +0000
commit5cf59a4179072c9980ea6a2b90f9533af0e8bca0 (patch)
tree94d9b6b056ad94e15bf2baa6933a0099f9e484dc /apps
parent45fd97e7fb739e4b69f63e86825a903feec92503 (diff)
Fix for bug number 9786, wherein voicemails saved to IMAP storage using extensions other than gsm were
unable to be played over the phone. (Issue 9786, reporter: xmarksthespot, Patched by xmarksthe spot with revisions by me, reviewed by Russell Bryant). git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@67424 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 010a020a7..f151c507a 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4395,6 +4395,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
char category[32];
char todir[PATH_MAX];
int res = 0;
+ char *attachedfilefmt;
char *temp;
vms->starting = 0;
@@ -4416,7 +4417,23 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
make_gsm_file(vms->fn, vms->imapuser, todir, vms->curmsg);
mail_fetchstructure (vms->mailstream,vms->msgArray[vms->curmsg],&body);
- save_body(body,vms,"3","gsm");
+
+ /* We have the body, now we extract the file name of the first attachment. */
+ if (body->nested.part->next && body->nested.part->next->body.parameter->value) {
+ attachedfilefmt = ast_strdupa(body->nested.part->next->body.parameter->value);
+ } else {
+ ast_log(LOG_ERROR, "There is no file attached to this IMAP message.\n");
+ return -1;
+ }
+
+ /* Find the format of the attached file */
+
+ strsep(&attachedfilefmt, ".");
+ if (!attachedfilefmt) {
+ ast_log(LOG_ERROR, "File format could not be obtained from IMAP message attachment\n");
+ return -1;
+ }
+ save_body(body, vms, "2", attachedfilefmt);
adsi_message(chan, vms);
if (!vms->curmsg)