[Asterisk-code-review] Add a regcontext option for confbridge bridge profiles. (asterisk[11])

Jaco Kroon asteriskteam at digium.com
Tue Apr 26 13:11:12 CDT 2016


Jaco Kroon has uploaded a new change for review.

  https://gerrit.asterisk.org/2708

Change subject: Add a regcontext option for confbridge bridge profiles.
......................................................................

Add a regcontext option for confbridge bridge profiles.

Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f
---
M apps/app_confbridge.c
M apps/confbridge/conf_config_parser.c
M apps/confbridge/include/confbridge.h
3 files changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/2708/1

diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index 9ac1030..f292841 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -1154,9 +1154,17 @@
 
 void conf_ended(struct conference_bridge *conference_bridge)
 {
+	struct pbx_find_info q;
+
 	/* Called with a reference to conference_bridge */
 	ao2_unlink(conference_bridges, conference_bridge);
 	send_conf_end_event(conference_bridge->name);
+	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_bridge);
 	conf_stop_record(conference_bridge);
 	ao2_unlock(conference_bridge);
@@ -1265,6 +1273,12 @@
 
 		send_conf_start_event(conference_bridge->name);
 		ast_debug(1, "Created conference '%s' and linked to container.\n", name);
+
+		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");
+			}
+		}
 	}
 
 	ao2_unlock(conference_bridges);
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index 98838de..cc5301e 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -930,6 +930,8 @@
 		break;
 	}
 
+	ast_cli(a->fd,"Registration context: %s\n", b_profile.regcontext);
+
 	ast_cli(a->fd,"sound_only_person:    %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
 	ast_cli(a->fd,"sound_only_one:       %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
 	ast_cli(a->fd,"sound_has_joined:     %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
@@ -1395,6 +1397,7 @@
 	aco_option_register_custom(&cfg_info, "video_mode", ACO_EXACT, bridge_types, NULL, video_mode_handler, 0);
 	aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
 	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, "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 e05b1fc..ce5266c 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -200,6 +200,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[64];
 };
 
 /*! \brief The structure that represents a conference bridge */

-- 
To view, visit https://gerrit.asterisk.org/2708
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>



More information about the asterisk-code-review mailing list