|
124 | 124 | </variable>
|
125 | 125 | </variablelist>
|
126 | 126 | </description>
|
| 127 | + <see-also> |
| 128 | + <ref type="application">ConfKick</ref> |
| 129 | + <ref type="function">CONFBRIDGE</ref> |
| 130 | + <ref type="function">CONFBRIDGE_INFO</ref> |
| 131 | + </see-also> |
| 132 | + </application> |
| 133 | + <application name="ConfKick" language="en_US"> |
| 134 | + <synopsis> |
| 135 | + Kicks channel(s) from the requested ConfBridge. |
| 136 | + </synopsis> |
| 137 | + <syntax> |
| 138 | + <parameter name="conference" required="true" /> |
| 139 | + <parameter name="channel"> |
| 140 | + <para>The channel to kick, <literal>all</literal> |
| 141 | + to kick all users, or <literal>participants</literal> |
| 142 | + to kick all non-admin participants. Default is all.</para> |
| 143 | + </parameter> |
| 144 | + </syntax> |
| 145 | + <description> |
| 146 | + <para>Kicks the requested channel(s) from a conference bridge.</para> |
| 147 | + <variablelist> |
| 148 | + <variable name="CONFKICKSTATUS"> |
| 149 | + <value name="FAILURE"> |
| 150 | + Could not kick any users with the provided arguments. |
| 151 | + </value> |
| 152 | + <value name="SUCCESS"> |
| 153 | + Successfully kicked users from specified conference bridge. |
| 154 | + </value> |
| 155 | + </variable> |
| 156 | + </variablelist> |
| 157 | + </description> |
127 | 158 | <see-also>
|
128 | 159 | <ref type="application">ConfBridge</ref>
|
129 | 160 | <ref type="function">CONFBRIDGE</ref>
|
|
426 | 457 | */
|
427 | 458 |
|
428 | 459 | static const char app[] = "ConfBridge";
|
| 460 | +static const char app2[] = "ConfKick"; |
429 | 461 |
|
430 | 462 | /*! Number of buckets our conference bridges container can have */
|
431 | 463 | #define CONFERENCE_BRIDGE_BUCKETS 53
|
@@ -4221,6 +4253,53 @@ static int func_confbridge_info(struct ast_channel *chan, const char *cmd, char
|
4221 | 4253 | return 0;
|
4222 | 4254 | }
|
4223 | 4255 |
|
| 4256 | +static int confkick_exec(struct ast_channel *chan, const char *data) |
| 4257 | +{ |
| 4258 | + char *parse; |
| 4259 | + struct confbridge_conference *conference; |
| 4260 | + int not_found; |
| 4261 | + |
| 4262 | + AST_DECLARE_APP_ARGS(args, |
| 4263 | + AST_APP_ARG(confbridge); |
| 4264 | + AST_APP_ARG(channel); |
| 4265 | + ); |
| 4266 | + |
| 4267 | + if (ast_strlen_zero(data)) { |
| 4268 | + ast_log(LOG_WARNING, "No conference bridge specified.\n"); |
| 4269 | + pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE"); |
| 4270 | + return 0; |
| 4271 | + } |
| 4272 | + |
| 4273 | + parse = ast_strdupa(data); |
| 4274 | + AST_STANDARD_APP_ARGS(args, parse); |
| 4275 | + |
| 4276 | + conference = ao2_find(conference_bridges, args.confbridge, OBJ_KEY); |
| 4277 | + if (!conference) { |
| 4278 | + ast_log(LOG_WARNING, "No conference bridge named '%s' found!\n", args.confbridge); |
| 4279 | + pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE"); |
| 4280 | + return 0; |
| 4281 | + } |
| 4282 | + if (ast_strlen_zero(args.channel)) { |
| 4283 | + not_found = kick_conference_participant(conference, "all"); |
| 4284 | + } else { |
| 4285 | + not_found = kick_conference_participant(conference, args.channel); |
| 4286 | + } |
| 4287 | + |
| 4288 | + ao2_ref(conference, -1); |
| 4289 | + if (not_found) { |
| 4290 | + if (ast_strlen_zero(args.channel) || !strcasecmp("all", args.channel) || !strcasecmp("participants", args.channel)) { |
| 4291 | + ast_log(LOG_WARNING, "No participants found in conference bridge '%s'!\n", args.confbridge); |
| 4292 | + } else { |
| 4293 | + ast_log(LOG_WARNING, "No participant named '%s' found in conference bridge '%s'!\n", args.channel, args.confbridge); |
| 4294 | + } |
| 4295 | + pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE"); |
| 4296 | + return 0; |
| 4297 | + } |
| 4298 | + ast_debug(1, "Kicked '%s' out of conference '%s'\n", args.channel, args.confbridge); |
| 4299 | + pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "SUCCESS"); |
| 4300 | + return 0; |
| 4301 | +} |
| 4302 | + |
4224 | 4303 | void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user)
|
4225 | 4304 | {
|
4226 | 4305 | AST_LIST_INSERT_TAIL(&conference->active_list, user, list);
|
@@ -4314,6 +4393,7 @@ static int register_channel_tech(struct ast_channel_tech *tech)
|
4314 | 4393 | static int unload_module(void)
|
4315 | 4394 | {
|
4316 | 4395 | ast_unregister_application(app);
|
| 4396 | + ast_unregister_application(app2); |
4317 | 4397 |
|
4318 | 4398 | ast_custom_function_unregister(&confbridge_function);
|
4319 | 4399 | ast_custom_function_unregister(&confbridge_info_function);
|
@@ -4384,6 +4464,7 @@ static int load_module(void)
|
4384 | 4464 | res |= manager_confbridge_init();
|
4385 | 4465 |
|
4386 | 4466 | res |= ast_register_application_xml(app, confbridge_exec);
|
| 4467 | + res |= ast_register_application_xml(app2, confkick_exec); |
4387 | 4468 |
|
4388 | 4469 | res |= ast_custom_function_register_escalating(&confbridge_function, AST_CFE_WRITE);
|
4389 | 4470 | res |= ast_custom_function_register(&confbridge_info_function);
|
|
0 commit comments