Summary:ASTERISK-12733: [patch] ${VM_CALLERID} string content varies between email subject and body when callidname is NULL
Reporter:Tomo Takebe (tomo1657)Labels:
Date Opened:2008-09-15 17:49:00Date Closed:2008-09-17 15:46:13
Versions:Frequency of
Environment:Attachments:( 0) 20080917__bug13486.diff.txt
( 1) cidname.patch
Description:When the calleridname is null in make_email_file(), the resulting string in the email's custom subject and the custom body replaced by the ${VM_CALLERID} in voicemail.conf ends up different.

cidname: NULL
cidnum: 1234567890

In subject, ${VM_CALLERID} becomes: "" <123456890>
In body, ${VM_CALLERID} becomes: 1234567890

This is because the subject uses "enc_cidname" variable instead of tbe "cidname" variable.
The value of "enc_cidname" is initialized to an empty string and remains so even when "cidname" is  NULL.
Meanwhile ast_callerid_merge() function returns different values depending on whether the "cidname" is NULL or empty string, so the ${VM_CALLERID} replaced by it ends up being different in the subject and the body.

Fix Suggestion:

We could Pass NULL instead of "enc_cidname" to prep_email_sub_vars() when "cidname" is also null.
This avoides changing any of the subfunctions or altering "enc_cidname" type or value.

Line 3333 Before:
prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, enc_cidnum, enc_cidname, dur, date, passdata, vmlen, cat\
egory, flag);

Line 3333 After:
prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, enc_cidnum, cidname?enc_cidname:NULL, dur, date, passdata, vmlen, cat\
egory, flag);

The same change applies to Line 3355.

A patch with these two changes is included.

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

1) Enable custom subject with ${VM_CALLERID} in its string
2) Enable custom body with ${VM_CALLERID} in its string
3) Leave a voice mail from a SIP client that does not send a cidname but sends a cidnum


We don't need to do this for calleridnum since it defaults to anonymous whether it's empty or NULL.  Behavior also takes place on 1.6.1.
Comments:By: Tilghman Lesher (tilghman) 2008-09-17 15:43:54

I think I'd prefer to fix it this way.

By: Digium Subversion (svnbot) 2008-09-17 15:46:11

Repository: asterisk
Revision: 143404

U   branches/1.4/apps/app_voicemail.c

r143404 | tilghman | 2008-09-17 15:46:11 -0500 (Wed, 17 Sep 2008) | 6 lines

When callerid is blank, we want to use "unknown caller" in those cases, too.
(closes issue ASTERISK-12733)
Reported by: tomo1657
      20080917__bug13486.diff.txt uploaded by Corydon76 (license 14)