[asterisk-commits] mmichelson: trunk r72329 - in /trunk: ./ apps/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 27 17:47:09 CDT 2007
Author: mmichelson
Date: Wed Jun 27 17:47:08 2007
New Revision: 72329
URL: http://svn.digium.com/view/asterisk?view=rev&rev=72329
Log:
Added ability to customize which buttons control forward, reverse, pause, and stop during message playback.
(closes issue 9474, reported and patched by jaroth with modifications by me)
Modified:
trunk/CHANGES
trunk/apps/app_voicemail.c
trunk/configs/voicemail.conf.sample
Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=72329&r1=72328&r2=72329
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Jun 27 17:47:08 2007
@@ -107,6 +107,7 @@
configuration file for details.
* Added "tw" language support
* Added support for storage of greetings using an IMAP server
+ * Added ability to customize forward, reverse, stop, and pause keys for message playback
Queue changes
-------------
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=72329&r1=72328&r2=72329
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed Jun 27 17:47:08 2007
@@ -179,6 +179,16 @@
#define VOICEMAIL_CONFIG "voicemail.conf"
#define ASTERISK_USERNAME "asterisk"
+
+/* Define fast-forward, pause, restart, and reverse keys
+ while listening to a voicemail message - these are
+ strings, not characters */
+#define DEFAULT_LISTEN_CONTROL_FORWARD_KEY "#"
+#define DEFAULT_LISTEN_CONTROL_REVERSE_KEY "*"
+#define DEFAULT_LISTEN_CONTROL_PAUSE_KEY "0"
+#define DEFAULT_LISTEN_CONTROL_RESTART_KEY "2"
+#define DEFAULT_LISTEN_CONTROL_STOP_KEY "13456789"
+#define VALID_DTMF "1234567890*#" /* Yes ABCD are valid dtmf but what phones have those? */
/* Default mail command to mail voicemail. Change it with the
mailcmd= command in voicemail.conf */
@@ -591,6 +601,13 @@
static AST_RWLIST_HEAD_STATIC(mwi_subs, mwi_sub);
+/* custom audio control prompts for voicemail playback */
+static char listen_control_forward_key[12];
+static char listen_control_reverse_key[12];
+static char listen_control_pause_key[12];
+static char listen_control_restart_key[12];
+static char listen_control_stop_key[12];
+
/* custom password sounds */
static char vm_password[80] = "vm-password";
static char vm_newpassword[80] = "vm-newpassword";
@@ -635,6 +652,7 @@
static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname);
static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category, int imap);
static void apply_options(struct ast_vm_user *vmu, const char *options);
+static int is_valid_dtmf(const char *key);
#if !(defined(ODBC_STORAGE) || defined(IMAP_STORAGE))
static int __has_voicemail(const char *context, const char *mailbox, const char *folder, int shortcircuit);
@@ -794,6 +812,21 @@
apply_option(retval, tmp->name, tmp->value);
tmp = tmp->next;
}
+}
+
+static int is_valid_dtmf(const char *key)
+{
+ int i;
+ char *local_key = ast_strdupa(key);
+
+ for(i = 0; i < strlen(key); ++i) {
+ if(!strchr(VALID_DTMF, *local_key)) {
+ ast_log(LOG_WARNING, "Invalid DTMF key \"%c\" used in voicemail configuration file\n", *local_key);
+ return 0;
+ }
+ local_key++;
+ }
+ return 1;
}
static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const char *context, const char *mailbox)
@@ -4363,7 +4396,7 @@
static int wait_file(struct ast_channel *chan, struct vm_state *vms, char *file)
{
- return ast_control_streamfile(chan, file, "#", "*", "1456789", "0", "2", skipms, NULL);
+ return ast_control_streamfile(chan, file, listen_control_forward_key, listen_control_reverse_key, listen_control_stop_key, listen_control_pause_key, listen_control_restart_key, skipms, NULL);
}
static int play_message_category(struct ast_channel *chan, const char *category)
@@ -7857,10 +7890,18 @@
struct ast_variable *var;
const char *val;
const char *s;
+ const char *key;
char *q, *stringp;
int x;
int tmpadsi[4];
+ /* set audio control prompts */
+ strcpy(listen_control_forward_key,DEFAULT_LISTEN_CONTROL_FORWARD_KEY);
+ strcpy(listen_control_reverse_key,DEFAULT_LISTEN_CONTROL_REVERSE_KEY);
+ strcpy(listen_control_pause_key,DEFAULT_LISTEN_CONTROL_PAUSE_KEY);
+ strcpy(listen_control_restart_key,DEFAULT_LISTEN_CONTROL_RESTART_KEY);
+ strcpy(listen_control_stop_key,DEFAULT_LISTEN_CONTROL_STOP_KEY);
+
cfg = ast_config_load(VOICEMAIL_CONFIG);
AST_LIST_LOCK(&users);
@@ -8221,6 +8262,17 @@
ast_copy_string(vm_reenterpassword, val, sizeof(vm_reenterpassword));
if ((val = ast_variable_retrieve(cfg, "general", "vm-mismatch")))
ast_copy_string(vm_mismatch, val, sizeof(vm_mismatch));
+ /* load configurable audio prompts */
+ if ((key = ast_variable_retrieve(cfg, "general", "listen-control-forward-key")) && is_valid_dtmf(key))
+ ast_copy_string(listen_control_forward_key, key, sizeof(listen_control_forward_key));
+ if ((key = ast_variable_retrieve(cfg, "general", "listen-control-reverse-key")) && is_valid_dtmf(key))
+ ast_copy_string(listen_control_reverse_key, key, sizeof(listen_control_reverse_key));
+ if ((key = ast_variable_retrieve(cfg, "general", "listen-control-pause-key")) && is_valid_dtmf(key))
+ ast_copy_string(listen_control_pause_key, key, sizeof(listen_control_pause_key));
+ if ((key = ast_variable_retrieve(cfg, "general", "listen-control-restart-key")) && is_valid_dtmf(key))
+ ast_copy_string(listen_control_restart_key, key, sizeof(listen_control_restart_key));
+ if ((key = ast_variable_retrieve(cfg, "general", "listen-control-stop-key")) && is_valid_dtmf(key))
+ ast_copy_string(listen_control_stop_key, key, sizeof(listen_control_stop_key));
if (!(val = ast_variable_retrieve(cfg, "general", "usedirectory")))
val = "no";
Modified: trunk/configs/voicemail.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/voicemail.conf.sample?view=diff&rev=72329&r1=72328&r2=72329
==============================================================================
--- trunk/configs/voicemail.conf.sample (original)
+++ trunk/configs/voicemail.conf.sample Wed Jun 27 17:47:08 2007
@@ -255,6 +255,12 @@
; Customize which sound file is used instead of the default
; prompt that says: "The passwords you entered and re-entered
; did not match. Please try again."
+; listen-control-forward-key=# ; Customize the key that fast-forwards message playback
+; listen-control-reverse-key=* ; Customize the key that rewinds message playback
+; listen-control-pause-key=0 ; Customize the key that pauses/unpauses message playback
+; listen-control-restart-key=2 ; Customize the key that restarts message playback
+; listen-control-stop-key=13456789 ; Customize the keys that interrupt message playback, probably all keys not set above
+
[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
More information about the asterisk-commits
mailing list