[svn-commits] oej: trunk r115784 - in /trunk: doc/tex/channelvariables.tex main/features.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon May 12 13:39:11 CDT 2008
Author: oej
Date: Mon May 12 13:39:09 2008
New Revision: 115784
URL: http://svn.digium.com/view/asterisk?view=rev&rev=115784
Log:
Add support for playing an audio file for caller and callee at start and stop of monitoring (one-touch monitor).
Keep messages short, since the other party is waiting while one party hear the message...
Modified:
trunk/doc/tex/channelvariables.tex
trunk/main/features.c
Modified: trunk/doc/tex/channelvariables.tex
URL: http://svn.digium.com/view/asterisk/trunk/doc/tex/channelvariables.tex?view=diff&rev=115784&r1=115783&r2=115784
==============================================================================
--- trunk/doc/tex/channelvariables.tex (original)
+++ trunk/doc/tex/channelvariables.tex Mon May 12 13:39:09 2008
@@ -858,6 +858,8 @@
${TOUCH_MONITOR_PREF} * The prefix for automonitor recording filenames.
${TOUCH_MONITOR_FORMAT} The audio format to use with Touch Monitor (auto record)
${TOUCH_MONITOR_OUTPUT} * Recorded file from Touch Monitor (auto record)
+${TOUCH_MONITOR_MESSAGE_START} Recorded file to play for both channels at start of monitoring session
+${TOUCH_MONITOR_MESSAGE_STOP} Recorded file to play for both channels at end of monitoring session
${TXTCIDNAME} * Result of application TXTCIDName
${VPB_GETDTMF} chan_vpb
\end{verbatim}
Modified: trunk/main/features.c
URL: http://svn.digium.com/view/asterisk/trunk/main/features.c?view=diff&rev=115784&r1=115783&r2=115784
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Mon May 12 13:39:09 2008
@@ -751,6 +751,34 @@
}
+/*! \brief Play message to both caller and callee in bridged call, plays synchronously, autoservicing the
+ other channel during the message, so please don't use this for very long messages
+ */
+static int play_message_in_bridged_call(struct ast_channel *caller_chan, struct ast_channel *callee_chan, const char *audiofile)
+{
+ /* First play for caller, put other channel on auto service */
+ if (ast_autoservice_start(callee_chan))
+ return -1;
+ if (ast_stream_and_wait(caller_chan, audiofile, "")) {
+ ast_log(LOG_WARNING, "Failed to play automon message!\n");
+ ast_autoservice_stop(callee_chan);
+ return -1;
+ }
+ if (ast_autoservice_stop(callee_chan))
+ return -1;
+ /* Then play for callee, put other channel on auto service */
+ if (ast_autoservice_start(caller_chan))
+ return -1;
+ if (ast_stream_and_wait(callee_chan, audiofile, "")) {
+ ast_log(LOG_WARNING, "Failed to play automon message !\n");
+ ast_autoservice_stop(caller_chan);
+ return -1;
+ }
+ if (ast_autoservice_stop(caller_chan))
+ return -1;
+ return(0);
+}
+
/*!
* \brief Monitor a channel by DTMF
* \param chan channel requesting monitor
@@ -771,6 +799,8 @@
int x = 0;
size_t len;
struct ast_channel *caller_chan, *callee_chan;
+ const char *automon_message_start = NULL;
+ const char *automon_message_stop = NULL;
if (!monitor_ok) {
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
@@ -784,21 +814,22 @@
}
set_peers(&caller_chan, &callee_chan, peer, chan, sense);
-
- if (!ast_strlen_zero(courtesytone)) {
- if (ast_autoservice_start(callee_chan))
+ if (caller_chan) { /* Find extra messages */
+ automon_message_start = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MONITOR_MESSAGE_START");
+ automon_message_stop = pbx_builtin_getvar_helper(caller_chan, "TOUCH_MONITOR_MESSAGE_STOP");
+ }
+
+ if (!ast_strlen_zero(courtesytone)) { /* Play courtesy tone if configured */
+ if(play_message_in_bridged_call(caller_chan, callee_chan, courtesytone) == -1) {
return -1;
- if (ast_stream_and_wait(caller_chan, courtesytone, "")) {
- ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
- ast_autoservice_stop(callee_chan);
- return -1;
- }
- if (ast_autoservice_stop(callee_chan))
- return -1;
+ }
}
if (callee_chan->monitor) {
ast_verb(4, "User hit '%s' to stop recording call.\n", code);
+ if (!ast_strlen_zero(automon_message_stop)) {
+ play_message_in_bridged_call(caller_chan, callee_chan, automon_message_stop);
+ }
callee_chan->monitor->stop(callee_chan, 1);
return AST_FEATURE_RETURN_SUCCESS;
}
@@ -843,6 +874,10 @@
pbx_exec(callee_chan, monitor_app, args);
pbx_builtin_setvar_helper(callee_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
pbx_builtin_setvar_helper(caller_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
+
+ if (!ast_strlen_zero(automon_message_start)) { /* Play start message for both channels */
+ play_message_in_bridged_call(caller_chan, callee_chan, automon_message_start);
+ }
return AST_FEATURE_RETURN_SUCCESS;
}
More information about the svn-commits
mailing list