diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-08 16:37:35 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-08 16:37:35 +0000 |
commit | 300d5944b6558fcd7377a4cf84884bddf62691a5 (patch) | |
tree | e03c9c3616488c9e3ffa5e0a3f603941170f7926 /apps | |
parent | 7dde0e2e2e37616e233eca7fc37d3d9b59475074 (diff) |
Make Callerid more consistent in IMAP mail headers
(closes issue #10056, reported and patched by jaroth, with small modification
by me)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@81984 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 2d8d9b9f1..fc4b4bff8 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4618,7 +4618,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc { BODY *body; char *header_content; - char cid[256]; + char cid[256], cidN[256]; char context[256]; char origtime[32]; char duration[16]; @@ -4682,11 +4682,16 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc } /* 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)))) - ast_copy_string(cid, temp, sizeof(cid)); - else + snprintf(cid, sizeof(cid), "\"%s\" <%s>", cidN, temp); + else cid[0] = '\0'; - + if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf)))) ast_copy_string(context, temp, sizeof(context)); else @@ -8656,14 +8661,16 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s { int res = 0; #ifdef IMAP_STORAGE - char origtimeS[256], cidS[256], contextS[256]; + char origtimeS[256], cidN[256], cid[256], contextS[256]; char *header_content, *temp; char buf[1024]; +#else + char *cid; #endif char filename[PATH_MAX]; struct ast_config *msg_cfg = NULL; const char *origtime, *context; - char *cid, *name, *num; + char *name, *num; int retries = 0; 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!! */ + 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)))) - ast_copy_string(cidS, temp, sizeof(cidS)); + snprintf(cid, sizeof(cid), "\"%s\" <%s>",cidN, temp); else - cidS[0] = '\0'; - - cid = &cidS[0]; if ((temp = get_header_by_tag(header_content, "X-Asterisk-VM-Context:", buf, sizeof(buf)))) ast_copy_string(contextS,temp, sizeof(contextS)); |