aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-24 18:23:07 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-24 18:23:07 +0000
commit5989475899c8a033ec4feb260ffc74fa2132b3f7 (patch)
treea9510da2dcc997e14af60ad68b92d646b3b75673 /include
parent7e5c2b3d1e9dbfab5a650ef756569d6ea23f2b55 (diff)
Merged revisions 52049 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r52049 | file | 2007-01-24 13:20:05 -0500 (Wed, 24 Jan 2007) | 2 lines Merge in dialing API and the app_page that uses it. (issue #BE-118) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@52050 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/dial.h142
1 files changed, 142 insertions, 0 deletions
diff --git a/include/asterisk/dial.h b/include/asterisk/dial.h
new file mode 100644
index 000000000..f8393abba
--- /dev/null
+++ b/include/asterisk/dial.h
@@ -0,0 +1,142 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2007, Digium, Inc.
+ *
+ * Joshua Colp <jcolp@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 Dialing API
+ */
+
+#ifndef _ASTERISK_DIAL_H
+#define _ASTERISK_DIAL_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/*! \brief Main dialing structure. Contains global options, channels being dialed, and more! */
+struct ast_dial;
+
+/*! \brief Dialing channel structure. Contains per-channel dialing options, asterisk channel, and more! */
+struct ast_dial_channel;
+
+/*! \brief List of options that are applicable either globally or per dialed channel */
+enum ast_dial_option {
+ AST_DIAL_OPTION_RINGING, /*! Always indicate ringing to caller */
+ AST_DIAL_OPTION_ANSWER_EXEC, /*! Execute application upon answer in async mode */
+ AST_DIAL_OPTION_MAX, /*! End terminator -- must always remain last */
+};
+
+/*! \brief List of return codes for dial run API calls */
+enum ast_dial_result {
+ AST_DIAL_RESULT_INVALID = 0, /*! Invalid options were passed to run function */
+ AST_DIAL_RESULT_FAILED, /*! Attempts to dial failed before reaching critical state */
+ AST_DIAL_RESULT_TRYING, /*! Currently trying to dial */
+ AST_DIAL_RESULT_RINGING, /*! Dial is presently ringing */
+ AST_DIAL_RESULT_PROGRESS, /*! Dial is presently progressing */
+ AST_DIAL_RESULT_PROCEEDING, /*! Dial is presently proceeding */
+ AST_DIAL_RESULT_ANSWERED, /*! A channel was answered */
+ AST_DIAL_RESULT_TIMEOUT, /*! Timeout was tripped, nobody answered */
+ AST_DIAL_RESULT_HANGUP, /*! Caller hung up */
+ AST_DIAL_RESULT_UNANSWERED, /*! Nobody answered */
+};
+
+/*! \brief New dialing structure
+ * \note Create a dialing structure
+ * \return Returns a calloc'd ast_dial structure, NULL on failure
+ */
+struct ast_dial *ast_dial_create(void);
+
+/*! \brief Append a channel
+ * \note Appends a channel to a dialing structure
+ * \return Returns channel reference number on success, -1 on failure
+ */
+int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device);
+
+/*! \brief Execute dialing synchronously or asynchronously
+ * \note Dials channels in a dial structure.
+ * \return Returns dial result code. (TRYING/INVALID/FAILED/ANSWERED/TIMEOUT/UNANSWERED).
+ */
+enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async);
+
+/*! \brief Return channel that answered
+ * \note Returns the Asterisk channel that answered
+ * \param dial Dialing structure
+ */
+struct ast_channel *ast_dial_answered(struct ast_dial *dial);
+
+/*! \brief Return status of dial
+ * \note Returns the status of the dial attempt
+ * \param dial Dialing structure
+ */
+enum ast_dial_result ast_dial_status(struct ast_dial *dial);
+
+/*! \brief Cancel async thread
+ * \note Cancel a running async thread
+ * \param dial Dialing structure
+ */
+enum ast_dial_result ast_dial_join(struct ast_dial *dial);
+
+/*! \brief Hangup channels
+ * \note Hangup all active channels
+ * \param dial Dialing structure
+ */
+void ast_dial_hangup(struct ast_dial *dial);
+
+/*! \brief Destroys a dialing structure
+ * \note Cancels dialing and destroys (free's) the given ast_dial structure
+ * \param dial Dialing structure to free
+ * \return Returns 0 on success, -1 on failure
+ */
+int ast_dial_destroy(struct ast_dial *dial);
+
+/*! \brief Enables an option globally
+ * \param dial Dial structure to enable option on
+ * \param option Option to enable
+ * \param data Data to pass to this option (not always needed)
+ * \return Returns 0 on success, -1 on failure
+ */
+int ast_dial_option_global_enable(struct ast_dial *dial, enum ast_dial_option option, void *data);
+
+/*! \brief Enables an option per channel
+ * \param dial Dial structure
+ * \param num Channel number to enable option on
+ * \param option Option to enable
+ * \param data Data to pass to this option (not always needed)
+ * \return Returns 0 on success, -1 on failure
+ */
+int ast_dial_option_enable(struct ast_dial *dial, int num, enum ast_dial_option option, void *data);
+
+/*! \brief Disables an option globally
+ * \param dial Dial structure to disable option on
+ * \param option Option to disable
+ * \return Returns 0 on success, -1 on failure
+ */
+int ast_dial_option_global_disable(struct ast_dial *dial, enum ast_dial_option option);
+
+/*! \brief Disables an option per channel
+ * \param dial Dial structure
+ * \param num Channel number to disable option on
+ * \param option Option to disable
+ * \return Returns 0 on success, -1 on failure
+ */
+int ast_dial_option_disable(struct ast_dial *dial, int num, enum ast_dial_option option);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_DIAL_H */