mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
Merge MOG's first serious patch (new message patch) (bug #2071)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3612 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -143,6 +143,7 @@ struct ast_vm_user {
|
||||
int delete;
|
||||
int alloced;
|
||||
int saycid;
|
||||
int svmail;
|
||||
int review;
|
||||
int operator;
|
||||
int envelope;
|
||||
@@ -262,6 +263,7 @@ static int maxlogins;
|
||||
static int reviewvm;
|
||||
static int calloper;
|
||||
static int saycidinfo;
|
||||
static int svmailinfo;
|
||||
static int hearenv;
|
||||
static int skipaftercmd;
|
||||
static char dialcontext[80];
|
||||
@@ -293,6 +295,8 @@ static void populate_defaults(struct ast_vm_user *vmu)
|
||||
vmu->operator = 1;
|
||||
if (saycidinfo)
|
||||
vmu->saycid = 1;
|
||||
if (svmailinfo)
|
||||
vmu->svmail = 1;
|
||||
if (hearenv)
|
||||
vmu->envelope = 1;
|
||||
if (callcontext)
|
||||
@@ -331,6 +335,11 @@ static void apply_options(struct ast_vm_user *vmu, char *options)
|
||||
vmu->saycid = 1;
|
||||
else
|
||||
vmu->saycid = 0;
|
||||
} else if (!strcasecmp(var,"sendvoicemail")){
|
||||
if(ast_true(value))
|
||||
vmu->svmail =1;
|
||||
else
|
||||
vmu->svmail =0;
|
||||
} else if (!strcasecmp(var, "review")){
|
||||
if(ast_true(value))
|
||||
vmu->review = 1;
|
||||
@@ -2609,7 +2618,7 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg, struct ast_vm_user *sender, char *fmt)
|
||||
static int forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg, struct ast_vm_user *sender, char *fmt,int flag)
|
||||
{
|
||||
char username[70];
|
||||
char sys[256];
|
||||
@@ -2666,6 +2675,13 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
|
||||
if (!extensions || !valid_extensions)
|
||||
return res;
|
||||
vmtmp = extensions;
|
||||
if(flag==1)/*Send VoiceMail*/
|
||||
{
|
||||
cmd=leave_voicemail(chan,username,0,0,0);
|
||||
}
|
||||
|
||||
else /*Forward VoiceMail*/
|
||||
{
|
||||
cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context);
|
||||
if (!cmd) {
|
||||
while(!res && vmtmp) {
|
||||
@@ -2746,10 +2762,10 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
|
||||
res = play_and_wait(chan, "vm-msgsaved");
|
||||
}
|
||||
}
|
||||
}
|
||||
return res ? res : cmd;
|
||||
}
|
||||
|
||||
|
||||
static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
|
||||
{
|
||||
int res;
|
||||
@@ -3733,6 +3749,14 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
cmd = 't';
|
||||
break;
|
||||
|
||||
case '5': /* Leave VoiceMail */
|
||||
if(vmu->svmail)
|
||||
cmd = forward_message(chan, context, vms.curdir, vms.curmsg, vmu, vmfmts,1);
|
||||
else
|
||||
cmd = play_and_wait(chan,"vm-sorry");
|
||||
cmd='t';
|
||||
break;
|
||||
|
||||
case '*': /* Return to main menu */
|
||||
cmd = 't';
|
||||
break;
|
||||
@@ -3752,6 +3776,8 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
if (!ast_strlen_zero(vmu->dialout) && !cmd) {
|
||||
cmd = play_and_wait(chan, "vm-tomakecall");
|
||||
}
|
||||
if(vmu->svmail&&!cmd)
|
||||
cmd=play_and_wait(chan, "vm-leavemsg");
|
||||
if (!cmd)
|
||||
cmd = play_and_wait(chan, "vm-starmain");
|
||||
if (!cmd)
|
||||
@@ -3808,7 +3834,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
|
||||
case '8':
|
||||
if(vms.lastmsg > -1)
|
||||
cmd = forward_message(chan, context, vms.curdir, vms.curmsg, vmu, vmfmts);
|
||||
cmd = forward_message(chan, context, vms.curdir, vms.curmsg, vmu, vmfmts,0);
|
||||
else
|
||||
cmd = play_and_wait(chan, "vm-nomore");
|
||||
break;
|
||||
@@ -4172,6 +4198,7 @@ static int load_config(void)
|
||||
char *notifystr = NULL;
|
||||
char *astattach;
|
||||
char *astsaycid;
|
||||
char *send_voicemail;
|
||||
char *astcallop;
|
||||
char *astreview;
|
||||
char *astskipcmd;
|
||||
@@ -4329,6 +4356,13 @@ static int load_config(void)
|
||||
}
|
||||
saycidinfo = ast_true(astsaycid);
|
||||
|
||||
svmailinfo =0;
|
||||
if (!(send_voicemail = ast_variable_retrieve(cfg,"general", "sendvoicemail"))){
|
||||
ast_log(LOG_DEBUG,"Send Voicemail msg disabled globally\n");
|
||||
send_voicemail = "no";
|
||||
}
|
||||
svmailinfo=ast_true(send_voicemail);
|
||||
|
||||
hearenv = 1;
|
||||
if (!(asthearenv = ast_variable_retrieve(cfg, "general", "envelope"))) {
|
||||
ast_log(LOG_DEBUG,"ENVELOPE before msg enabled globally\n");
|
||||
@@ -4966,9 +5000,3 @@ char *key()
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -98,6 +98,9 @@ maxlogins=3
|
||||
; or set to no, it will be in the envelope
|
||||
; dialout=fromvm ; Context to dial out from [option 4 from the advanced menu]
|
||||
; if not listed, dialing out will not be permitted
|
||||
sendvoicemail=yes ; Context to Send voicemail from [option 5 from the advanced menu]
|
||||
; if not listed, sending messages from inside voicemail will not be
|
||||
; permitted
|
||||
; callback=fromvm ; Context to call back from
|
||||
; if not listed, calling the sender back will not be permitted
|
||||
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default
|
||||
|
@@ -636,3 +636,5 @@
|
||||
%conf-lockednow.gsm%The conference is now locked
|
||||
|
||||
%conf-unlockednow.gsm%The conference is now unlocked
|
||||
|
||||
%vm-leavemsg.gsm% Press 5 to send a voicemail message
|
||||
|
BIN
sounds/vm-leavemsg.gsm
Executable file
BIN
sounds/vm-leavemsg.gsm
Executable file
Binary file not shown.
Reference in New Issue
Block a user