Make Callerid more consistent in IMAP mail headers

(closes issue #10056, reported and patched by jaroth, with small modification
by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81984 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2007-09-08 16:37:35 +00:00
parent 6f4fbccdb1
commit 382a40f04e

View File

@@ -4618,7 +4618,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
{ {
BODY *body; BODY *body;
char *header_content; char *header_content;
char cid[256]; char cid[256], cidN[256];
char context[256]; char context[256];
char origtime[32]; char origtime[32];
char duration[16]; char duration[16];
@@ -4682,8 +4682,13 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
} }
/* Get info from headers!! */ /* Get info from headers!! */
if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf))))
ast_copy_string(cidN, temp, sizeof(cidN));
else
cidN[0] = '\0';
if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf)))) if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf))))
ast_copy_string(cid, temp, sizeof(cid)); snprintf(cid, sizeof(cid), "\"%s\" <%s>", cidN, temp);
else else
cid[0] = '\0'; cid[0] = '\0';
@@ -8656,14 +8661,16 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
{ {
int res = 0; int res = 0;
#ifdef IMAP_STORAGE #ifdef IMAP_STORAGE
char origtimeS[256], cidS[256], contextS[256]; char origtimeS[256], cidN[256], cid[256], contextS[256];
char *header_content, *temp; char *header_content, *temp;
char buf[1024]; char buf[1024];
#else
char *cid;
#endif #endif
char filename[PATH_MAX]; char filename[PATH_MAX];
struct ast_config *msg_cfg = NULL; struct ast_config *msg_cfg = NULL;
const char *origtime, *context; const char *origtime, *context;
char *cid, *name, *num; char *name, *num;
int retries = 0; int retries = 0;
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
@@ -8686,12 +8693,14 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
} }
/* Get info from headers!! */ /* Get info from headers!! */
if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf)))) if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:", buf, sizeof(buf))))
ast_copy_string(cidS, temp, sizeof(cidS)); ast_copy_string(cidN, temp, sizeof(cidN));
else else
cidS[0] = '\0'; cidN[0] = '\0';
cid = &cidS[0]; if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:", buf, sizeof(buf))))
snprintf(cid, sizeof(cid), "\"%s\" <%s>",cidN, temp);
else
if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf)))) if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf))))
ast_copy_string(contextS,temp, sizeof(contextS)); ast_copy_string(contextS,temp, sizeof(contextS));