mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
confbridge: Minor fixes playing user counts to the conference.
* Generate a warning message if sound files do not exist when trying to play the user count to the conference. Use the new helper routine sound_file_exists() for consistency. * Put the new user into autoservice when playing user counts to the conference. * Check the return value of ast_bridge_impart(). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@379808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -665,6 +665,23 @@ static void send_leave_event(struct ast_channel *chan, const char *conf_name)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \internal
|
||||||
|
* \brief Complain if the given sound file does not exist.
|
||||||
|
*
|
||||||
|
* \param filename Sound file to check if exists.
|
||||||
|
*
|
||||||
|
* \retval non-zero if the file exists.
|
||||||
|
*/
|
||||||
|
static int sound_file_exists(const char *filename)
|
||||||
|
{
|
||||||
|
if (ast_fileexists(filename, NULL, NULL)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Announce number of users in the conference bridge to the caller
|
* \brief Announce number of users in the conference bridge to the caller
|
||||||
*
|
*
|
||||||
@@ -710,7 +727,7 @@ static int announce_user_count(struct conference_bridge *conference_bridge, stru
|
|||||||
"")) {
|
"")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (ast_fileexists(there_are, NULL, NULL) && ast_fileexists(other_in_party, NULL, NULL)) {
|
} else if (sound_file_exists(there_are) && sound_file_exists(other_in_party)) {
|
||||||
play_sound_file(conference_bridge, there_are);
|
play_sound_file(conference_bridge, there_are);
|
||||||
play_sound_number(conference_bridge, conference_bridge->activeusers - 1);
|
play_sound_number(conference_bridge, conference_bridge->activeusers - 1);
|
||||||
play_sound_file(conference_bridge, other_in_party);
|
play_sound_file(conference_bridge, other_in_party);
|
||||||
@@ -1200,7 +1217,16 @@ static struct conference_bridge *join_conference_bridge(const char *name, struct
|
|||||||
|
|
||||||
if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ANNOUNCEUSERCOUNTALL) &&
|
if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ANNOUNCEUSERCOUNTALL) &&
|
||||||
(conference_bridge->activeusers > conference_bridge_user->u_profile.announce_user_count_all_after)) {
|
(conference_bridge->activeusers > conference_bridge_user->u_profile.announce_user_count_all_after)) {
|
||||||
if (announce_user_count(conference_bridge, NULL)) {
|
int user_count_res;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We have to autoservice the new user because he has not quite
|
||||||
|
* joined the conference yet.
|
||||||
|
*/
|
||||||
|
ast_autoservice_start(conference_bridge_user->chan);
|
||||||
|
user_count_res = announce_user_count(conference_bridge, NULL);
|
||||||
|
ast_autoservice_stop(conference_bridge_user->chan);
|
||||||
|
if (user_count_res) {
|
||||||
leave_conference(conference_bridge_user);
|
leave_conference(conference_bridge_user);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1279,8 +1305,7 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const
|
|||||||
struct ast_channel *underlying_channel;
|
struct ast_channel *underlying_channel;
|
||||||
|
|
||||||
/* Do not waste resources trying to play files that do not exist */
|
/* Do not waste resources trying to play files that do not exist */
|
||||||
if (!ast_strlen_zero(filename) && !ast_fileexists(filename, NULL, NULL)) {
|
if (!ast_strlen_zero(filename) && !sound_file_exists(filename)) {
|
||||||
ast_log(LOG_WARNING, "File %s does not exist in any format\n", !ast_strlen_zero(filename) ? filename : "<unknown>");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1294,7 +1319,10 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const
|
|||||||
} else {
|
} else {
|
||||||
/* Channel was already available so we just need to add it back into the bridge */
|
/* Channel was already available so we just need to add it back into the bridge */
|
||||||
underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL);
|
underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL);
|
||||||
ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL, 0);
|
if (ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL, 0)) {
|
||||||
|
ast_mutex_unlock(&conference_bridge->playback_lock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The channel is all under our control, in goes the prompt */
|
/* The channel is all under our control, in goes the prompt */
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ static int bridge_call(struct ast_channel *ast, const char *dest, int timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Impart the output channel upon the given bridge of the input channel */
|
/* Impart the output channel upon the given bridge of the input channel */
|
||||||
ast_bridge_impart(ast_channel_internal_bridge(p->input), p->output, NULL, NULL, 0);
|
return ast_bridge_impart(ast_channel_internal_bridge(p->input), p->output, NULL, NULL, 0)
|
||||||
|
? -1 : 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Called when a channel should be hung up */
|
/*! \brief Called when a channel should be hung up */
|
||||||
|
|||||||
Reference in New Issue
Block a user