mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 06:53:41 +00:00
Add temporary greetings to voicemail (bug #2360)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -176,6 +176,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
|
|||||||
static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context);
|
static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context);
|
||||||
static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int outsidecaller, struct ast_vm_user *vmu, int *duration);
|
static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int outsidecaller, struct ast_vm_user *vmu, int *duration);
|
||||||
static int vm_delete(char *file);
|
static int vm_delete(char *file);
|
||||||
|
static int vm_tempgreeting(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, char *fmtc);
|
||||||
|
|
||||||
static char ext_pass_cmd[128];
|
static char ext_pass_cmd[128];
|
||||||
|
|
||||||
@@ -1262,6 +1263,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
|||||||
char dir[256];
|
char dir[256];
|
||||||
char fn[256];
|
char fn[256];
|
||||||
char prefile[256]="";
|
char prefile[256]="";
|
||||||
|
char tempfile[256]="";
|
||||||
char ext_context[256] = "";
|
char ext_context[256] = "";
|
||||||
char fmt[80];
|
char fmt[80];
|
||||||
char *context;
|
char *context;
|
||||||
@@ -1329,8 +1331,12 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
|||||||
ausemacro = 1;
|
ausemacro = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(tempfile, sizeof(tempfile), "voicemail/%s/%s/temp", vmu->context, ext);
|
||||||
|
|
||||||
/* Play the beginning intro if desired */
|
/* Play the beginning intro if desired */
|
||||||
if (!ast_strlen_zero(prefile)) {
|
if (!ast_strlen_zero(prefile)) {
|
||||||
|
if (ast_fileexists(tempfile, NULL, NULL) > 0)
|
||||||
|
strncpy(prefile, tempfile, sizeof(prefile) - 1);
|
||||||
if (ast_fileexists(prefile, NULL, NULL) > 0) {
|
if (ast_fileexists(prefile, NULL, NULL) > 0) {
|
||||||
if (ast_streamfile(chan, prefile, chan->language) > -1)
|
if (ast_streamfile(chan, prefile, chan->language) > -1)
|
||||||
res = ast_waitstream(chan, ecodes);
|
res = ast_waitstream(chan, ecodes);
|
||||||
@@ -3298,6 +3304,9 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
|
|||||||
cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration);
|
cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration);
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
|
cmd = vm_tempgreeting(chan, vmu, vms, fmtc);
|
||||||
|
break;
|
||||||
|
case '5':
|
||||||
if (vmu->password[0] == '-') {
|
if (vmu->password[0] == '-') {
|
||||||
cmd = ast_play_and_wait(chan, "vm-no");
|
cmd = ast_play_and_wait(chan, "vm-no");
|
||||||
break;
|
break;
|
||||||
@@ -3347,6 +3356,64 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vm_tempgreeting(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, char *fmtc)
|
||||||
|
{
|
||||||
|
int cmd = 0;
|
||||||
|
int retries = 0;
|
||||||
|
int duration = 0;
|
||||||
|
char prefile[256]="";
|
||||||
|
char buf[256];
|
||||||
|
int bytes=0;
|
||||||
|
|
||||||
|
if (adsi_available(chan))
|
||||||
|
{
|
||||||
|
bytes += adsi_logo(buf + bytes);
|
||||||
|
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 3, ADSI_JUST_CENT, 0, "Temp Greeting Menu", "");
|
||||||
|
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_CENT, 0, "Not Done", "");
|
||||||
|
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
|
||||||
|
bytes += adsi_voice_mode(buf + bytes, 0);
|
||||||
|
adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY);
|
||||||
|
}
|
||||||
|
snprintf(prefile,sizeof(prefile),"voicemail/%s/%s/temp",vmu->context, vms->username);
|
||||||
|
while((cmd >= 0) && (cmd != 't')) {
|
||||||
|
if (cmd)
|
||||||
|
retries = 0;
|
||||||
|
if (ast_fileexists(prefile, NULL, NULL) > 0) {
|
||||||
|
switch (cmd) {
|
||||||
|
case '1':
|
||||||
|
cmd = play_record_review(chan,"vm-rec-temp",prefile, maxgreet, fmtc, 0, vmu, &duration);
|
||||||
|
break;
|
||||||
|
case '2':
|
||||||
|
ast_filedelete(prefile, NULL);
|
||||||
|
ast_play_and_wait(chan,"vm-tempremoved");
|
||||||
|
cmd = 't';
|
||||||
|
break;
|
||||||
|
case '*':
|
||||||
|
cmd = 't';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (ast_fileexists(prefile, NULL, NULL) > 0) {
|
||||||
|
cmd = ast_play_and_wait(chan,"vm-tempgreeting2");
|
||||||
|
} else {
|
||||||
|
cmd = ast_play_and_wait(chan,"vm-tempgreeting");
|
||||||
|
} if (!cmd) {
|
||||||
|
cmd = ast_waitfordigit(chan,6000);
|
||||||
|
} if (!cmd) {
|
||||||
|
retries++;
|
||||||
|
} if (retries > 3) {
|
||||||
|
cmd = 't';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
play_record_review(chan,"vm-rec-temp",prefile, maxgreet, fmtc, 0, vmu, &duration);
|
||||||
|
cmd = 't';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cmd == 't')
|
||||||
|
cmd = 0;
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
/* Default English syntax */
|
/* Default English syntax */
|
||||||
static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
|
static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
|
||||||
{
|
{
|
||||||
|
10
sounds.txt
10
sounds.txt
@@ -176,7 +176,7 @@
|
|||||||
|
|
||||||
%vm-onefor.gsm%Press 1 for
|
%vm-onefor.gsm%Press 1 for
|
||||||
|
|
||||||
%vm-options.gsm%Press 1 to record your unavailable message, press 2 to record your busy message, press 3 to record your name, press 4 to change your password, press star to return to the main menu.
|
%vm-options.gsm%Press 1 to record your unavailable message, press 2 to record your busy message, press 3 to record your name, press 4 to record your temporary message, press 5 to change your password, press star to return to the main menu.
|
||||||
|
|
||||||
%vm-opts.gsm%Press 2 to change folders, press zero for mailbox options.
|
%vm-opts.gsm%Press 2 to change folders, press zero for mailbox options.
|
||||||
|
|
||||||
@@ -194,6 +194,8 @@
|
|||||||
|
|
||||||
%vm-rec-unv.gsm%After the tone say your unavailable message and then press the pound key.
|
%vm-rec-unv.gsm%After the tone say your unavailable message and then press the pound key.
|
||||||
|
|
||||||
|
%vm-rec-temp.gsm%After the tone, say your temporary message, and then press the pound key.
|
||||||
|
|
||||||
%vm-reenterpassword.gsm%Please re-enter your password followed by the pound key.
|
%vm-reenterpassword.gsm%Please re-enter your password followed by the pound key.
|
||||||
|
|
||||||
%vm-repeat.gsm%Press 5 to repeat the current message.
|
%vm-repeat.gsm%Press 5 to repeat the current message.
|
||||||
@@ -208,6 +210,12 @@
|
|||||||
|
|
||||||
%vm-sorry.gsm%I'm sorry I did not understand your response.
|
%vm-sorry.gsm%I'm sorry I did not understand your response.
|
||||||
|
|
||||||
|
%vm-tempgreeting.gsm%press 1 to record your temporary greeting
|
||||||
|
|
||||||
|
%vm-tempgreeting2.gsm%press 1 to record your temporary greeting, or press 2 to erase your temporary greeting
|
||||||
|
|
||||||
|
%vm-tempremoved.gsm%Your temporary greeting has been removed
|
||||||
|
|
||||||
%vm-theperson.gsm%The person at extension
|
%vm-theperson.gsm%The person at extension
|
||||||
|
|
||||||
%vm-tocancel.gsm%or pound to cancel.
|
%vm-tocancel.gsm%or pound to cancel.
|
||||||
|
Binary file not shown.
BIN
sounds/vm-rec-temp.gsm
Executable file
BIN
sounds/vm-rec-temp.gsm
Executable file
Binary file not shown.
BIN
sounds/vm-tempgreeting.gsm
Executable file
BIN
sounds/vm-tempgreeting.gsm
Executable file
Binary file not shown.
BIN
sounds/vm-tempgreeting2.gsm
Executable file
BIN
sounds/vm-tempgreeting2.gsm
Executable file
Binary file not shown.
BIN
sounds/vm-tempremoved.gsm
Executable file
BIN
sounds/vm-tempremoved.gsm
Executable file
Binary file not shown.
Reference in New Issue
Block a user