Summary:ASTERISK-09753: Use more consistent CallerID naming in IMAP mail headers to fix "unknown caller" voicemail info.
Reporter:James Rothenberger (jaroth)Labels:
Date Opened:2007-06-25 12:04:12Date Closed:2007-09-08 11:19:05
Versions:Frequency of
Environment:Attachments:( 0) callerid.patch
( 1) callerid.patch.v2
( 2) callerid.patch.v3
Description:Currently the callerID name and number are stored in two different email headers for IMAP storage:

X-Asterisk-VM-Caller-ID-Num and X-Asterisk-VM-Caller-ID-Name

The problem is that the method that parses the caller ID to play it back expects the callerID to be in the standard format "name" <number>.  This patch modifies the IMAP headers to use a single entry "X-Asterisk-VM-Caller-ID" with the standard format.  This allows voicemail to announce the correct Caller ID.
Comments:By: Russell Bryant (russell) 2007-06-25 13:55:45

1) Please don't initial lines of code that you change ...

2) This patch includes a lot more arbitrary formatting changes than it does actual code changes.  Please try to minimize the changes down to only what is necessary.

3) This patch doesn't put forth any effort to handle messages from older versions.  It seems like you should be able to get the values from the Num and Name headers and combine them into a string that is in the proper callerid string format.

By: James Rothenberger (jaroth) 2007-06-25 14:03:23

I missed the initials - I put them in my working copy to find changes easier, I just forgot to take them out.  I'll remove the "if-then" changes as well, they were just an attempt to initialize un-set variables.   Understood about checking for older versions - I didn't do it since the older headers never worked anyway, but I will add some code to make them work as well.

By: James Rothenberger (jaroth) 2007-06-25 14:48:02

New patch with changes as suggested.

By: Russell Bryant (russell) 2007-06-25 14:57:39

Thanks for the update!

By: Russell Bryant (russell) 2007-06-27 15:17:45

My input ...

To be honest, I like the idea of having the callerID name and number in two different headers.  So, I would like this patch to only address making reading it back in work properly.

Also, why are you using sprintf()?  You are copying data from a header into a fixed size buffer on the stack without checking the bounds.  This would create a pretty serious stack buffer overflow vulnerability ...

By: James Rothenberger (jaroth) 2007-06-27 15:37:59

My reasoning was to keep the keywords and syntax the same as what is used in the file storage model.  And in that model, the callerID information was combined into a single piece of information, so I changed IMAP storage to work the same.  I have removed the new info and this patch simply uses the two separate parts and combines them so that they can still be "read" by ast_callerid_parse().  I also changed the sprintf to an snprintf - sorry about that.

By: Michiel van Baak (mvanbaak) 2007-09-08 06:19:19

works correctly on my testsystem.

By: Digium Subversion (svnbot) 2007-09-08 11:19:05

Repository: asterisk
Revision: 81984

r81984 | mmichelson | 2007-09-08 11:19:04 -0500 (Sat, 08 Sep 2007) | 5 lines

Make Callerid more consistent in IMAP mail headers

(closes issue ASTERISK-9753, reported and patched by jaroth, with small modification
by me)