[asterisk-commits] mmichelson: branch group/upenn r101015 - in /team/group/upenn: apps/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 29 15:49:05 CST 2008
Author: mmichelson
Date: Tue Jan 29 15:49:04 2008
New Revision: 101015
URL: http://svn.digium.com/view/asterisk?view=rev&rev=101015
Log:
Backporting fix for issue 9474 from trunk to the upenn branch.
This patch allows for setting custom buttons to control the forward, reverse,
pause, and restart actions while listening to a voicemail message.
Modified:
team/group/upenn/apps/app_voicemail.c
team/group/upenn/configs/voicemail.conf.sample
Modified: team/group/upenn/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/upenn/apps/app_voicemail.c?view=diff&rev=101015&r1=101014&r2=101015
==============================================================================
--- team/group/upenn/apps/app_voicemail.c (original)
+++ team/group/upenn/apps/app_voicemail.c Tue Jan 29 15:49:04 2008
@@ -204,6 +204,16 @@
#define DEFAULT_OPTIONS_REC_NAME_SOUND "vm-rec-name"
#define DEFAULT_OPTIONS_REC_TEMP_SOUND "vm-rec-temp"
+/* 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 */
#define SENDMAIL "/usr/sbin/sendmail -t"
@@ -626,6 +636,12 @@
static char advanced_envelope_sound[80];
static char advanced_newcall_sound[80];
static char advanced_message_sound[80];
+/* 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];
static char options_sound[80];
static char options_rec_unavail_sound[80];
@@ -658,6 +674,7 @@
static int adsiver = 1;
static char emaildateformat[32] = "%A, %B %d, %Y at %r";
+static int is_valid_dtmf(const char *key);
static void populate_defaults(struct ast_vm_user *vmu)
{
@@ -799,6 +816,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)
@@ -4345,7 +4377,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);
+ 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);
}
static int play_message_category(struct ast_channel *chan, const char *category)
@@ -7446,13 +7478,13 @@
const char *astforcegreet;
const char *s;
const char *sound, *key;
- char *q,*stringp;
const char *dialoutcxt = NULL;
const char *callbackcxt = NULL;
const char *exitcxt = NULL;
const char *extpc;
const char *emaildateformatstr;
const char *volgainstr;
+ char *q, *stringp;
int x;
int tmpadsi[4];
@@ -7500,6 +7532,13 @@
strcpy(options_rec_name_sound, DEFAULT_OPTIONS_REC_NAME_SOUND);
strcpy(options_rec_temp_sound, DEFAULT_OPTIONS_REC_TEMP_SOUND);
+ /* 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);
@@ -7823,6 +7862,17 @@
} else {
exitcontext[0] = '\0';
}
+ /* 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));
/* load configurable prompts */
if ((sound = ast_variable_retrieve(cfg, "general", "main-sound")))
Modified: team/group/upenn/configs/voicemail.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/upenn/configs/voicemail.conf.sample?view=diff&rev=101015&r1=101014&r2=101015
==============================================================================
--- team/group/upenn/configs/voicemail.conf.sample (original)
+++ team/group/upenn/configs/voicemail.conf.sample Tue Jan 29 15:49:04 2008
@@ -213,6 +213,11 @@
; hidefromdir=yes ; Hide this mailbox from the directory produced by app_directory
; The default is "no".
;tempgreetwarn=yes ; Remind the user that their temporary greeting is set
+; 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
; main-sound="vm-opts" ; This plays the entire main menu
; main-options-key=0 ; options key, default is 0
More information about the asterisk-commits
mailing list