summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-10-03 04:19:59 +0000
committerMark Spencer <markster@digium.com>2004-10-03 04:19:59 +0000
commitfce17976e94f746ee13bfe67c586c395867e9585 (patch)
treeebfab599cc9bd5e02129e2a5bd1842ee528a7106 /include
parent34988d1ce9c47c1a0291e273396e216b993c014b (diff)
Major PBX revamps (including labels, update examples)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3886 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/cdr.h14
-rwxr-xr-xinclude/asterisk/channel.h32
-rwxr-xr-xinclude/asterisk/pbx.h135
3 files changed, 97 insertions, 84 deletions
diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h
index 90d9433e3..5c9f6c8e5 100755
--- a/include/asterisk/cdr.h
+++ b/include/asterisk/cdr.h
@@ -3,9 +3,9 @@
*
* Call Detail Record API
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster@linux-support.net>
+ * Mark Spencer <markster@digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License.
@@ -207,7 +207,7 @@ extern void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data);
* Converts the string form of the flag to the binary form.
* Returns the binary form of the flag
*/
-extern int ast_cdr_amaflags2int(char *flag);
+extern int ast_cdr_amaflags2int(const char *flag);
//! Disposition to a string
/*!
@@ -233,12 +233,12 @@ extern void ast_cdr_reset(struct ast_cdr *cdr, int flags);
*/
extern char *ast_cdr_flags2str(int flags);
-extern int ast_cdr_setaccount(struct ast_channel *chan, char *account);
-extern int ast_cdr_setamaflags(struct ast_channel *chan, char *account);
+extern int ast_cdr_setaccount(struct ast_channel *chan, const char *account);
+extern int ast_cdr_setamaflags(struct ast_channel *chan, const char *amaflags);
-extern int ast_cdr_setuserfield(struct ast_channel *chan, char *userfield);
-extern int ast_cdr_appenduserfield(struct ast_channel *chan, char *userfield);
+extern int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield);
+extern int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield);
/* Update CDR on a channel */
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 9022e1a51..a754129f6 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -79,7 +79,7 @@ struct ast_channel {
/*! Language requested */
char language[MAX_LANGUAGE];
/*! Type of channel */
- char *type;
+ const char *type;
/*! File descriptor for channel -- Drivers will poll on these file descriptors, so at least one must be non -1. */
int fds[AST_MAX_FDS];
@@ -303,13 +303,13 @@ struct chanmon;
}
struct outgoing_helper {
- char *context;
- char *exten;
+ const char *context;
+ const char *exten;
int priority;
- char *cid_num;
- char *cid_name;
- char *variable;
- char *account;
+ const char *cid_num;
+ const char *cid_name;
+ const char *variable;
+ const char *account;
};
#define AST_CDR_TRANSFER (1 << 0)
@@ -377,7 +377,7 @@ struct outgoing_helper {
* by the low level module
* Returns an ast_channel on success, NULL on failure.
*/
-struct ast_channel *ast_request(char *type, int format, void *data);
+struct ast_channel *ast_request(const char *type, int format, void *data);
//! Search the Channels by Name
/*!
@@ -411,9 +411,9 @@ int ast_device_state(char *device);
* Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
* to know if the call was answered or not.
*/
-struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int timeout, int *reason, char *cidnum, char *cidname);
+struct ast_channel *ast_request_and_dial(const char *type, int format, void *data, int timeout, int *reason, const char *cidnum, const char *cidname);
-struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, int timeout, int *reason, char *cidnum, char *cidname, struct outgoing_helper *oh);
+struct ast_channel *__ast_request_and_dial(const char *type, int format, void *data, int timeout, int *reason, const char *cidnum, const char *cidname, struct outgoing_helper *oh);
//! Registers a channel
/*!
@@ -426,12 +426,12 @@ struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, i
* routine that creates a channel
* Returns 0 on success, -1 on failure.
*/
-int ast_channel_register(char *type, char *description, int capabilities,
- struct ast_channel* (*requester)(char *type, int format, void *data));
+int ast_channel_register(const char *type, const char *description, int capabilities,
+ struct ast_channel* (*requester)(const char *type, int format, void *data));
/* Same like the upper function but with support for devicestate */
-int ast_channel_register_ex(char *type, char *description, int capabilities,
- struct ast_channel *(*requester)(char *type, int format, void *data),
+int ast_channel_register_ex(const char *type, const char *description, int capabilities,
+ struct ast_channel *(*requester)(const char *type, int format, void *data),
int (*devicestate)(void *data));
//! Unregister a channel class
@@ -440,7 +440,7 @@ int ast_channel_register_ex(char *type, char *description, int capabilities,
* Basically just unregisters the channel with the asterisk channel system
* No return value.
*/
-void ast_channel_unregister(char *type);
+void ast_channel_unregister(const char *type);
//! Hang up a channel
/*!
@@ -790,7 +790,7 @@ int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen,
/*! Deactive an active generator */
void ast_deactivate_generator(struct ast_channel *chan);
-void ast_set_callerid(struct ast_channel *chan, char *cidnum, char *cidname, char *ani);
+void ast_set_callerid(struct ast_channel *chan, const char *cidnum, const char *cidname, const char *ani);
/*! Start a tone going */
int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol);
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 5bec931ed..fdeea056f 100755
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -56,17 +56,17 @@ struct ast_switch {
/*! NULL */
struct ast_switch *next;
/*! Name of the switch */
- char *name;
+ const char *name;
/*! Description of the switch */
- char *description;
+ const char *description;
- int (*exists)(struct ast_channel *chan, char *context, char *exten, int priority, char *callerid, char *data);
+ int (*exists)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
- int (*canmatch)(struct ast_channel *chan, char *context, char *exten, int priority, char *callerid, char *data);
+ int (*canmatch)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
- int (*exec)(struct ast_channel *chan, char *context, char *exten, int priority, char *callerid, int newstack, char *data);
+ int (*exec)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data);
- int (*matchmore)(struct ast_channel *chan, char *context, char *exten, int priority, char *callerid, char *data);
+ int (*matchmore)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
};
struct ast_pbx {
@@ -101,7 +101,7 @@ extern void ast_unregister_switch(struct ast_switch *sw);
* you passed in.
* Returns the ast_app structure that matches on success, or NULL on failure
*/
-extern struct ast_app *pbx_findapp(char *app);
+extern struct ast_app *pbx_findapp(const char *app);
//! executes an application
/*!
@@ -126,14 +126,14 @@ int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data, int newstac
* and registrar.
* It returns NULL on failure, and an ast_context structure on success
*/
-struct ast_context *ast_context_create(struct ast_context **extcontexts, char *name, char *registrar);
+struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
//! Merge the temporary contexts into a global contexts list and delete from the global list the ones that are being added
/*!
* \param extcontexts pointer to the ast_context structure pointer
* \param registar of the context; if it's set the routine will delete all contexts that belong to that registrar; if NULL only the contexts that are specified in extcontexts
*/
-void ast_merge_contexts_and_delete(struct ast_context **extcontexts, char *registrar);
+void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
//! Destroy a context (matches the specified context (or ANY context if NULL)
/*!
@@ -143,7 +143,7 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, char *regis
* based on either the ast_context or the registrar name.
* Returns nothing
*/
-void ast_context_destroy(struct ast_context *con, char *registrar);
+void ast_context_destroy(struct ast_context *con, const char *registrar);
//! Find a context
/*!
@@ -151,7 +151,7 @@ void ast_context_destroy(struct ast_context *con, char *registrar);
* Will search for the context with the given name.
* Returns the ast_context on success, NULL on failure.
*/
-struct ast_context *ast_context_find(char *name);
+struct ast_context *ast_context_find(const char *name);
//! Create a new thread and start the PBX (or whatever)
/*!
@@ -183,17 +183,17 @@ int ast_pbx_run(struct ast_channel *c);
* Callerid is a pattern to match CallerID, or NULL to match any callerid
* Returns 0 on success, -1 on failure
*/
-int ast_add_extension(char *context, int replace, char *extension, int priority, char *callerid,
- char *application, void *data, void (*datad)(void *), char *registrar);
+int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid,
+ const char *application, void *data, void (*datad)(void *), const char *registrar);
//! Add an extension to an extension context, this time with an ast_context *. CallerID is a pattern to match on callerid, or NULL to not care about callerid
/*!
* For details about the arguements, check ast_add_extension()
*/
int ast_add_extension2(struct ast_context *con,
- int replace, char *extension, int priority, char *callerid,
- char *application, void *data, void (*datad)(void *),
- char *registrar);
+ int replace, const char *extension, int priority, const char *label, const char *callerid,
+ const char *application, void *data, void (*datad)(void *),
+ const char *registrar);
//! Add an application. The function 'execute' should return non-zero if the line needs to be hung up.
/*!
@@ -209,8 +209,8 @@ int ast_add_extension2(struct ast_context *con,
CLI commands.
It returns 0 on success, -1 on failure.
*/
-int ast_register_application(char *app, int (*execute)(struct ast_channel *, void *),
- char *synopsis, char *description);
+int ast_register_application(const char *app, int (*execute)(struct ast_channel *, void *),
+ const char *synopsis, const char *description);
//! Remove an application
/*!
@@ -218,7 +218,7 @@ int ast_register_application(char *app, int (*execute)(struct ast_channel *, voi
* This unregisters an application from asterisk's internal registration mechanisms.
* It returns 0 on success, and -1 on failure.
*/
-int ast_unregister_application(char *app);
+int ast_unregister_application(const char *app);
//! Uses hint and devicestate callback to get the state of an extension
/*!
@@ -248,7 +248,7 @@ int ast_device_state_changed(const char *fmt, ...)
* The callback is called if the state for extension is changed
* Return -1 on failure, ID on success
*/
-int ast_extension_state_add(char *context, char *exten,
+int ast_extension_state_add(const char *context, const char *exten,
ast_state_cb_type callback, void *data);
//! Deletes a registered state change callback by ID
@@ -270,7 +270,7 @@ int ast_extension_state_del(int id, ast_state_cb_type callback);
* is found a non zero value will be returned.
* Otherwise, 0 is returned.
*/
-int ast_get_hint(char *hint, int maxlen, struct ast_channel *c, char *context, char *exten);
+int ast_get_hint(char *hint, int maxlen, struct ast_channel *c, const char *context, const char *exten);
//! If an extension exists, return non-zero
// work
@@ -283,7 +283,19 @@ int ast_get_hint(char *hint, int maxlen, struct ast_channel *c, char *context, c
* If an extension within the given context(or callerid) with the given priority is found a non zero value will be returned.
* Otherwise, 0 is returned.
*/
-int ast_exists_extension(struct ast_channel *c, char *context, char *exten, int priority, char *callerid);
+int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
+
+//! If an extension exists, return non-zero
+// work
+/*!
+ * \param c this is not important
+ * \param context which context to look in
+ * \param exten which extension to search for
+ * \param labellabel of the action within the extension to match to priority
+ * \param callerid callerid to search for
+ * If an priority which matches given label in extension or -1 if not found.
+\ */
+int ast_findlabel_extension(struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid);
//! Looks for a valid matching extension
/*!
@@ -296,7 +308,7 @@ int ast_exists_extension(struct ast_channel *c, char *context, char *exten, int
some more digits, return non-zero. Basically, when this returns 0, no matter
what you add to exten, it's not going to be a valid extension anymore
*/
-int ast_canmatch_extension(struct ast_channel *c, char *context, char *exten, int priority, char *callerid);
+int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
//! Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
/*!
@@ -310,7 +322,7 @@ int ast_canmatch_extension(struct ast_channel *c, char *context, char *exten, in
an exact-match only. Basically, when this returns 0, no matter
what you add to exten, it's not going to be a valid extension anymore
*/
-int ast_matchmore_extension(struct ast_channel *c, char *context, char *exten, int priority, char *callerid);
+int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
//! Determine if a given extension matches a given pattern (in NXX format)
/*!
@@ -319,7 +331,7 @@ int ast_matchmore_extension(struct ast_channel *c, char *context, char *exten, i
* Checks whether or not the given extension matches the given pattern.
* Returns 1 on match, 0 on failure
*/
-int ast_extension_match(char *pattern, char *extension);
+int ast_extension_match(const char *pattern, const char *extension);
//! Launch a new extension (i.e. new stack)
/*!
@@ -331,7 +343,7 @@ int ast_extension_match(char *pattern, char *extension);
* This adds a new extension to the asterisk extension list.
* It returns 0 on success, -1 on failure.
*/
-int ast_spawn_extension(struct ast_channel *c, char *context, char *exten, int priority, char *callerid);
+int ast_spawn_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
//! Execute an extension.
/*!
@@ -343,7 +355,7 @@ int ast_spawn_extension(struct ast_channel *c, char *context, char *exten, int p
default extensions and halt the thread if necessary. This function does not
return, except on error.
*/
-int ast_exec_extension(struct ast_channel *c, char *context, char *exten, int priority, char *callerid);
+int ast_exec_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
//! Add an include
/*!
@@ -353,7 +365,7 @@ int ast_exec_extension(struct ast_channel *c, char *context, char *exten, int pr
Adds an include taking a char * string as the context parameter
Returns 0 on success, -1 on error
*/
-int ast_context_add_include(char *context, char *include, char *registrar);
+int ast_context_add_include(const char *context, const char *include, const char *registrar);
//! Add an include
/*!
@@ -363,18 +375,18 @@ int ast_context_add_include(char *context, char *include, char *registrar);
Adds an include taking a struct ast_context as the first parameter
Returns 0 on success, -1 on failure
*/
-int ast_context_add_include2(struct ast_context *con, char *include, char *registrar);
+int ast_context_add_include2(struct ast_context *con, const char *include, const char *registrar);
//! Removes an include
/*!
* See add_include
*/
-int ast_context_remove_include(char *context, char *include, char *registrar);
+int ast_context_remove_include(const char *context, const char *include,const char *registrar);
//! Removes an include by an ast_context structure
/*!
* See add_include2
*/
-int ast_context_remove_include2(struct ast_context *con, char *include, char *registrar);
+int ast_context_remove_include2(struct ast_context *con, const char *include, const char *registrar);
//! Verifies includes in an ast_contect structure
/*!
@@ -392,20 +404,20 @@ int ast_context_verify_includes(struct ast_context *con);
* This function registers a switch with the asterisk switch architecture
* It returns 0 on success, -1 on failure
*/
-int ast_context_add_switch(char *context, char *sw, char *data, char *registrar);
+int ast_context_add_switch(const char *context, const char *sw, const char *data, const char *registrar);
//! Adds a switch (first param is a ast_context)
/*!
* See ast_context_add_switch()
*/
-int ast_context_add_switch2(struct ast_context *con, char *sw, char *data, char *registrar);
+int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data, const char *registrar);
//! Remove a switch
/*!
* Removes a switch with the given parameters
* Returns 0 on success, -1 on failure
*/
-int ast_context_remove_switch(char *context, char *sw, char *data, char *registrar);
-int ast_context_remove_switch2(struct ast_context *con, char *sw, char *data, char *registrar);
+int ast_context_remove_switch(const char *context, const char *sw, const char *data, const char *registrar);
+int ast_context_remove_switch2(struct ast_context *con, const char *sw, const char *data, const char *registrar);
//! Simply remove extension from context
/*!
@@ -416,10 +428,10 @@ int ast_context_remove_switch2(struct ast_context *con, char *sw, char *data, ch
* This function removes an extension from a given context.
* Returns 0 on success, -1 on failure
*/
-int ast_context_remove_extension(char *context, char *extension, int priority,
- char *registrar);
-int ast_context_remove_extension2(struct ast_context *con, char *extension,
- int priority, char *registrar);
+int ast_context_remove_extension(const char *context, const char *extension, int priority,
+ const char *registrar);
+int ast_context_remove_extension2(struct ast_context *con, const char *extension,
+ int priority, const char *registrar);
//! Add an ignorepat
/*!
@@ -429,8 +441,8 @@ int ast_context_remove_extension2(struct ast_context *con, char *extension,
* Adds an ignore pattern to a particular context.
* Returns 0 on success, -1 on failure
*/
-int ast_context_add_ignorepat(char *context, char *ignorepat, char *registrar);
-int ast_context_add_ignorepat2(struct ast_context *con, char *ignorepat, char *registrar);
+int ast_context_add_ignorepat(const char *context, const char *ignorepat, const char *registrar);
+int ast_context_add_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
/* Remove an ignorepat */
/*!
@@ -440,8 +452,8 @@ int ast_context_add_ignorepat2(struct ast_context *con, char *ignorepat, char *r
* This removes the given ignorepattern
* Returns 0 on success, -1 on failure
*/
-int ast_context_remove_ignorepat(char *context, char *ignorepat, char *registrar);
-int ast_context_remove_ignorepat2(struct ast_context *con, char *ignorepat, char *registrar);
+int ast_context_remove_ignorepat(const char *context, const char *ignorepat, const char *registrar);
+int ast_context_remove_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
//! Checks to see if a number should be ignored
/*!
@@ -450,7 +462,7 @@ int ast_context_remove_ignorepat2(struct ast_context *con, char *ignorepat, char
* Check if a number should be ignored with respect to dialtone cancellation.
* Returns 0 if the pattern should not be ignored, or non-zero if the pattern should be ignored
*/
-int ast_ignore_pattern(char *context, char *pattern);
+int ast_ignore_pattern(const char *context, const char *pattern);
/* Locking functions for outer modules, especially for completion functions */
//! Locks the contexts
@@ -481,39 +493,40 @@ int ast_lock_context(struct ast_context *con);
int ast_unlock_context(struct ast_context *con);
-int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int priority);
+int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
-int ast_async_goto_by_name(char *chan, char *context, char *exten, int priority);
+int ast_async_goto_by_name(const char *chan, const char *context, const char *exten, int priority);
/* Synchronously or asynchronously make an outbound call and send it to a
particular extension */
-int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *cid_num, char *cid_name, char *variable, char *account );
+int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account );
/* Synchronously or asynchronously make an outbound call and send it to a
particular application with given extension */
-int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *app, char *appdata, int *reason, int sync, char *cid_num, char *cid_name, char *variable, char *account);
+int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, const char *variable, const char *account);
/* Functions for returning values from structures */
-char *ast_get_context_name(struct ast_context *con);
-char *ast_get_extension_name(struct ast_exten *exten);
-char *ast_get_include_name(struct ast_include *include);
-char *ast_get_ignorepat_name(struct ast_ignorepat *ip);
-char *ast_get_switch_name(struct ast_sw *sw);
-char *ast_get_switch_data(struct ast_sw *sw);
+const char *ast_get_context_name(struct ast_context *con);
+const char *ast_get_extension_name(struct ast_exten *exten);
+const char *ast_get_include_name(struct ast_include *include);
+const char *ast_get_ignorepat_name(struct ast_ignorepat *ip);
+const char *ast_get_switch_name(struct ast_sw *sw);
+const char *ast_get_switch_data(struct ast_sw *sw);
/* Other extension stuff */
int ast_get_extension_priority(struct ast_exten *exten);
int ast_get_extension_matchcid(struct ast_exten *e);
-char *ast_get_extension_cidmatch(struct ast_exten *e);
-char *ast_get_extension_app(struct ast_exten *e);
+const char *ast_get_extension_cidmatch(struct ast_exten *e);
+const char *ast_get_extension_app(struct ast_exten *e);
+const char *ast_get_extension_label(struct ast_exten *e);
void *ast_get_extension_app_data(struct ast_exten *e);
/* Registrar info functions ... */
-char *ast_get_context_registrar(struct ast_context *c);
-char *ast_get_extension_registrar(struct ast_exten *e);
-char *ast_get_include_registrar(struct ast_include *i);
-char *ast_get_ignorepat_registrar(struct ast_ignorepat *ip);
-char *ast_get_switch_registrar(struct ast_sw *sw);
+const char *ast_get_context_registrar(struct ast_context *c);
+const char *ast_get_extension_registrar(struct ast_exten *e);
+const char *ast_get_include_registrar(struct ast_include *i);
+const char *ast_get_ignorepat_registrar(struct ast_ignorepat *ip);
+const char *ast_get_switch_registrar(struct ast_sw *sw);
/* Walking functions ... */
struct ast_context *ast_walk_contexts(struct ast_context *con);