Summary:ASTERISK-12845: [patch] VM_CALLERID yields different results if CID is null or empty
Reporter:Tomo Takebe (tomo1657)Labels:
Date Opened:2008-10-07 15:35:27Date Closed:2008-10-14 17:15:04
Versions:Frequency of
Environment:Attachments:( 0) callerid_merge.patch
Description:Thanks Corydon76 for the patch, but although VM_CIDNAME and VM_CIDNUM have been dealt with VM_CALLERID still yields different results depending on if callerid is NULL or empty string.

Perhaps modifying ast_callerid_merge() to treat both NULL and empty string caller ID the same way is the solution?

I've attached a patch for this where ast_callerid_merge() uses !ast_strlen_zero() to check for string length for name and num.

****** STEPS TO REPRODUCE ******

1) Use ${VM_CALLERID} in custom subject as well as body
2) Call from a device that doesn't use caller ID names but uses caller ID number
3) leave voicemail to an account with email attachment enabled

The resulting email would have different values for the same ${VM_CALLERID} variable:

In the subject: "" <1234567890>
In the body: 1234567890

This is because make_email_file() uses two different variables (enc_cidname versus cidname) for the prep_email_sub_vars() between the subject and the body. If cidname is NULL at the beginning of make_email_file(), enc_cidname becomes empty string whereas cidname remains NULL.  This causes VM_CALLERID to output different strings between the subject and the body.
Comments:By: Tomo Takebe (tomo1657) 2008-10-07 15:39:16

This is a patch for main/callerid.c so perhaps I should have changed the category...

By: Tilghman Lesher (tilghman) 2008-10-09 12:57:01

I don't really think that's the right solution.  If you only want "unknown" in voicemail, then there's no reason to modify the core.  I especially think that the core behavior is correct, especially for other places.

By: Tomo Takebe (tomo1657) 2008-10-09 13:06:24

The other suggestion was to make sure that NULL is passed into make_email file() instead of enc_cidname if cidname is NULL.  A suggestion patch for that is attached in issue 0013486:

By: Digium Subversion (svnbot) 2008-10-09 14:28:14

Repository: asterisk
Revision: 147997

U   branches/1.4/apps/app_voicemail.c

r147997 | tilghman | 2008-10-09 14:28:14 -0500 (Thu, 09 Oct 2008) | 4 lines

When blank, callerid name and number should display "unknown caller" in voicemail
(Closes issue ASTERISK-12845)