[Asterisk-cvs]
asterisk/include/asterisk cdr.h, 1.12, 1.13 channel.h,
1.56, 1.57 pbx.h, 1.26, 1.27
markster at lists.digium.com
markster at lists.digium.com
Sun Oct 3 00:18:12 CDT 2004
Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv7037/include/asterisk
Modified Files:
cdr.h channel.h pbx.h
Log Message:
Major PBX revamps (including labels, update examples)
Index: cdr.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/cdr.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cdr.h 24 Sep 2004 21:32:56 -0000 1.12
+++ cdr.h 3 Oct 2004 04:19:58 -0000 1.13
@@ -3,9 +3,9 @@
*
* Call Detail Record API
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium, Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License.
@@ -207,7 +207,7 @@
* 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 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 */
Index: channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- channel.h 2 Oct 2004 00:58:31 -0000 1.56
+++ channel.h 3 Oct 2004 04:19:58 -0000 1.57
@@ -79,7 +79,7 @@
/*! 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 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
/*! 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);
Index: pbx.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/pbx.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- pbx.h 2 Oct 2004 00:58:31 -0000 1.26
+++ pbx.h 3 Oct 2004 04:19:58 -0000 1.27
@@ -56,17 +56,17 @@
/*! 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
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 @@
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 @@
* 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 @@
* 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 @@
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 @@
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 @@
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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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_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);
More information about the svn-commits
mailing list