[Asterisk-code-review] app confbridge: Add a regcontext option for confbridge bridg... (asterisk[master])
Jaco Kroon
asteriskteam at digium.com
Wed May 4 02:48:02 CDT 2016
Jaco Kroon has uploaded a new change for review.
https://gerrit.asterisk.org/2756
Change subject: app_confbridge: Add a regcontext option for confbridge bridge profiles.
......................................................................
app_confbridge: Add a regcontext option for confbridge bridge profiles.
This patch allows for having app_confbridge register the name of the
conference as an extension into a specific context, similar to
regcontext for chan_sip. This variant is not quite as involved as the
one in chan_sip and doesn't allow for multiple contexts or custom
extensions, you can only specify the context and the conference name
will always be used as the extension to register.
Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f
---
M CHANGES
M apps/app_confbridge.c
M apps/confbridge/conf_config_parser.c
M apps/confbridge/include/confbridge.h
M configs/samples/confbridge.conf.sample
5 files changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/56/2756/1
diff --git a/CHANGES b/CHANGES
index 8d1e339..f112128 100644
--- a/CHANGES
+++ b/CHANGES
@@ -284,6 +284,14 @@
into the "reg_server" field in the ps_contacts table to facilitate
multi-server setups.
+app_confbridge
+------------------
+ * Added a bridge profile option called regcontext that allows you to
+ dynamically register the conference bridge name as an extension into
+ the specified context. This allows tracking down conferences on multi-
+ server installations via alternate means (DUNDI for example). By default
+ this feature is not used.
+
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.8.0 to Asterisk 13.9.0 ------------
------------------------------------------------------------------------------
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index b3609b6..a43eeb7 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -1256,9 +1256,17 @@
void conf_ended(struct confbridge_conference *conference)
{
+ struct pbx_find_info q;
+
/* Called with a reference to conference */
ao2_unlink(conference_bridges, conference);
send_conf_end_event(conference);
+ if (!ast_strlen_zero(conference_bridge->b_profile.regcontext) && \
+ pbx_find_extension(NULL, NULL, &q, conference_bridge->b_profile.regcontext,
+ conference_bridge->name, 1, NULL, "", E_MATCH)) {
+ ast_context_remove_extension(conference_bridge->b_profile.regcontext,
+ conference_bridge->name, 1, NULL);
+ }
ao2_lock(conference);
conf_stop_record(conference);
ao2_unlock(conference);
@@ -1363,6 +1371,13 @@
}
send_conf_start_event(conference);
+
+ if (!ast_strlen_zero(conference_bridge->b_profile.regcontext)) {
+ if (!ast_exists_extension(NULL, conference_bridge->b_profile.regcontext, conference_bridge->name, 1, NULL)) {
+ ast_add_extension(conference_bridge->b_profile.regcontext, 1, conference_bridge->name, 1, NULL, NULL, "Noop", NULL, NULL, "ConfBridge");
+ }
+ }
+
ast_debug(1, "Created conference '%s' and linked to container.\n", conference_name);
}
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index a33c6a1..1cb7caf 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -1595,6 +1595,8 @@
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 +2165,7 @@
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 */
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 539b996..d0bad8e 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -210,6 +210,7 @@
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 */
diff --git a/configs/samples/confbridge.conf.sample b/configs/samples/confbridge.conf.sample
index e738685..5b9f52d 100644
--- a/configs/samples/confbridge.conf.sample
+++ b/configs/samples/confbridge.conf.sample
@@ -217,6 +217,8 @@
;language=en ; Set the language used for announcements to the conference.
; Default is en (English).
+;regcontext=conferences ; The name of the context into which to register conference names as extensions.
+
; All sounds in the conference are customizable using the bridge profile options below.
; Simply state the option followed by the filename or full path of the filename after
; the option. Example: sound_had_joined=conf-hasjoin This will play the conf-hasjoin
--
To view, visit https://gerrit.asterisk.org/2756
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
More information about the asterisk-code-review
mailing list