[asterisk-commits] file: branch file/dialing_api r49216 - in
/team/file/dialing_api: apps/ inclu...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 2 13:35:27 MST 2007
Author: file
Date: Tue Jan 2 14:35:26 2007
New Revision: 49216
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49216
Log:
Add app_dial2 which will become a wrapper around the dialing API. Right now it's incredibly basic and doesn't work but I'm just using it for testing/experimentation.
Added:
team/file/dialing_api/apps/app_dial2.c (with props)
Modified:
team/file/dialing_api/include/asterisk/dial.h
team/file/dialing_api/main/dial.c
Added: team/file/dialing_api/apps/app_dial2.c
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/apps/app_dial2.c?view=auto&rev=49216
==============================================================================
--- team/file/dialing_api/apps/app_dial2.c (added)
+++ team/file/dialing_api/apps/app_dial2.c Tue Jan 2 14:35:26 2007
@@ -1,0 +1,112 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999-2007, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Dialplan Dialing Application (using Dialing API)
+ *
+ * \author Joshua Colp <jcolp at digium.com>
+ *
+ * Dialplan Dialing Application (using Dialing API)
+ * \ingroup applications
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "asterisk/file.h"
+#include "asterisk/logger.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/module.h"
+#include "asterisk/lock.h"
+#include "asterisk/app.h"
+#include "asterisk/dial.h"
+
+static char *app = "Dial2";
+static char *synopsis =
+"Dialplan Dialing Application (using Dialing API)";
+static char *descrip =
+" Dial(Technology/resource[&Tech2/resource2...]:\n"
+"This application will place calls to one or more specified channels. As soon\n"
+"as one of the requested channels answers, the originating channel will be\n"
+"answered, if it has not already been answered. These two channels will then\n"
+"be active in a bridged call. All other channels that were requested will then\n"
+"be hung up.\n";
+
+static int dial2_exec(struct ast_channel *chan, void *data)
+{
+ int res = 0;
+ struct ast_module_user *u;
+ struct ast_dial *dial = NULL;
+ char *tmp = NULL, *tech = NULL, *device = NULL;
+ struct ast_channel *answered = NULL;
+
+ if (ast_strlen_zero(data)) {
+ ast_log(LOG_WARNING, "%s requires an argument (Technology/resource[&Tech2/resource2...])\n", app);
+ return -1;
+ }
+
+ u = ast_module_user_add(chan);
+
+ /* Create a dialing structure */
+ if (!(dial = ast_dial_create())) {
+ ast_log(LOG_WARNING, "Failed to create dialing structure.\n");
+ ast_module_user_remove(u);
+ return -1;
+ }
+
+ /* Make local copy of data */
+ tmp = ast_strdupa(data);
+
+ /* Iterate through parsing each technology and device */
+ while ((tech = strsep(&tmp, "&"))) {
+ /* Find device */
+ if (!(device = strchr(tech, '/')))
+ continue;
+ *device++ = '\0';
+
+ /* Append to dial structure */
+ ast_dial_append(dial, tech, device);
+ }
+
+ /* Attempt to dial all the channels */
+ ast_dial_run(dial, chan, &answered, 0);
+
+ ast_module_user_remove(u);
+
+ return res;
+}
+
+static int unload_module(void)
+{
+ return ast_unregister_application(app);
+}
+
+static int load_module(void)
+{
+ return ast_register_application(app, dial2_exec, synopsis, descrip);
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialplan Dialing Application (using Dialing API)");
Propchange: team/file/dialing_api/apps/app_dial2.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/file/dialing_api/apps/app_dial2.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/file/dialing_api/apps/app_dial2.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/file/dialing_api/include/asterisk/dial.h
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/include/asterisk/dial.h?view=diff&rev=49216&r1=49215&r2=49216
==============================================================================
--- team/file/dialing_api/include/asterisk/dial.h (original)
+++ team/file/dialing_api/include/asterisk/dial.h Tue Jan 2 14:35:26 2007
@@ -55,7 +55,7 @@
* \note Dials channels in a dial structure and does not return until one is answered or timeout is reached. Will also forward progress/ringing.
* \return Returns 0 on success, -1 on failure
*/
-int ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, struct ast_channel *answered, int timeout);
+int ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, struct ast_channel **answered, int timeout);
/*! \brief Execute dialing asynchronously
* \note Dials channels in a dial structure in a separate thread, returns almost immediately
Modified: team/file/dialing_api/main/dial.c
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/main/dial.c?view=diff&rev=49216&r1=49215&r2=49216
==============================================================================
--- team/file/dialing_api/main/dial.c (original)
+++ team/file/dialing_api/main/dial.c Tue Jan 2 14:35:26 2007
@@ -131,7 +131,7 @@
* \note Dials channels in a dial structure and does not return until one is answered or timeout is reached. Will also forward progress/ringing.
* \return Returns 0 on success, -1 on failure
*/
-int ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, struct ast_channel *answered, int timeout)
+int ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, struct ast_channel **answered, int timeout)
{
return 0;
}
More information about the asterisk-commits
mailing list