[asterisk-commits] file: branch file/dialing_api r49348 -
/team/file/dialing_api/apps/app_dial2.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Jan 3 15:11:08 MST 2007
Author: file
Date: Wed Jan 3 16:11:07 2007
New Revision: 49348
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49348
Log:
Add support to Dial2 for options in general, and 'r' option to be more precise.
Modified:
team/file/dialing_api/apps/app_dial2.c
Modified: team/file/dialing_api/apps/app_dial2.c
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/apps/app_dial2.c?view=diff&rev=49348&r1=49347&r2=49348
==============================================================================
--- team/file/dialing_api/apps/app_dial2.c (original)
+++ team/file/dialing_api/apps/app_dial2.c Wed Jan 3 16:11:07 2007
@@ -56,14 +56,27 @@
"be active in a bridged call. All other channels that were requested will then\n"
"be hung up.\n";
+enum {
+ OPTION_RINGING = (1 << 0),
+} option_flags;
+
+AST_APP_OPTIONS(app_opts,{
+ AST_APP_OPTION('r', OPTION_RINGING),
+});
+
static int dial2_exec(struct ast_channel *chan, void *data)
{
+ struct ast_flags flags;
int res = -1;
struct ast_module_user *u;
struct ast_dial *dial = NULL;
- char *tmp = NULL, *tech = NULL, *device = NULL;
+ char *tmp = NULL, *tmp2 = NULL, *tech = NULL, *device = NULL;
struct ast_channel *answered = NULL;
struct ast_bridge_config bridge_config;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(dummy);
+ AST_APP_ARG(options);
+ );
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "%s requires an argument (Technology/resource[&Tech2/resource2...])\n", app);
@@ -82,8 +95,19 @@
/* Make local copy of data */
tmp = ast_strdupa(data);
+ /* Parse options out */
+ AST_STANDARD_APP_ARGS(args, tmp);
+
+ if (args.argc == 2)
+ ast_app_parse_options(app_opts, &flags, NULL, args.options);
+
+ /* If ringing is enabled, then enable it globally on the dial structure */
+ if (ast_test_flag(&flags, OPTION_RINGING))
+ ast_dial_option_global_enable(dial, AST_DIAL_OPTION_RINGING, NULL);
+
+ tmp2 = args.dummy;
/* Iterate through parsing each technology and device */
- while ((tech = strsep(&tmp, "&"))) {
+ while ((tech = strsep(&tmp2, "&"))) {
/* Find device */
if (!(device = strchr(tech, '/')))
continue;
More information about the asterisk-commits
mailing list