mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
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... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115784 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -858,6 +858,8 @@ ${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto reco
|
|||||||
${TOUCH_MONITOR_PREF} * The prefix for automonitor recording filenames.
|
${TOUCH_MONITOR_PREF} * The prefix for automonitor recording filenames.
|
||||||
${TOUCH_MONITOR_FORMAT} The audio format to use with Touch Monitor (auto record)
|
${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_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
|
${TXTCIDNAME} * Result of application TXTCIDName
|
||||||
${VPB_GETDTMF} chan_vpb
|
${VPB_GETDTMF} chan_vpb
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
@@ -751,6 +751,34 @@ static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \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
|
* \brief Monitor a channel by DTMF
|
||||||
* \param chan channel requesting monitor
|
* \param chan channel requesting monitor
|
||||||
@@ -771,6 +799,8 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct ast_channel *caller_chan, *callee_chan;
|
struct ast_channel *caller_chan, *callee_chan;
|
||||||
|
const char *automon_message_start = NULL;
|
||||||
|
const char *automon_message_stop = NULL;
|
||||||
|
|
||||||
if (!monitor_ok) {
|
if (!monitor_ok) {
|
||||||
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
|
ast_log(LOG_ERROR,"Cannot record the call. The monitor application is disabled.\n");
|
||||||
@@ -784,21 +814,22 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_peers(&caller_chan, &callee_chan, peer, chan, sense);
|
set_peers(&caller_chan, &callee_chan, peer, chan, sense);
|
||||||
|
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)) {
|
if (!ast_strlen_zero(courtesytone)) { /* Play courtesy tone if configured */
|
||||||
if (ast_autoservice_start(callee_chan))
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ast_autoservice_stop(callee_chan))
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callee_chan->monitor) {
|
if (callee_chan->monitor) {
|
||||||
ast_verb(4, "User hit '%s' to stop recording call.\n", code);
|
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);
|
callee_chan->monitor->stop(callee_chan, 1);
|
||||||
return AST_FEATURE_RETURN_SUCCESS;
|
return AST_FEATURE_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -843,6 +874,10 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
|
|||||||
pbx_exec(callee_chan, monitor_app, args);
|
pbx_exec(callee_chan, monitor_app, args);
|
||||||
pbx_builtin_setvar_helper(callee_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
|
pbx_builtin_setvar_helper(callee_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
|
||||||
pbx_builtin_setvar_helper(caller_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;
|
return AST_FEATURE_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user