Merge "app_confbridge: Add a regcontext option for confbridge bridge profiles."

This commit is contained in:
Joshua Colp
2016-05-10 04:48:35 -05:00
committed by Gerrit Code Review
5 changed files with 45 additions and 0 deletions

View File

@@ -1256,9 +1256,17 @@ void conf_handle_second_active(struct confbridge_conference *conference)
void conf_ended(struct confbridge_conference *conference)
{
struct pbx_find_info q = { .stacklen = 0 };
/* Called with a reference to conference */
ao2_unlink(conference_bridges, conference);
send_conf_end_event(conference);
if (!ast_strlen_zero(conference->b_profile.regcontext) &&
pbx_find_extension(NULL, NULL, &q, conference->b_profile.regcontext,
conference->name, 1, NULL, "", E_MATCH)) {
ast_context_remove_extension(conference->b_profile.regcontext,
conference->name, 1, NULL);
}
ao2_lock(conference);
conf_stop_record(conference);
ao2_unlock(conference);
@@ -1363,6 +1371,13 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
}
send_conf_start_event(conference);
if (!ast_strlen_zero(conference->b_profile.regcontext)) {
if (!ast_exists_extension(NULL, conference->b_profile.regcontext, conference->name, 1, NULL)) {
ast_add_extension(conference->b_profile.regcontext, 1, conference->name, 1, NULL, NULL, "Noop", NULL, NULL, "ConfBridge");
}
}
ast_debug(1, "Created conference '%s' and linked to container.\n", conference_name);
}

View File

@@ -339,6 +339,22 @@ ASTERISK_REGISTER_FILE()
unescaped to <variable>X</variable>. All variables will be evaluated at the time ConfBridge is called.
</para></description>
</configOption>
<configOption name="regcontext">
<synopsis>The name of the context into which to register the name of the conference bridge as NoOP() at priority 1</synopsis>
<description><para>
When set this will cause the name of the created conference to be registered
into the named context at priority 1 with an operation of NoOP(). This can
then be used in other parts of the dialplan to test for the existence of a
specific conference bridge.
You should be aware that there are potential races between testing for the
existence of a bridge, and taking action upon that information, consider
for example two callers executing the check simultaniously, and then taking
special action as "first caller" into the bridge. The same for exiting,
directly after the check the bridge can be destroyed before the new caller
enters (creating a new bridge), for example, and the "first member" actions
could thus be missed.
</para></description>
</configOption>
<configOption name="video_mode">
<synopsis>Sets how confbridge handles video distribution to the conference participants</synopsis>
<description><para>
@@ -1595,6 +1611,8 @@ static char *handle_cli_confbridge_show_bridge_profile(struct ast_cli_entry *e,
ast_cli(a->fd,"Max Members: No Limit\n");
}
ast_cli(a->fd,"Registration context: %s\n", b_profile.regcontext);
switch (b_profile.flags
& (BRIDGE_OPT_VIDEO_SRC_LAST_MARKED | BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
| BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER)) {
@@ -2163,6 +2181,7 @@ int conf_load_config(void)
aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
aco_option_register(&cfg_info, "regcontext", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, regcontext));
aco_option_register(&cfg_info, "language", ACO_EXACT, bridge_types, "en", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, language));
aco_option_register_custom(&cfg_info, "^sound_", ACO_REGEX, bridge_types, NULL, sound_option_handler, 0);
/* This option should only be used with the CONFBRIDGE dialplan function */

View File

@@ -210,6 +210,7 @@ struct bridge_profile {
unsigned int internal_sample_rate; /*!< The internal sample rate of the bridge. 0 when set to auto adjust mode. */
unsigned int mix_interval; /*!< The internal mixing interval used by the bridge. When set to 0 the bridgewill use a default interval. */
struct bridge_profile_sounds *sounds;
char regcontext[AST_MAX_CONTEXT];
};
/*! \brief The structure that represents a conference bridge */