[asterisk-commits] mmichelson: trunk r81984 - /trunk/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 8 11:37:35 CDT 2007


Author: mmichelson
Date: Sat Sep  8 11:37:35 2007
New Revision: 81984

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81984
Log:
Make Callerid more consistent in IMAP mail headers

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

Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=81984&r1=81983&r2=81984
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sat Sep  8 11:37:35 2007
@@ -4618,7 +4618,7 @@
 {
 	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 @@
 	}
 
 	/* 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 @@
 {
 	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 @@
 	}
 	
 	/* 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));




More information about the asterisk-commits mailing list