aboutsummaryrefslogtreecommitdiffstats
path: root/app.c
diff options
context:
space:
mode:
authorbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-05 19:10:11 +0000
committerbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-05 19:10:11 +0000
commit0ff9a2f25dbfb66c2d8ac460419b4ca459ac90a7 (patch)
treede424474daddef9d8471ff3866b14572b60ae188 /app.c
parent4098fd2400449929fcde1948159a1b2e242f96fb (diff)
Fix 4 bugs in voicemail. #7064 ( supczinskib and jcollie )
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@24981 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'app.c')
-rw-r--r--app.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/app.c b/app.c
index 8fcc6414a..a7a120e49 100644
--- a/app.c
+++ b/app.c
@@ -535,7 +535,23 @@ int ast_play_and_wait(struct ast_channel *chan, const char *fn)
static int global_silence_threshold = 128;
static int global_maxsilence = 0;
-static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int beep, int silencethreshold, int maxsilence, const char *path, int prepend)
+/*! Optionally play a sound file or a beep, then record audio and video from the channel.
+ * @param chan Channel to playback to/record from.
+ * @param playfile Filename of sound to play before recording begins.
+ * @param recordfile Filename to record to.
+ * @param maxtime Maximum length of recording (in milliseconds).
+ * @param fmt Format(s) to record message in. Multiple formats may be specified by separating them with a '|'.
+ * @param duration Where to store actual length of the recorded message (in milliseconds).
+ * @param beep Whether to play a beep before starting to record.
+ * @param silencethreshold
+ * @param maxsilence Length of silence that will end a recording (in milliseconds).
+ * @param path Optional filesystem path to unlock.
+ * @param prepend If true, prepend the recorded audio to an existing file.
+ * @param acceptdtmf DTMF digits that will end the recording.
+ * @param canceldtmf DTMF digits that will cancel the recording.
+ */
+
+static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int beep, int silencethreshold, int maxsilence, const char *path, int prepend, const char *acceptdtmf, const char *canceldtmf)
{
int d = 0;
char *fmts;
@@ -700,18 +716,17 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
outmsg = 2;
break;
}
- if (f->subclass == '#') {
+ if (strchr(acceptdtmf, f->subclass)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
- res = '#';
+ res = f->subclass;
outmsg = 2;
break;
}
- if (f->subclass == '0') {
- /* Check for a '0' during message recording also, in case caller wants operator */
+ if (strchr(canceldtmf, f->subclass)) {
if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "User cancelled by pressing %c\n", f->subclass);
- res = '0';
+ ast_verbose(VERBOSE_PREFIX_3 "User cancelled message by pressing %c\n", f->subclass);
+ res = f->subclass;
outmsg = 0;
break;
}
@@ -793,14 +808,22 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
return res;
}
+static char default_acceptdtmf[] = "#";
+static char default_canceldtmf[] = "";
+
+int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path, const char *acceptdtmf, const char *canceldtmf)
+{
+ return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, 0, silencethreshold, maxsilence, path, 0, S_OR(acceptdtmf, default_acceptdtmf), S_OR(canceldtmf, default_canceldtmf));
+}
+
int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
{
- return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, 0, silencethreshold, maxsilence, path, 0);
+ return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, 0, silencethreshold, maxsilence, path, 0, default_acceptdtmf, default_canceldtmf);
}
int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence)
{
- return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, beep, silencethreshold, maxsilence, NULL, 1);
+ return __ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, beep, silencethreshold, maxsilence, NULL, 1, default_acceptdtmf, default_canceldtmf);
}
/* Channel group core functions */