Wed Oct 28 15:47:55 2009

Asterisk developer's documentation


pbx.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  * \brief Core PBX routines and definitions.
00021  */
00022 
00023 #ifndef _ASTERISK_PBX_H
00024 #define _ASTERISK_PBX_H
00025 
00026 #include "asterisk/sched.h"
00027 #include "asterisk/channel.h"
00028 
00029 #if defined(__cplusplus) || defined(c_plusplus)
00030 extern "C" {
00031 #endif
00032 
00033 #define AST_PBX_KEEP    0
00034 #define AST_PBX_REPLACE 1
00035 
00036 /*! Max length of an application */
00037 #define AST_MAX_APP  32
00038 
00039 /*! Special return values from applications to the PBX */
00040 #define AST_PBX_KEEPALIVE  10    /* Destroy the thread, but don't hang up the channel */
00041 #define AST_PBX_NO_HANGUP_PEER       11
00042 
00043 /*! Special Priority for an hint */
00044 #define PRIORITY_HINT   -1
00045 
00046 /*! Extension states */
00047 enum ast_extension_states {
00048    /*! Extension removed */
00049    AST_EXTENSION_REMOVED = -2,
00050    /*! Extension hint removed */
00051    AST_EXTENSION_DEACTIVATED = -1,
00052    /*! No device INUSE or BUSY  */
00053    AST_EXTENSION_NOT_INUSE = 0,
00054    /*! One or more devices INUSE */
00055    AST_EXTENSION_INUSE = 1 << 0,
00056    /*! All devices BUSY */
00057    AST_EXTENSION_BUSY = 1 << 1,
00058    /*! All devices UNAVAILABLE/UNREGISTERED */
00059    AST_EXTENSION_UNAVAILABLE = 1 << 2,
00060    /*! All devices RINGING */
00061    AST_EXTENSION_RINGING = 1 << 3,
00062 };
00063 
00064 
00065 static const struct cfextension_states {
00066    int extension_state;
00067    const char * const text;
00068 } extension_states[] = {
00069    { AST_EXTENSION_NOT_INUSE,                     "Idle" },
00070    { AST_EXTENSION_INUSE,                         "InUse" },
00071    { AST_EXTENSION_BUSY,                          "Busy" },
00072    { AST_EXTENSION_UNAVAILABLE,                   "Unavailable" },
00073    { AST_EXTENSION_RINGING,                       "Ringing" },
00074    { AST_EXTENSION_INUSE | AST_EXTENSION_RINGING, "InUse&Ringing" }
00075 };
00076 
00077 struct ast_context;
00078 struct ast_exten;     
00079 struct ast_include;
00080 struct ast_ignorepat;
00081 struct ast_sw;
00082 
00083 typedef int (*ast_state_cb_type)(char *context, char* id, enum ast_extension_states state, void *data);
00084 
00085 /*! Data structure associated with a custom function */
00086 struct ast_custom_function {
00087    char *name;
00088    char *synopsis;
00089    char *desc;
00090    char *syntax;
00091    char *(*read)(struct ast_channel *, char *, char *, char *, size_t);
00092    void (*write)(struct ast_channel *, char *, char *, const char *);
00093    struct ast_custom_function *next;
00094 };
00095 
00096 /*! Data structure associated with an asterisk switch */
00097 struct ast_switch {
00098    /*! NULL */
00099    struct ast_switch *next;   
00100    /*! Name of the switch */
00101    const char *name;          
00102    /*! Description of the switch */
00103    const char *description;      
00104    
00105    int (*exists)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
00106    
00107    int (*canmatch)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
00108    
00109    int (*exec)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data);
00110 
00111    int (*matchmore)(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
00112 };
00113 
00114 struct ast_timing {
00115    int hastime;            /* If time construct exists */
00116    unsigned int monthmask;       /* Mask for month */
00117    unsigned int daymask;         /* Mask for date */
00118    unsigned int dowmask;         /* Mask for day of week (mon-sun) */
00119    unsigned int minmask[24];     /* Mask for minute */
00120 };
00121 
00122 extern int ast_build_timing(struct ast_timing *i, char *info);
00123 extern int ast_check_timing(struct ast_timing *i);
00124 
00125 struct ast_pbx {
00126         int dtimeout;                                   /* Timeout between digits (seconds) */
00127         int rtimeout;                                   /* Timeout for response
00128                         (seconds) */
00129 };
00130 
00131 
00132 /*! Register an alternative switch */
00133 /*!
00134  * \param sw switch to register
00135  * This function registers a populated ast_switch structure with the
00136  * asterisk switching architecture.
00137  * It returns 0 on success, and other than 0 on failure
00138  */
00139 extern int ast_register_switch(struct ast_switch *sw);
00140 
00141 /*! Unregister an alternative switch */
00142 /*!
00143  * \param sw switch to unregister
00144  * Unregisters a switch from asterisk.
00145  * Returns nothing
00146  */
00147 extern void ast_unregister_switch(struct ast_switch *sw);
00148 
00149 /*! Look up an application */
00150 /*!
00151  * \param app name of the app
00152  * This function searches for the ast_app structure within
00153  * the apps that are registered for the one with the name
00154  * you passed in.
00155  * Returns the ast_app structure that matches on success, or NULL on failure
00156  */
00157 extern struct ast_app *pbx_findapp(const char *app);
00158 
00159 /*! executes an application */
00160 /*!
00161  * \param c channel to execute on
00162  * \param app which app to execute
00163  * \param data the data passed into the app
00164  * \param newstack stack pointer
00165  * This application executes an application on a given channel.  It
00166  * saves the stack and executes the given appliation passing in
00167  * the given data.
00168  * It returns 0 on success, and -1 on failure
00169  */
00170 int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data, int newstack);
00171 
00172 /*! Register a new context */
00173 /*!
00174  * \param extcontexts pointer to the ast_context structure pointer
00175  * \param name name of the new context
00176  * \param registrar registrar of the context
00177  * This will first search for a context with your name.  If it exists already, it will not
00178  * create a new one.  If it does not exist, it will create a new one with the given name
00179  * and registrar.
00180  * It returns NULL on failure, and an ast_context structure on success
00181  */
00182 struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
00183 
00184 /*! Merge the temporary contexts into a global contexts list and delete from the global list the ones that are being added */
00185 /*!
00186  * \param extcontexts pointer to the ast_context structure pointer
00187  * \param registrar 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
00188  */
00189 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
00190 
00191 /*! Destroy a context (matches the specified context (or ANY context if NULL) */
00192 /*!
00193  * \param con context to destroy
00194  * \param registrar who registered it
00195  * You can optionally leave out either parameter.  It will find it
00196  * based on either the ast_context or the registrar name.
00197  * Returns nothing
00198  */
00199 void ast_context_destroy(struct ast_context *con, const char *registrar);
00200 
00201 /*! Find a context */
00202 /*!
00203  * \param name name of the context to find
00204  * Will search for the context with the given name.
00205  * Returns the ast_context on success, NULL on failure.
00206  */
00207 struct ast_context *ast_context_find(const char *name);
00208 
00209 enum ast_pbx_result {
00210    AST_PBX_SUCCESS = 0,
00211    AST_PBX_FAILED = -1,
00212    AST_PBX_CALL_LIMIT = -2,
00213 };
00214 
00215 /*! Create a new thread and start the PBX (or whatever) */
00216 /*!
00217  * \param c channel to start the pbx on
00218  * \return Zero on success, non-zero on failure
00219  */
00220 enum ast_pbx_result ast_pbx_start(struct ast_channel *c);
00221 
00222 /*! Execute the PBX in the current thread */
00223 /*!
00224  * \param c channel to run the pbx on
00225  * \return Zero on success, non-zero on failure
00226  * This executes the PBX on a given channel. It allocates a new
00227  * PBX structure for the channel, and provides all PBX functionality.
00228  */
00229 enum ast_pbx_result ast_pbx_run(struct ast_channel *c);
00230 
00231 /*! 
00232  * \param context context to add the extension to
00233  * \param replace
00234  * \param extension extension to add
00235  * \param priority priority level of extension addition
00236  * \param label extension label
00237  * \param callerid callerid of extension
00238  * \param application application to run on the extension with that priority level
00239  * \param data data to pass to the application
00240  * \param datad
00241  * \param registrar who registered the extension
00242  * Add and extension to an extension context.  
00243  * Callerid is a pattern to match CallerID, or NULL to match any callerid
00244  * Returns 0 on success, -1 on failure
00245  */
00246 int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid,
00247    const char *application, void *data, void (*datad)(void *), const char *registrar);
00248 
00249 /*! 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 */
00250 /*! 
00251  * For details about the arguements, check ast_add_extension()
00252  */
00253 int ast_add_extension2(struct ast_context *con,
00254                   int replace, const char *extension, int priority, const char *label, const char *callerid, 
00255                  const char *application, void *data, void (*datad)(void *),
00256                  const char *registrar);
00257 
00258 /*! Add an application.  The function 'execute' should return non-zero if the line needs to be hung up.  */
00259 /*!
00260   \param app Short name of the application
00261   \param execute a function callback to execute the application
00262   \param synopsis a short description of the application
00263   \param description long description of the application
00264    Include a one-line synopsis (e.g. 'hangs up a channel') and a more lengthy, multiline
00265    description with more detail, including under what conditions the application
00266    will return 0 or -1.
00267    This registers an application with asterisks internal application list.  Please note:
00268    The individual applications themselves are responsible for registering and unregistering
00269    CLI commands.
00270    It returns 0 on success, -1 on failure.
00271 */
00272 int ast_register_application(const char *app, int (*execute)(struct ast_channel *, void *),
00273               const char *synopsis, const char *description);
00274 
00275 /*! Remove an application */
00276 /*!
00277  * \param app name of the application (does not have to be the same string as the one that was registered)
00278  * This unregisters an application from asterisk's internal registration mechanisms.
00279  * It returns 0 on success, and -1 on failure.
00280  */
00281 int ast_unregister_application(const char *app);
00282 
00283 /*! Uses hint and devicestate callback to get the state of an extension */
00284 /*!
00285  * \param c this is not important
00286  * \param context which context to look in
00287  * \param exten which extension to get state
00288  * Returns extension state !! = AST_EXTENSION_???
00289  */
00290 int ast_extension_state(struct ast_channel *c, char *context, char *exten);
00291 
00292 /*! Return string of the state of an extension */
00293 /*!
00294  * \param extension_state is the numerical state delivered by ast_extension_state
00295  * Returns the state of an extension as string
00296  */
00297 const char *ast_extension_state2str(int extension_state);
00298 
00299 /*! Registers a state change callback */
00300 /*!
00301  * \param context which context to look in
00302  * \param exten which extension to get state
00303  * \param callback callback to call if state changed
00304  * \param data to pass to callback
00305  * The callback is called if the state for extension is changed
00306  * Return -1 on failure, ID on success
00307  */ 
00308 int ast_extension_state_add(const char *context, const char *exten, 
00309              ast_state_cb_type callback, void *data);
00310 
00311 /*! Deletes a registered state change callback by ID */
00312 /*!
00313  * \param id of the callback to delete
00314  * \param callback callback
00315  * Removes the callback from list of callbacks
00316  * Return 0 on success, -1 on failure
00317  */
00318 int ast_extension_state_del(int id, ast_state_cb_type callback);
00319 
00320 /*! If an extension exists, return non-zero */
00321 /*!
00322  * \param hint buffer for hint
00323  * \param maxlen size of hint buffer
00324  * \param name buffer for name portion of hint
00325  * \param maxnamelen size of name buffer
00326  * \param c this is not important
00327  * \param context which context to look in
00328  * \param exten which extension to search for
00329  * If an extension within the given context with the priority PRIORITY_HINT
00330  * is found a non zero value will be returned.
00331  * Otherwise, 0 is returned.
00332  */
00333 int ast_get_hint(char *hint, int maxlen, char *name, int maxnamelen, struct ast_channel *c, const char *context, const char *exten);
00334 
00335 /*! If an extension exists, return non-zero */
00336 /*  work */
00337 /*!
00338  * \param c this is not important
00339  * \param context which context to look in
00340  * \param exten which extension to search for
00341  * \param priority priority of the action within the extension
00342  * \param callerid callerid to search for
00343  * If an extension within the given context(or callerid) with the given priority is found a non zero value will be returned.
00344  * Otherwise, 0 is returned.
00345  */
00346 int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
00347 
00348 /*! If an extension exists, return non-zero */
00349 /*  work */
00350 /*!
00351  * \param c this is not important
00352  * \param context which context to look in
00353  * \param exten which extension to search for
00354  * \param label label of the action within the extension to match to priority
00355  * \param callerid callerid to search for
00356  * If an priority which matches given label in extension or -1 if not found.
00357 \ */
00358 int ast_findlabel_extension(struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid);
00359 
00360 int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *con, const char *exten, const char *label, const char *callerid);
00361 
00362 /*! Looks for a valid matching extension */
00363 /*!
00364   \param c not really important
00365   \param context context to serach within
00366   \param exten extension to check
00367   \param priority priority of extension path
00368   \param callerid callerid of extension being searched for
00369    If "exten" *could be* a valid extension in this context with or without
00370    some more digits, return non-zero.  Basically, when this returns 0, no matter
00371    what you add to exten, it's not going to be a valid extension anymore
00372 */
00373 int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
00374 
00375 /*! Looks to see if adding anything to this extension might match something. (exists ^ canmatch) */
00376 /*!
00377   \param c not really important
00378   \param context context to serach within
00379   \param exten extension to check
00380   \param priority priority of extension path
00381   \param callerid callerid of extension being searched for
00382    If "exten" *could match* a valid extension in this context with
00383    some more digits, return non-zero.  Does NOT return non-zero if this is
00384    an exact-match only.  Basically, when this returns 0, no matter
00385    what you add to exten, it's not going to be a valid extension anymore
00386 */
00387 int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
00388 
00389 /*! Determine if a given extension matches a given pattern (in NXX format) */
00390 /*!
00391  * \param pattern pattern to match
00392  * \param extension extension to check against the pattern.
00393  * Checks whether or not the given extension matches the given pattern.
00394  * Returns 1 on match, 0 on failure
00395  */
00396 int ast_extension_match(const char *pattern, const char *extension);
00397 int ast_extension_close(const char *pattern, const char *data, int needmore);
00398 /*! Launch a new extension (i.e. new stack) */
00399 /*!
00400  * \param c not important
00401  * \param context which context to generate the extension within
00402  * \param exten new extension to add
00403  * \param priority priority of new extension
00404  * \param callerid callerid of extension
00405  * This adds a new extension to the asterisk extension list.
00406  * It returns 0 on success, -1 on failure.
00407  */
00408 int ast_spawn_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
00409 
00410 /*! Execute an extension. */
00411 /*!
00412   \param c channel to execute upon
00413   \param context which context extension is in
00414   \param exten extension to execute
00415   \param priority priority to execute within the given extension
00416   \param callerid Caller-ID
00417    If it's not available, do whatever you should do for
00418    default extensions and halt the thread if necessary.  This function does not
00419    return, except on error.
00420 */
00421 int ast_exec_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);
00422 
00423 /*! Add an include */
00424 /*!
00425   \param context context to add include to
00426   \param include new include to add
00427   \param registrar who's registering it
00428    Adds an include taking a char * string as the context parameter
00429    Returns 0 on success, -1 on error
00430 */
00431 int ast_context_add_include(const char *context, const char *include, const char *registrar);
00432 
00433 /*! Add an include */
00434 /*!
00435   \param con context to add the include to
00436   \param include include to add
00437   \param registrar who registered the context
00438    Adds an include taking a struct ast_context as the first parameter
00439    Returns 0 on success, -1 on failure
00440 */
00441 int ast_context_add_include2(struct ast_context *con, const char *include, const char *registrar);
00442 
00443 /*! Removes an include */
00444 /*!
00445  * See add_include
00446  */
00447 int ast_context_remove_include(const char *context, const char *include,const  char *registrar);
00448 /*! Removes an include by an ast_context structure */
00449 /*!
00450  * See add_include2
00451  */
00452 int ast_context_remove_include2(struct ast_context *con, const char *include, const char *registrar);
00453 
00454 /*! Verifies includes in an ast_contect structure */
00455 /*!
00456  * \param con context in which to verify the includes
00457  * Returns 0 if no problems found, -1 if there were any missing context
00458  */
00459 int ast_context_verify_includes(struct ast_context *con);
00460      
00461 /*! Add a switch */
00462 /*!
00463  * \param context context to which to add the switch
00464  * \param sw switch to add
00465  * \param data data to pass to switch
00466  * \param eval whether to evaluate variables when running switch
00467  * \param registrar whoever registered the switch
00468  * This function registers a switch with the asterisk switch architecture
00469  * It returns 0 on success, -1 on failure
00470  */
00471 int ast_context_add_switch(const char *context, const char *sw, const char *data, int eval, const char *registrar);
00472 /*! Adds a switch (first param is a ast_context) */
00473 /*!
00474  * See ast_context_add_switch()
00475  */
00476 int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data, int eval, const char *registrar);
00477 
00478 /*! Remove a switch */
00479 /*!
00480  * Removes a switch with the given parameters
00481  * Returns 0 on success, -1 on failure
00482  */
00483 int ast_context_remove_switch(const char *context, const char *sw, const char *data, const char *registrar);
00484 int ast_context_remove_switch2(struct ast_context *con, const char *sw, const char *data, const char *registrar);
00485 
00486 /*! Simply remove extension from context */
00487 /*!
00488  * \param context context to remove extension from
00489  * \param extension which extension to remove
00490  * \param priority priority of extension to remove
00491  * \param registrar registrar of the extension
00492  * This function removes an extension from a given context.
00493  * Returns 0 on success, -1 on failure
00494  */
00495 int ast_context_remove_extension(const char *context, const char *extension, int priority,
00496    const char *registrar);
00497 int ast_context_remove_extension2(struct ast_context *con, const char *extension,
00498    int priority, const char *registrar);
00499 
00500 /*! Add an ignorepat */
00501 /*!
00502  * \param context which context to add the ignorpattern to
00503  * \param ignorepat ignorepattern to set up for the extension
00504  * \param registrar registrar of the ignore pattern
00505  * Adds an ignore pattern to a particular context.
00506  * Returns 0 on success, -1 on failure
00507  */
00508 int ast_context_add_ignorepat(const char *context, const char *ignorepat, const char *registrar);
00509 int ast_context_add_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
00510 
00511 /* Remove an ignorepat */
00512 /*!
00513  * \param context context from which to remove the pattern
00514  * \param ignorepat the pattern to remove
00515  * \param registrar the registrar of the ignore pattern
00516  * This removes the given ignorepattern
00517  * Returns 0 on success, -1 on failure
00518  */
00519 int ast_context_remove_ignorepat(const char *context, const char *ignorepat, const char *registrar);
00520 int ast_context_remove_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
00521 
00522 /*! Checks to see if a number should be ignored */
00523 /*!
00524  * \param context context to search within
00525  * \param pattern to check whether it should be ignored or not
00526  * Check if a number should be ignored with respect to dialtone cancellation.  
00527  * Returns 0 if the pattern should not be ignored, or non-zero if the pattern should be ignored 
00528  */
00529 int ast_ignore_pattern(const char *context, const char *pattern);
00530 
00531 /* Locking functions for outer modules, especially for completion functions */
00532 /*! Locks the contexts */
00533 /*! Locks the context list
00534  * Returns 0 on success, -1 on error
00535  */
00536 int ast_lock_contexts(void);
00537 
00538 /*! Unlocks contexts */
00539 /*!
00540  * Returns 0 on success, -1 on failure
00541  */
00542 int ast_unlock_contexts(void);
00543 
00544 /*! Locks a given context */
00545 /*!
00546  * \param con context to lock
00547  * Locks the context.
00548  * Returns 0 on success, -1 on failure
00549  */
00550 int ast_lock_context(struct ast_context *con);
00551 /*! Unlocks the given context */
00552 /*!
00553  * \param con context to unlock
00554  * Unlocks the given context
00555  * Returns 0 on success, -1 on failure
00556  */
00557 int ast_unlock_context(struct ast_context *con);
00558 
00559 
00560 int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
00561 
00562 int ast_async_goto_by_name(const char *chan, const char *context, const char *exten, int priority);
00563 
00564 /* Synchronously or asynchronously make an outbound call and send it to a
00565    particular extension */
00566 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, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
00567 
00568 /* Synchronously or asynchronously make an outbound call and send it to a
00569    particular application with given extension */
00570 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, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
00571 
00572 /* Evaluate a condition for non-falseness and return a boolean */
00573 int pbx_checkcondition(char *condition);
00574 
00575 /* Functions for returning values from structures */
00576 const char *ast_get_context_name(struct ast_context *con);
00577 const char *ast_get_extension_name(struct ast_exten *exten);
00578 const char *ast_get_include_name(struct ast_include *include);
00579 const char *ast_get_ignorepat_name(struct ast_ignorepat *ip);
00580 const char *ast_get_switch_name(struct ast_sw *sw);
00581 const char *ast_get_switch_data(struct ast_sw *sw);
00582 
00583 /* Other extension stuff */
00584 int ast_get_extension_priority(struct ast_exten *exten);
00585 int ast_get_extension_matchcid(struct ast_exten *e);
00586 const char *ast_get_extension_cidmatch(struct ast_exten *e);
00587 const char *ast_get_extension_app(struct ast_exten *e);
00588 const char *ast_get_extension_label(struct ast_exten *e);
00589 void *ast_get_extension_app_data(struct ast_exten *e);
00590 
00591 /* Registrar info functions ... */
00592 const char *ast_get_context_registrar(struct ast_context *c);
00593 const char *ast_get_extension_registrar(struct ast_exten *e);
00594 const char *ast_get_include_registrar(struct ast_include *i);
00595 const char *ast_get_ignorepat_registrar(struct ast_ignorepat *ip);
00596 const char *ast_get_switch_registrar(struct ast_sw *sw);
00597 
00598 /* Walking functions ... */
00599 struct ast_context *ast_walk_contexts(struct ast_context *con);
00600 struct ast_exten *ast_walk_context_extensions(struct ast_context *con,
00601    struct ast_exten *priority);
00602 struct ast_exten *ast_walk_extension_priorities(struct ast_exten *exten,
00603    struct ast_exten *priority);
00604 struct ast_include *ast_walk_context_includes(struct ast_context *con,
00605    struct ast_include *inc);
00606 struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con,
00607    struct ast_ignorepat *ip);
00608 struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw);
00609 
00610 int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size);
00611 extern char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
00612 extern void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, const char *value);
00613 extern void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
00614 extern void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp);
00615 extern void pbx_builtin_clear_globals(void);
00616 extern int pbx_builtin_setvar(struct ast_channel *chan, void *data);
00617 extern void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count);
00618 extern void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count);
00619 
00620 int ast_extension_patmatch(const char *pattern, const char *data);
00621 
00622 /* Set "autofallthrough" flag, if newval is <0, does not acutally set.  If
00623   set to 1, sets to auto fall through.  If newval set to 0, sets to no auto
00624   fall through (reads extension instead).  Returns previous value. */
00625 extern int pbx_set_autofallthrough(int newval);
00626 int ast_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority);
00627 /* I can find neither parsable nor parseable at dictionary.com, but google gives me 169000 hits for parseable and only 49,800 for parsable */
00628 int ast_parseable_goto(struct ast_channel *chan, const char *goto_string);
00629 int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
00630 int ast_async_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority);
00631 
00632 struct ast_custom_function* ast_custom_function_find(char *name);
00633 int ast_custom_function_unregister(struct ast_custom_function *acf);
00634 int ast_custom_function_register(struct ast_custom_function *acf);
00635 
00636 /* Number of active calls */
00637 int ast_active_calls(void);
00638    
00639 /*! executes a read operation on a function */
00640 /*!
00641  * \param chan Channel to execute on
00642  * \param in Data containing the function call string
00643  * \param workspace A pointer to safe memory to use for a return value 
00644  * \param len the number of bytes in workspace
00645  * This application executes an function in read mode on a given channel.
00646  * It returns a pointer to workspace if the buffer contains any new data
00647  * or NULL if there was a problem.
00648  */
00649    
00650 char *ast_func_read(struct ast_channel *chan, const char *in, char *workspace, size_t len);
00651 
00652 /*! executes a write operation on a function */
00653 /*!
00654  * \param chan Channel to execute on
00655  * \param in Data containing the function call string
00656  * \param value A value parameter to pass for writing
00657  * This application executes an function in write mode on a given channel.
00658  * It has no return value.
00659  */
00660 void ast_func_write(struct ast_channel *chan, const char *in, const char *value);
00661 
00662 void ast_hint_state_changed(const char *device);
00663 
00664 #if defined(__cplusplus) || defined(c_plusplus)
00665 }
00666 #endif
00667 
00668 #endif /* _ASTERISK_PBX_H */

Generated on Wed Oct 28 15:47:55 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6