From 8923c9ac965a156bd2c0839e95d30023cd4088d4 Mon Sep 17 00:00:00 2001 From: Jaco Kroon Date: Wed, 4 May 2016 09:40:55 +0200 Subject: 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. ASTERISK-25989 #close Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f --- apps/app_confbridge.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'apps/app_confbridge.c') diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index b3609b673..82204c48f 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -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); } -- cgit v1.2.3