[Asterisk-cvs] asterisk/apps app_voicemail.c,1.139,1.140

markster at lists.digium.com markster at lists.digium.com
Thu Sep 2 15:15:23 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv14240/apps

Modified Files:
	app_voicemail.c 
Log Message:
If '#' is sent for username, use callerid if available (bug #2301)


Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- app_voicemail.c	2 Sep 2004 04:57:37 -0000	1.139
+++ app_voicemail.c	2 Sep 2004 19:18:35 -0000	1.140
@@ -3517,6 +3517,7 @@
 	struct ast_vm_user *vmu = NULL, vmus;
 	char *context=NULL;
 	int silentexit = 0;
+	char cid[256]="";
 
 	LOCAL_USER_ADD(u);
 	memset(&vms, 0, sizeof(vms));
@@ -3576,10 +3577,21 @@
 			goto out;
 		}
 		if (ast_strlen_zero(vms.username)) {
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3 "Username not entered\n");
-			res = 0;
-			goto out;
+				char *callerid=NULL, *name=NULL;
+				if(chan->callerid != NULL) {
+					strncpy(cid, chan->callerid, sizeof(cid) - 1);
+					ast_callerid_parse(cid, &name, &callerid);
+				}
+				if(callerid != NULL) {			
+					if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "No username but # key pressed. Using CID '%s'\n",callerid);
+					strncpy(vms.username, callerid, sizeof(vms.username) - 1);
+				} else {
+					if (option_verbose > 2)
+					ast_verbose(VERBOSE_PREFIX_3 "Username not entered\n");	
+					res = 0;
+					goto out;
+				}
 		}
 		if (useadsi)
 			adsi_password(chan);




More information about the svn-commits mailing list