aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-02 19:18:35 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-02 19:18:35 +0000
commit25166a4ab6e2609e01ac28282c3a538d1cdab1fa (patch)
treef8520f72bfaafec44c60634368cad7b103672caf
parent014bb6cd383d2691487f7bac4c345054e8f1cf6a (diff)
If '#' is sent for username, use callerid if available (bug #2301)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3713 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_voicemail.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index a811041ef..dd227f13e 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3517,6 +3517,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
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 @@ static int vm_execmain(struct ast_channel *chan, void *data)
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);