Mon Mar 19 11:30:28 2012

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 - 2006, 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/channel.h"
00027 #include "asterisk/sched.h"
00028 #include "asterisk/devicestate.h"
00029 #include "asterisk/chanvars.h"
00030 #include "asterisk/hashtab.h"
00031 #include "asterisk/stringfields.h"
00032 #include "asterisk/xmldoc.h"
00033 #include "asterisk/frame_defs.h"
00034 
00035 #if defined(__cplusplus) || defined(c_plusplus)
00036 extern "C" {
00037 #endif
00038 
00039 #define AST_MAX_APP  32 /*!< Max length of an application */
00040 
00041 #define AST_PBX_GOTO_FAILED -3
00042 #define AST_PBX_KEEP    0
00043 #define AST_PBX_REPLACE 1
00044 
00045 /*! \brief Special return values from applications to the PBX
00046  * @{ */
00047 #define AST_PBX_HANGUP                -1    /*!< Jump to the 'h' exten */
00048 #define AST_PBX_OK                     0    /*!< No errors */
00049 #define AST_PBX_ERROR                  1    /*!< Jump to the 'e' exten */
00050 #define AST_PBX_INCOMPLETE             12   /*!< Return to PBX matching, allowing more digits for the extension */
00051 /*! @} */
00052 
00053 #define PRIORITY_HINT   -1 /*!< Special Priority for a hint */
00054 
00055 /*!
00056  * \brief Extension states
00057  * \note States can be combined
00058  * \ref AstExtState
00059  */
00060 enum ast_extension_states {
00061    AST_EXTENSION_REMOVED = -2,   /*!< Extension removed */
00062    AST_EXTENSION_DEACTIVATED = -1,  /*!< Extension hint removed */
00063    AST_EXTENSION_NOT_INUSE = 0,  /*!< No device INUSE or BUSY  */
00064    AST_EXTENSION_INUSE = 1 << 0, /*!< One or more devices INUSE */
00065    AST_EXTENSION_BUSY = 1 << 1,  /*!< All devices BUSY */
00066    AST_EXTENSION_UNAVAILABLE = 1 << 2, /*!< All devices UNAVAILABLE/UNREGISTERED */
00067    AST_EXTENSION_RINGING = 1 << 3,  /*!< All devices RINGING */
00068    AST_EXTENSION_ONHOLD = 1 << 4,   /*!< All devices ONHOLD */
00069 };
00070 
00071 
00072 struct ast_context;
00073 struct ast_exten;
00074 struct ast_include;
00075 struct ast_ignorepat;
00076 struct ast_sw;
00077 
00078 /*! \brief Typedef for devicestate and hint callbacks */
00079 typedef int (*ast_state_cb_type)(char *context, char *id, enum ast_extension_states state, void *data);
00080 
00081 /*! \brief Typedef for devicestate and hint callback removal indication callback */
00082 typedef void (*ast_state_cb_destroy_type)(int id, void *data);
00083 
00084 /*! \brief Data structure associated with a custom dialplan function */
00085 struct ast_custom_function {
00086    const char *name;       /*!< Name */
00087    AST_DECLARE_STRING_FIELDS(
00088       AST_STRING_FIELD(synopsis);     /*!< Synopsis text for 'show functions' */
00089       AST_STRING_FIELD(desc);    /*!< Description (help text) for 'show functions &lt;name&gt;' */
00090       AST_STRING_FIELD(syntax);       /*!< Syntax text for 'core show functions' */
00091       AST_STRING_FIELD(arguments);    /*!< Arguments description */
00092       AST_STRING_FIELD(seealso);      /*!< See also */
00093    );
00094    enum ast_doc_src docsrc;      /*!< Where the documentation come from */
00095    /*! Read function, if read is supported */
00096    ast_acf_read_fn_t read;    /*!< Read function, if read is supported */
00097    /*! Read function, if read is supported.  Note: only one of read or read2
00098     * needs to be implemented.  In new code, read2 should be implemented as
00099     * the way forward, but they should return identical results, within the
00100     * constraints of buffer size, if both are implemented.  That is, if the
00101     * read function is handed a 16-byte buffer, and the result is 17 bytes
00102     * long, then the first 15 bytes (remember NULL terminator) should be
00103     * the same for both the read and the read2 methods. */
00104    ast_acf_read2_fn_t read2;
00105    /*! If no read2 function is provided, what maximum size? */
00106    size_t read_max;
00107    /*! Write function, if write is supported */
00108    ast_acf_write_fn_t write;  /*!< Write function, if write is supported */
00109    struct ast_module *mod;         /*!< Module this custom function belongs to */
00110    AST_RWLIST_ENTRY(ast_custom_function) acflist;
00111 };
00112 
00113 /*! \brief All switch functions have the same interface, so define a type for them */
00114 typedef int (ast_switch_f)(struct ast_channel *chan, const char *context,
00115    const char *exten, int priority, const char *callerid, const char *data);
00116 
00117 /*!< Data structure associated with an Asterisk switch */
00118 struct ast_switch {
00119    AST_LIST_ENTRY(ast_switch) list;
00120    const char *name;       /*!< Name of the switch */
00121    const char *description;      /*!< Description of the switch */
00122 
00123    ast_switch_f *exists;
00124    ast_switch_f *canmatch;
00125    ast_switch_f *exec;
00126    ast_switch_f *matchmore;
00127 };
00128 
00129 struct ast_timing {
00130    int hastime;                    /*!< If time construct exists */
00131    unsigned int monthmask;         /*!< Mask for month */
00132    unsigned int daymask;           /*!< Mask for date */
00133    unsigned int dowmask;           /*!< Mask for day of week (sun-sat) */
00134    unsigned int minmask[48];       /*!< Mask for minute */
00135    char *timezone;                 /*!< NULL, or zoneinfo style timezone */
00136 };
00137 
00138 /*!
00139  * \brief Construct a timing bitmap, for use in time-based conditionals.
00140  * \param i Pointer to an ast_timing structure.
00141  * \param info Standard string containing a timerange, weekday range, monthday range, and month range, as well as an optional timezone.
00142  * \retval Returns 1 on success or 0 on failure.
00143  */
00144 int ast_build_timing(struct ast_timing *i, const char *info);
00145 
00146 /*!
00147  * \brief Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified.
00148  * \param i Pointer to an ast_timing structure.
00149  * \retval Returns 1, if the time matches or 0, if the current time falls outside of the specified range.
00150  */
00151 int ast_check_timing(const struct ast_timing *i);
00152 
00153 /*!
00154  * \brief Evaluate a pre-constructed bitmap as to whether a particular time falls within the range specified.
00155  * \param i Pointer to an ast_timing structure.
00156  * \param tv Specified time
00157  * \retval Returns 1, if the time matches or 0, if the time falls outside of the specified range.
00158  */
00159 int ast_check_timing2(const struct ast_timing *i, const struct timeval tv);
00160 
00161 /*!
00162  * \brief Deallocates memory structures associated with a timing bitmap.
00163  * \param i Pointer to an ast_timing structure.
00164  * \retval 0 success
00165  * \retval non-zero failure (number suitable to pass to \see strerror)
00166  */
00167 int ast_destroy_timing(struct ast_timing *i);
00168 
00169 struct ast_pbx {
00170    int dtimeoutms;            /*!< Timeout between digits (milliseconds) */
00171    int rtimeoutms;            /*!< Timeout for response (milliseconds) */
00172 };
00173 
00174 
00175 /*!
00176  * \brief Register an alternative dialplan switch
00177  *
00178  * \param sw switch to register
00179  *
00180  * This function registers a populated ast_switch structure with the
00181  * asterisk switching architecture.
00182  *
00183  * \retval 0 success
00184  * \retval non-zero failure
00185  */
00186 int ast_register_switch(struct ast_switch *sw);
00187 
00188 /*!
00189  * \brief Unregister an alternative switch
00190  *
00191  * \param sw switch to unregister
00192  *
00193  * Unregisters a switch from asterisk.
00194  *
00195  * \return nothing
00196  */
00197 void ast_unregister_switch(struct ast_switch *sw);
00198 
00199 /*!
00200  * \brief Look up an application
00201  *
00202  * \param app name of the app
00203  *
00204  * This function searches for the ast_app structure within
00205  * the apps that are registered for the one with the name
00206  * you passed in.
00207  *
00208  * \return the ast_app structure that matches on success, or NULL on failure
00209  */
00210 struct ast_app *pbx_findapp(const char *app);
00211 
00212 /*!
00213  * \brief Execute an application
00214  *
00215  * \param c channel to execute on
00216  * \param app which app to execute
00217  * \param data the data passed into the app
00218  *
00219  * This application executes an application on a given channel.  It
00220  * saves the stack and executes the given application passing in
00221  * the given data.
00222  *
00223  * \retval 0 success
00224  * \retval -1 failure
00225  */
00226 int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data);
00227 
00228 /*!
00229  * \brief Register a new context or find an existing one
00230  *
00231  * \param extcontexts pointer to the ast_context structure pointer
00232  * \param exttable pointer to the hashtable that contains all the elements in extcontexts
00233  * \param name name of the new context
00234  * \param registrar registrar of the context
00235  *
00236  * This function allows you to play in two environments: the global contexts (active dialplan)
00237  * or an external context set of your choosing. To act on the external set, make sure extcontexts
00238  * and exttable are set; for the globals, make sure both extcontexts and exttable are NULL.
00239  *
00240  * This will first search for a context with your name.  If it exists already, it will not
00241  * create a new one.  If it does not exist, it will create a new one with the given name
00242  * and registrar.
00243  *
00244  * \return NULL on failure, and an ast_context structure on success
00245  */
00246 struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar);
00247 
00248 /*!
00249  * \brief Merge the temporary contexts into a global contexts list and delete from the
00250  *        global list the ones that are being added
00251  *
00252  * \param extcontexts pointer to the ast_context structure
00253  * \param exttable pointer to the ast_hashtab structure that contains all the elements in extcontexts
00254  * \param registrar of the context; if it's set the routine will delete all contexts
00255  *        that belong to that registrar; if NULL only the contexts that are specified
00256  *        in extcontexts
00257  */
00258 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
00259 
00260 /*!
00261  * \brief Destroy a context (matches the specified context (or ANY context if NULL)
00262  *
00263  * \param con context to destroy
00264  * \param registrar who registered it
00265  *
00266  * You can optionally leave out either parameter.  It will find it
00267  * based on either the ast_context or the registrar name.
00268  *
00269  * \return nothing
00270  */
00271 void ast_context_destroy(struct ast_context *con, const char *registrar);
00272 
00273 /*!
00274  * \brief Find a context
00275  *
00276  * \param name name of the context to find
00277  *
00278  * Will search for the context with the given name.
00279  *
00280  * \return the ast_context on success, NULL on failure.
00281  */
00282 struct ast_context *ast_context_find(const char *name);
00283 
00284 /*!
00285  * \brief The result codes when starting the PBX on a channel with ast_pbx_start.
00286  * \note AST_PBX_CALL_LIMIT refers to the maxcalls call limit in asterisk.conf
00287  * \see ast_pbx_start
00288  */
00289 enum ast_pbx_result {
00290    AST_PBX_SUCCESS = 0,
00291    AST_PBX_FAILED = -1,
00292    AST_PBX_CALL_LIMIT = -2,
00293 };
00294 
00295 /*!
00296  * \brief Create a new thread and start the PBX
00297  *
00298  * \param c channel to start the pbx on
00299  *
00300  * \see ast_pbx_run for a synchronous function to run the PBX in the
00301  * current thread, as opposed to starting a new one.
00302  *
00303  * \retval Zero on success
00304  * \retval non-zero on failure
00305  */
00306 enum ast_pbx_result ast_pbx_start(struct ast_channel *c);
00307 
00308 /*!
00309  * \brief Execute the PBX in the current thread
00310  *
00311  * \param c channel to run the pbx on
00312  *
00313  * This executes the PBX on a given channel. It allocates a new
00314  * PBX structure for the channel, and provides all PBX functionality.
00315  * See ast_pbx_start for an asynchronous function to run the PBX in a
00316  * new thread as opposed to the current one.
00317  *
00318  * \retval Zero on success
00319  * \retval non-zero on failure
00320  */
00321 enum ast_pbx_result ast_pbx_run(struct ast_channel *c);
00322 
00323 /*!
00324  * \brief Options for ast_pbx_run()
00325  */
00326 struct ast_pbx_args {
00327    union {
00328       /*! Pad this out so that we have plenty of room to add options
00329        *  but still maintain ABI compatibility over time. */
00330       uint64_t __padding;
00331       struct {
00332          /*! Do not hangup the channel when the PBX is complete. */
00333          unsigned int no_hangup_chan:1;
00334       };
00335    };
00336 };
00337 
00338 /*!
00339  * \brief Execute the PBX in the current thread
00340  *
00341  * \param c channel to run the pbx on
00342  * \param args options for the pbx
00343  *
00344  * This executes the PBX on a given channel. It allocates a new
00345  * PBX structure for the channel, and provides all PBX functionality.
00346  * See ast_pbx_start for an asynchronous function to run the PBX in a
00347  * new thread as opposed to the current one.
00348  *
00349  * \retval Zero on success
00350  * \retval non-zero on failure
00351  */
00352 enum ast_pbx_result ast_pbx_run_args(struct ast_channel *c, struct ast_pbx_args *args);
00353 
00354 /*!
00355  * \brief Add and extension to an extension context.
00356  *
00357  * \param context context to add the extension to
00358  * \param replace
00359  * \param extension extension to add
00360  * \param priority priority level of extension addition
00361  * \param label extension label
00362  * \param callerid pattern to match CallerID, or NULL to match any CallerID
00363  * \param application application to run on the extension with that priority level
00364  * \param data data to pass to the application
00365  * \param datad
00366  * \param registrar who registered the extension
00367  *
00368  * \retval 0 success
00369  * \retval -1 failure
00370  */
00371 int ast_add_extension(const char *context, int replace, const char *extension,
00372    int priority, const char *label, const char *callerid,
00373    const char *application, void *data, void (*datad)(void *), const char *registrar);
00374 
00375 /*!
00376  * \brief Add an extension to an extension context, this time with an ast_context *.
00377  *
00378  * \note For details about the arguments, check ast_add_extension()
00379  */
00380 int ast_add_extension2(struct ast_context *con, int replace, const char *extension,
00381    int priority, const char *label, const char *callerid,
00382    const char *application, void *data, void (*datad)(void *), const char *registrar);
00383 
00384 /*!
00385  * \brief Map devstate to an extension state.
00386  *
00387  * \param[in] devstate device state
00388  *
00389  * \return the extension state mapping.
00390  */
00391 enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate);
00392 
00393 /*!
00394  * \brief Uses hint and devicestate callback to get the state of an extension
00395  *
00396  * \param c this is not important
00397  * \param context which context to look in
00398  * \param exten which extension to get state
00399  *
00400  * \return extension state as defined in the ast_extension_states enum
00401  */
00402 int ast_extension_state(struct ast_channel *c, const char *context, const char *exten);
00403 
00404 /*!
00405  * \brief Return string representation of the state of an extension
00406  *
00407  * \param extension_state is the numerical state delivered by ast_extension_state
00408  *
00409  * \return the state of an extension as string
00410  */
00411 const char *ast_extension_state2str(int extension_state);
00412 
00413 /*!
00414  * \brief Registers a state change callback with destructor.
00415  * \since 1.8.9
00416  * \since 10.1.0
00417  *
00418  * \param context which context to look in
00419  * \param exten which extension to get state
00420  * \param change_cb callback to call if state changed
00421  * \param destroy_cb callback to call when registration destroyed.
00422  * \param data to pass to callback
00423  *
00424  * \note The change_cb is called if the state of an extension is changed.
00425  *
00426  * \note The destroy_cb is called when the registration is
00427  * deleted so the registerer can release any associated
00428  * resources.
00429  *
00430  * \retval -1 on failure
00431  * \retval ID on success
00432  */
00433 int ast_extension_state_add_destroy(const char *context, const char *exten,
00434    ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data);
00435 
00436 /*!
00437  * \brief Registers a state change callback
00438  *
00439  * \param context which context to look in
00440  * \param exten which extension to get state
00441  * \param change_cb callback to call if state changed
00442  * \param data to pass to callback
00443  *
00444  * \note The change_cb is called if the state of an extension is changed.
00445  *
00446  * \retval -1 on failure
00447  * \retval ID on success
00448  */
00449 int ast_extension_state_add(const char *context, const char *exten,
00450    ast_state_cb_type change_cb, void *data);
00451 
00452 /*!
00453  * \brief Deletes a registered state change callback by ID
00454  *
00455  * \param id of the registered state callback to delete
00456  * \param change_cb callback to call if state changed (Used if id == 0 (global))
00457  *
00458  * \retval 0 success
00459  * \retval -1 failure
00460  */
00461 int ast_extension_state_del(int id, ast_state_cb_type change_cb);
00462 
00463 /*!
00464  * \brief If an extension hint exists, return non-zero
00465  *
00466  * \param hint buffer for hint
00467  * \param hintsize size of hint buffer, in bytes
00468  * \param name buffer for name portion of hint
00469  * \param namesize size of name buffer
00470  * \param c Channel from which to return the hint.  This is only important when the hint or name contains an expression to be expanded.
00471  * \param context which context to look in
00472  * \param exten which extension to search for
00473  *
00474  * \return If an extension within the given context with the priority PRIORITY_HINT
00475  * is found, a non zero value will be returned.
00476  * Otherwise, 0 is returned.
00477  */
00478 int ast_get_hint(char *hint, int hintsize, char *name, int namesize,
00479    struct ast_channel *c, const char *context, const char *exten);
00480 
00481 /*!
00482  * \brief If an extension hint exists, return non-zero
00483  *
00484  * \param hint buffer for hint
00485  * \param hintsize Maximum size of hint buffer (<0 to prevent growth, >0 to limit growth to that number of bytes, or 0 for unlimited growth)
00486  * \param name buffer for name portion of hint
00487  * \param namesize Maximum size of name buffer (<0 to prevent growth, >0 to limit growth to that number of bytes, or 0 for unlimited growth)
00488  * \param c Channel from which to return the hint.  This is only important when the hint or name contains an expression to be expanded.
00489  * \param context which context to look in
00490  * \param exten which extension to search for
00491  *
00492  * \return If an extension within the given context with the priority PRIORITY_HINT
00493  * is found, a non zero value will be returned.
00494  * Otherwise, 0 is returned.
00495  */
00496 int ast_str_get_hint(struct ast_str **hint, ssize_t hintsize, struct ast_str **name, ssize_t namesize,
00497    struct ast_channel *c, const char *context, const char *exten);
00498 
00499 /*!
00500  * \brief Determine whether an extension exists
00501  *
00502  * \param c this is not important
00503  * \param context which context to look in
00504  * \param exten which extension to search for
00505  * \param priority priority of the action within the extension
00506  * \param callerid callerid to search for
00507  *
00508  * \note It is possible for autoservice to be started and stopped on c during this
00509  * function call, it is important that c is not locked prior to calling this. Otherwise
00510  * a deadlock may occur
00511  *
00512  * \return If an extension within the given context(or callerid) with the given priority
00513  *         is found a non zero value will be returned. Otherwise, 0 is returned.
00514  */
00515 int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten,
00516    int priority, const char *callerid);
00517 
00518 /*!
00519  * \brief Find the priority of an extension that has the specified label
00520  *
00521  * \param c this is not important
00522  * \param context which context to look in
00523  * \param exten which extension to search for
00524  * \param label label of the action within the extension to match to priority
00525  * \param callerid callerid to search for
00526  *
00527  * \note It is possible for autoservice to be started and stopped on c during this
00528  * function call, it is important that c is not locked prior to calling this. Otherwise
00529  * a deadlock may occur
00530  *
00531  * \retval the priority which matches the given label in the extension
00532  * \retval -1 if not found.
00533  */
00534 int ast_findlabel_extension(struct ast_channel *c, const char *context,
00535    const char *exten, const char *label, const char *callerid);
00536 
00537 /*!
00538  * \brief Find the priority of an extension that has the specified label
00539  *
00540  * \note It is possible for autoservice to be started and stopped on c during this
00541  * function call, it is important that c is not locked prior to calling this. Otherwise
00542  * a deadlock may occur
00543  *
00544  * \note This function is the same as ast_findlabel_extension, except that it accepts
00545  * a pointer to an ast_context structure to specify the context instead of the
00546  * name of the context. Otherwise, the functions behave the same.
00547  */
00548 int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *con,
00549    const char *exten, const char *label, const char *callerid);
00550 
00551 /*!
00552  * \brief Looks for a valid matching extension
00553  *
00554  * \param c not really important
00555  * \param context context to serach within
00556  * \param exten extension to check
00557  * \param priority priority of extension path
00558  * \param callerid callerid of extension being searched for
00559  *
00560  * \note It is possible for autoservice to be started and stopped on c during this
00561  * function call, it is important that c is not locked prior to calling this. Otherwise
00562  * a deadlock may occur
00563  *
00564  * \return If "exten" *could be* a valid extension in this context with or without
00565  * some more digits, return non-zero.  Basically, when this returns 0, no matter
00566  * what you add to exten, it's not going to be a valid extension anymore
00567  */
00568 int ast_canmatch_extension(struct ast_channel *c, const char *context,
00569    const char *exten, int priority, const char *callerid);
00570 
00571 /*!
00572  * \brief Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
00573  *
00574  * \param c not really important XXX
00575  * \param context context to serach within
00576  * \param exten extension to check
00577  * \param priority priority of extension path
00578  * \param callerid callerid of extension being searched for
00579  *
00580  * \note It is possible for autoservice to be started and stopped on c during this
00581  * function call, it is important that c is not locked prior to calling this. Otherwise
00582  * a deadlock may occur
00583  *
00584  * \return If "exten" *could match* a valid extension in this context with
00585  * some more digits, return non-zero.  Does NOT return non-zero if this is
00586  * an exact-match only.  Basically, when this returns 0, no matter
00587  * what you add to exten, it's not going to be a valid extension anymore
00588  */
00589 int ast_matchmore_extension(struct ast_channel *c, const char *context,
00590    const char *exten, int priority, const char *callerid);
00591 
00592 /*!
00593  * \brief Determine if a given extension matches a given pattern (in NXX format)
00594  *
00595  * \param pattern pattern to match
00596  * \param extension extension to check against the pattern.
00597  *
00598  * Checks whether or not the given extension matches the given pattern.
00599  *
00600  * \retval 1 on match
00601  * \retval 0 on failure
00602  */
00603 int ast_extension_match(const char *pattern, const char *extension);
00604 
00605 int ast_extension_close(const char *pattern, const char *data, int needmore);
00606 
00607 /*!
00608  * \brief Determine if one extension should match before another
00609  *
00610  * \param a extension to compare with b
00611  * \param b extension to compare with a
00612  *
00613  * Checks whether or extension a should match before extension b
00614  *
00615  * \retval 0 if the two extensions have equal matching priority
00616  * \retval 1 on a > b
00617  * \retval -1 on a < b
00618  */
00619 int ast_extension_cmp(const char *a, const char *b);
00620 
00621 /*!
00622  * \brief Launch a new extension (i.e. new stack)
00623  *
00624  * \param c not important
00625  * \param context which context to generate the extension within
00626  * \param exten new extension to add
00627  * \param priority priority of new extension
00628  * \param callerid callerid of extension
00629  * \param found
00630  * \param combined_find_spawn
00631  *
00632  * This adds a new extension to the asterisk extension list.
00633  *
00634  * \note It is possible for autoservice to be started and stopped on c during this
00635  * function call, it is important that c is not locked prior to calling this. Otherwise
00636  * a deadlock may occur
00637  *
00638  * \retval 0 on success
00639  * \retval -1 on failure.
00640  */
00641 int ast_spawn_extension(struct ast_channel *c, const char *context,
00642       const char *exten, int priority, const char *callerid, int *found, int combined_find_spawn);
00643 
00644 /*!
00645  * \brief Add a context include
00646  *
00647  * \param context context to add include to
00648  * \param include new include to add
00649  * \param registrar who's registering it
00650  *
00651  * Adds an include taking a char * string as the context parameter
00652  *
00653  * \retval 0 on success
00654  * \retval -1 on error
00655 */
00656 int ast_context_add_include(const char *context, const char *include,
00657    const char *registrar);
00658 
00659 /*!
00660  * \brief Add a context include
00661  *
00662  * \param con context to add the include to
00663  * \param include include to add
00664  * \param registrar who registered the context
00665  *
00666  * Adds an include taking a struct ast_context as the first parameter
00667  *
00668  * \retval 0 on success
00669  * \retval -1 on failure
00670  */
00671 int ast_context_add_include2(struct ast_context *con, const char *include,
00672    const char *registrar);
00673 
00674 /*!
00675  * \brief Remove a context include
00676  *
00677  * \note See ast_context_add_include for information on arguments
00678  *
00679  * \retval 0 on success
00680  * \retval -1 on failure
00681  */
00682 int ast_context_remove_include(const char *context, const char *include,
00683    const char *registrar);
00684 
00685 /*!
00686  * \brief Removes an include by an ast_context structure
00687  *
00688  * \note See ast_context_add_include2 for information on arguments
00689  *
00690  * \retval 0 on success
00691  * \retval -1 on success
00692  */
00693 int ast_context_remove_include2(struct ast_context *con, const char *include,
00694    const char *registrar);
00695 
00696 /*!
00697  * \brief Verifies includes in an ast_contect structure
00698  *
00699  * \param con context in which to verify the includes
00700  *
00701  * \retval 0 if no problems found
00702  * \retval -1 if there were any missing context
00703  */
00704 int ast_context_verify_includes(struct ast_context *con);
00705 
00706 /*!
00707  * \brief Add a switch
00708  *
00709  * \param context context to which to add the switch
00710  * \param sw switch to add
00711  * \param data data to pass to switch
00712  * \param eval whether to evaluate variables when running switch
00713  * \param registrar whoever registered the switch
00714  *
00715  * This function registers a switch with the asterisk switch architecture
00716  *
00717  * \retval 0 on success
00718  * \retval -1 on failure
00719  */
00720 int ast_context_add_switch(const char *context, const char *sw, const char *data,
00721    int eval, const char *registrar);
00722 
00723 /*!
00724  * \brief Adds a switch (first param is a ast_context)
00725  *
00726  * \note See ast_context_add_switch() for argument information, with the exception of
00727  *       the first argument. In this case, it's a pointer to an ast_context structure
00728  *       as opposed to the name.
00729  */
00730 int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data,
00731    int eval, const char *registrar);
00732 
00733 /*!
00734  * \brief Remove a switch
00735  *
00736  * Removes a switch with the given parameters
00737  *
00738  * \retval 0 on success
00739  * \retval -1 on failure
00740  */
00741 int ast_context_remove_switch(const char *context, const char *sw,
00742    const char *data, const char *registrar);
00743 
00744 int ast_context_remove_switch2(struct ast_context *con, const char *sw,
00745    const char *data, const char *registrar);
00746 
00747 /*!
00748  * \brief Simply remove extension from context
00749  *
00750  * \param context context to remove extension from
00751  * \param extension which extension to remove
00752  * \param priority priority of extension to remove (0 to remove all)
00753  * \param registrar registrar of the extension
00754  *
00755  * This function removes an extension from a given context.
00756  *
00757  * \retval 0 on success
00758  * \retval -1 on failure
00759  *
00760  * @{
00761  */
00762 int ast_context_remove_extension(const char *context, const char *extension, int priority,
00763    const char *registrar);
00764 
00765 int ast_context_remove_extension2(struct ast_context *con, const char *extension,
00766    int priority, const char *registrar, int already_locked);
00767 
00768 int ast_context_remove_extension_callerid(const char *context, const char *extension,
00769    int priority, const char *callerid, int matchcid, const char *registrar);
00770 
00771 int ast_context_remove_extension_callerid2(struct ast_context *con, const char *extension,
00772    int priority, const char *callerid, int matchcid, const char *registrar,
00773    int already_locked);
00774 /*! @} */
00775 
00776 /*!
00777  * \brief Add an ignorepat
00778  *
00779  * \param context which context to add the ignorpattern to
00780  * \param ignorepat ignorepattern to set up for the extension
00781  * \param registrar registrar of the ignore pattern
00782  *
00783  * Adds an ignore pattern to a particular context.
00784  *
00785  * \retval 0 on success
00786  * \retval -1 on failure
00787  */
00788 int ast_context_add_ignorepat(const char *context, const char *ignorepat, const char *registrar);
00789 
00790 int ast_context_add_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
00791 
00792 /*
00793  * \brief Remove an ignorepat
00794  *
00795  * \param context context from which to remove the pattern
00796  * \param ignorepat the pattern to remove
00797  * \param registrar the registrar of the ignore pattern
00798  *
00799  * This removes the given ignorepattern
00800  *
00801  * \retval 0 on success
00802  * \retval -1 on failure
00803  */
00804 int ast_context_remove_ignorepat(const char *context, const char *ignorepat, const char *registrar);
00805 
00806 int ast_context_remove_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
00807 
00808 /*!
00809  * \brief Checks to see if a number should be ignored
00810  *
00811  * \param context context to search within
00812  * \param pattern to check whether it should be ignored or not
00813  *
00814  * Check if a number should be ignored with respect to dialtone cancellation.
00815  *
00816  * \retval 0 if the pattern should not be ignored
00817  * \retval non-zero if the pattern should be ignored
00818  */
00819 int ast_ignore_pattern(const char *context, const char *pattern);
00820 
00821 /* Locking functions for outer modules, especially for completion functions */
00822 
00823 /*!
00824  * \brief Write locks the context list
00825  *
00826  * \retval 0 on success
00827  * \retval -1 on error
00828  */
00829 int ast_wrlock_contexts(void);
00830 
00831 /*!
00832  * \brief Read locks the context list
00833  *
00834  * \retval 0 on success
00835  * \retval -1 on error
00836  */
00837 int ast_rdlock_contexts(void);
00838 
00839 /*!
00840  * \brief Unlocks contexts
00841  *
00842  * \retval 0 on success
00843  * \retval -1 on failure
00844  */
00845 int ast_unlock_contexts(void);
00846 
00847 /*!
00848  * \brief Write locks a given context
00849  *
00850  * \param con context to lock
00851  *
00852  * \retval 0 on success
00853  * \retval -1 on failure
00854  */
00855 int ast_wrlock_context(struct ast_context *con);
00856 
00857 /*!
00858  * \brief Read locks a given context
00859  *
00860  * \param con context to lock
00861  *
00862  * \retval 0 on success
00863  * \retval -1 on failure
00864  */
00865 int ast_rdlock_context(struct ast_context *con);
00866 
00867 /*!
00868  * \retval Unlocks the given context
00869  *
00870  * \param con context to unlock
00871  *
00872  * \retval 0 on success
00873  * \retval -1 on failure
00874  */
00875 int ast_unlock_context(struct ast_context *con);
00876 
00877 /*!
00878  * \brief locks the macrolock in the given given context
00879  *
00880  * \param macrocontext name of the macro-context to lock
00881  *
00882  * Locks the given macro-context to ensure only one thread (call) can execute it at a time
00883  *
00884  * \retval 0 on success
00885  * \retval -1 on failure
00886  */
00887 int ast_context_lockmacro(const char *macrocontext);
00888 
00889 /*!
00890  * \brief Unlocks the macrolock in the given context
00891  *
00892  * \param macrocontext name of the macro-context to unlock
00893  *
00894  * Unlocks the given macro-context so that another thread (call) can execute it
00895  *
00896  * \retval 0 on success
00897  * \retval -1 on failure
00898  */
00899 int ast_context_unlockmacro(const char *macrocontext);
00900 
00901 /*!
00902  * \brief Set the channel to next execute the specified dialplan location.
00903  * \see ast_async_parseable_goto, ast_async_goto_if_exists
00904  *
00905  * \note Do _NOT_ hold any channel locks when calling this function.
00906  */
00907 int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
00908 
00909 /*!
00910  * \brief Set the channel to next execute the specified dialplan location.
00911  */
00912 int ast_async_goto_by_name(const char *chan, const char *context, const char *exten, int priority);
00913 
00914 /*! Synchronously or asynchronously make an outbound call and send it to a
00915    particular extension */
00916 int ast_pbx_outgoing_exten(const char *type, format_t 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);
00917 
00918 /*! Synchronously or asynchronously make an outbound call and send it to a
00919    particular application with given extension */
00920 int ast_pbx_outgoing_app(const char *type, format_t 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);
00921 
00922 /*!
00923  * \brief Evaluate a condition
00924  *
00925  * \retval 0 if the condition is NULL or of zero length
00926  * \retval int If the string is an integer, the integer representation of
00927  *             the integer is returned
00928  * \retval 1 Any other non-empty string
00929  */
00930 int pbx_checkcondition(const char *condition);
00931 
00932 /*! @name
00933  * Functions for returning values from structures */
00934 /*! @{ */
00935 const char *ast_get_context_name(struct ast_context *con);
00936 const char *ast_get_extension_name(struct ast_exten *exten);
00937 struct ast_context *ast_get_extension_context(struct ast_exten *exten);
00938 const char *ast_get_include_name(struct ast_include *include);
00939 const char *ast_get_ignorepat_name(struct ast_ignorepat *ip);
00940 const char *ast_get_switch_name(struct ast_sw *sw);
00941 const char *ast_get_switch_data(struct ast_sw *sw);
00942 int ast_get_switch_eval(struct ast_sw *sw);
00943 
00944 /*! @} */
00945 
00946 /*! @name Other Extension stuff */
00947 /*! @{ */
00948 int ast_get_extension_priority(struct ast_exten *exten);
00949 int ast_get_extension_matchcid(struct ast_exten *e);
00950 const char *ast_get_extension_cidmatch(struct ast_exten *e);
00951 const char *ast_get_extension_app(struct ast_exten *e);
00952 const char *ast_get_extension_label(struct ast_exten *e);
00953 void *ast_get_extension_app_data(struct ast_exten *e);
00954 /*! @} */
00955 
00956 /*! @name Registrar info functions ... */
00957 /*! @{ */
00958 const char *ast_get_context_registrar(struct ast_context *c);
00959 const char *ast_get_extension_registrar(struct ast_exten *e);
00960 const char *ast_get_include_registrar(struct ast_include *i);
00961 const char *ast_get_ignorepat_registrar(struct ast_ignorepat *ip);
00962 const char *ast_get_switch_registrar(struct ast_sw *sw);
00963 /*! @} */
00964 
00965 /*! @name Walking functions ... */
00966 /*! @{ */
00967 struct ast_context *ast_walk_contexts(struct ast_context *con);
00968 struct ast_exten *ast_walk_context_extensions(struct ast_context *con,
00969    struct ast_exten *priority);
00970 struct ast_exten *ast_walk_extension_priorities(struct ast_exten *exten,
00971    struct ast_exten *priority);
00972 struct ast_include *ast_walk_context_includes(struct ast_context *con,
00973    struct ast_include *inc);
00974 struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con,
00975    struct ast_ignorepat *ip);
00976 struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw);
00977 /*! @} */
00978 
00979 /*!
00980  * \brief Create a human-readable string, specifying all variables and their corresponding values.
00981  * \param chan Channel from which to read variables
00982  * \param buf Dynamic string in which to place the result (should be allocated with ast_str_create).
00983  * \see ast_str_create
00984  * \note Will lock the channel.
00985  */
00986 int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **buf);
00987 
00988 /*!
00989  * \brief Return a pointer to the value of the corresponding channel variable.
00990  * \note Will lock the channel.
00991  *
00992  * \note This function will return a pointer to the buffer inside the channel
00993  * variable.  This value should only be accessed with the channel locked.  If
00994  * the value needs to be kept around, it should be done by using the following
00995  * thread-safe code:
00996  * \code
00997  *    const char *var;
00998  *
00999  *    ast_channel_lock(chan);
01000  *    if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
01001  *       var = ast_strdupa(var);
01002  *    }
01003  *    ast_channel_unlock(chan);
01004  * \endcode
01005  */
01006 const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
01007 
01008 /*!
01009  * \brief Add a variable to the channel variable stack, without removing any previously set value.
01010  * \note Will lock the channel.
01011  */
01012 void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, const char *value);
01013 
01014 /*!
01015  * \brief Add a variable to the channel variable stack, removing the most recently set value for the same name.
01016  * \note Will lock the channel.  May also be used to set a channel dialplan function to a particular value.
01017  * \see ast_func_write
01018  * \return -1 if the dialplan function fails to be set
01019  * \version 1.8 changed the function to return an error code
01020  */
01021 int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
01022 
01023 /*!
01024  * \brief Retrieve the value of a builtin variable or variable from the channel variable stack.
01025  * \note Will lock the channel.
01026  */
01027 void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp);
01028 void pbx_builtin_clear_globals(void);
01029 
01030 /*!
01031  * \brief Parse and set a single channel variable, where the name and value are separated with an '=' character.
01032  * \note Will lock the channel.
01033  */
01034 int pbx_builtin_setvar(struct ast_channel *chan, const char *data);
01035 
01036 /*!
01037  * \brief Parse and set multiple channel variables, where the pairs are separated by the ',' character, and name and value are separated with an '=' character.
01038  * \note Will lock the channel.
01039  */
01040 int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *data);
01041 
01042 int pbx_builtin_raise_exception(struct ast_channel *chan, const char *data);
01043 
01044 /*! @name Substitution routines, using static string buffers
01045  * @{ */
01046 void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count);
01047 void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count);
01048 void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used);
01049 /*! @} */
01050 /*! @} */
01051 
01052 /*! @name Substitution routines, using dynamic string buffers */
01053 
01054 /*!
01055  * \param buf Result will be placed in this buffer.
01056  * \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
01057  * \param chan Channel variables from which to extract values, and channel to pass to any dialplan functions.
01058  * \param headp If no channel is specified, a channel list from which to extract variable values
01059  * \param var Variable name to retrieve.
01060  */
01061 const char *ast_str_retrieve_variable(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, struct varshead *headp, const char *var);
01062 
01063 /*!
01064  * \param buf Result will be placed in this buffer.
01065  * \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
01066  * \param chan Channel variables from which to extract values, and channel to pass to any dialplan functions.
01067  * \param templ Variable template to expand.
01068  */
01069 void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ);
01070 
01071 /*!
01072  * \param buf Result will be placed in this buffer.
01073  * \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
01074  * \param headp If no channel is specified, a channel list from which to extract variable values
01075  * \param templ Variable template to expand.
01076  */
01077 void ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen, struct varshead *headp, const char *templ);
01078 
01079 /*!
01080  * \param buf Result will be placed in this buffer.
01081  * \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
01082  * \param c Channel variables from which to extract values, and channel to pass to any dialplan functions.
01083  * \param headp If no channel is specified, a channel list from which to extract variable values
01084  * \param templ Variable template to expand.
01085  * \param used Number of bytes read from the template.
01086  */
01087 void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, struct ast_channel *c, struct varshead *headp, const char *templ, size_t *used);
01088 /*! @} */
01089 
01090 int ast_extension_patmatch(const char *pattern, const char *data);
01091 
01092 /*! Set "autofallthrough" flag, if newval is <0, does not actually set.  If
01093   set to 1, sets to auto fall through.  If newval set to 0, sets to no auto
01094   fall through (reads extension instead).  Returns previous value. */
01095 int pbx_set_autofallthrough(int newval);
01096 
01097 /*! Set "extenpatternmatchnew" flag, if newval is <0, does not actually set.  If
01098   set to 1, sets to use the new Trie-based pattern matcher.  If newval set to 0, sets to use
01099   the old linear-search algorithm.  Returns previous value. */
01100 int pbx_set_extenpatternmatchnew(int newval);
01101 
01102 /*! Set "overrideswitch" field.  If set and of nonzero length, all contexts
01103  * will be tried directly through the named switch prior to any other
01104  * matching within that context.
01105  * \since 1.6.1
01106  */
01107 void pbx_set_overrideswitch(const char *newval);
01108 
01109 /*!
01110  * \note This function will handle locking the channel as needed.
01111  */
01112 int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);
01113 
01114 /*!
01115  * \note This function will handle locking the channel as needed.
01116  */
01117 int ast_parseable_goto(struct ast_channel *chan, const char *goto_string);
01118 
01119 /*!
01120  * \note This function will handle locking the channel as needed.
01121  */
01122 int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string);
01123 
01124 /*!
01125  * \note This function will handle locking the channel as needed.
01126  */
01127 int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
01128 
01129 /*!
01130  * \note This function will handle locking the channel as needed.
01131  */
01132 int ast_async_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);
01133 
01134 struct ast_custom_function* ast_custom_function_find(const char *name);
01135 
01136 /*!
01137  * \brief Unregister a custom function
01138  */
01139 int ast_custom_function_unregister(struct ast_custom_function *acf);
01140 
01141 /*!
01142  * \brief Register a custom function
01143  */
01144 #define ast_custom_function_register(acf) __ast_custom_function_register(acf, ast_module_info->self)
01145 
01146 /*!
01147  * \brief Register a custom function
01148  */
01149 int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod);
01150 
01151 /*!
01152  * \brief Retrieve the number of active calls
01153  */
01154 int ast_active_calls(void);
01155 
01156 /*!
01157  * \brief Retrieve the total number of calls processed through the PBX since last restart
01158  */
01159 int ast_processed_calls(void);
01160 
01161 /*!
01162  * \brief executes a read operation on a function
01163  *
01164  * \param chan Channel to execute on
01165  * \param function Data containing the function call string (will be modified)
01166  * \param workspace A pointer to safe memory to use for a return value
01167  * \param len the number of bytes in workspace
01168  *
01169  * This application executes a function in read mode on a given channel.
01170  *
01171  * \retval 0 success
01172  * \retval non-zero failure
01173  */
01174 int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len);
01175 
01176 /*!
01177  * \brief executes a read operation on a function
01178  *
01179  * \param chan Channel to execute on
01180  * \param function Data containing the function call string (will be modified)
01181  * \param str A dynamic string buffer into which to place the result.
01182  * \param maxlen <0 if the dynamic buffer should not grow; >0 if the dynamic buffer should be limited to that number of bytes; 0 if the dynamic buffer has no upper limit
01183  *
01184  * This application executes a function in read mode on a given channel.
01185  *
01186  * \retval 0 success
01187  * \retval non-zero failure
01188  */
01189 int ast_func_read2(struct ast_channel *chan, const char *function, struct ast_str **str, ssize_t maxlen);
01190 
01191 /*!
01192  * \brief executes a write operation on a function
01193  *
01194  * \param chan Channel to execute on
01195  * \param function Data containing the function call string (will be modified)
01196  * \param value A value parameter to pass for writing
01197  *
01198  * This application executes a function in write mode on a given channel.
01199  *
01200  * \retval 0 success
01201  * \retval non-zero failure
01202  */
01203 int ast_func_write(struct ast_channel *chan, const char *function, const char *value);
01204 
01205 /*!
01206  * \details
01207  * When looking up extensions, we can have different requests
01208  * identified by the 'action' argument, as follows.
01209  *
01210  * \note that the coding is such that the low 4 bits are the
01211  * third argument to extension_match_core.
01212  */
01213 enum ext_match_t {
01214    E_MATCHMORE =  0x00, /* extension can match but only with more 'digits' */
01215    E_CANMATCH =   0x01, /* extension can match with or without more 'digits' */
01216    E_MATCH =   0x02, /* extension is an exact match */
01217    E_MATCH_MASK = 0x03, /* mask for the argument to extension_match_core() */
01218    E_SPAWN =   0x12, /* want to spawn an extension. Requires exact match */
01219    E_FINDLABEL =  0x22  /* returns the priority for a given label. Requires exact match */
01220 };
01221 
01222 #define STATUS_NO_CONTEXT  1
01223 #define STATUS_NO_EXTENSION   2
01224 #define STATUS_NO_PRIORITY 3
01225 #define STATUS_NO_LABEL    4
01226 #define STATUS_SUCCESS     5
01227 #define AST_PBX_MAX_STACK  128
01228 
01229 /* request and result for pbx_find_extension */
01230 struct pbx_find_info {
01231 #if 0
01232    const char *context;
01233    const char *exten;
01234    int priority;
01235 #endif
01236 
01237    char *incstack[AST_PBX_MAX_STACK];      /* filled during the search */
01238    int stacklen;                   /* modified during the search */
01239    int status;                     /* set on return */
01240    struct ast_switch *swo;         /* set on return */
01241    const char *data;               /* set on return */
01242    const char *foundcontext;       /* set on return */
01243 };
01244 
01245 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
01246                             struct ast_context *bypass, struct pbx_find_info *q,
01247                             const char *context, const char *exten, int priority,
01248                             const char *label, const char *callerid, enum ext_match_t action);
01249 
01250 /*! \brief hashtable functions for contexts */
01251 /*! @{ */
01252 int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
01253 unsigned int ast_hashtab_hash_contexts(const void *obj);
01254 /*! @} */
01255 
01256 /*!
01257  * \brief Command completion for the list of installed applications.
01258  *
01259  * This can be called from a CLI command completion function that wants to
01260  * complete from the list of available applications.
01261  */
01262 char *ast_complete_applications(const char *line, const char *word, int state);
01263 
01264 #if defined(__cplusplus) || defined(c_plusplus)
01265 }
01266 #endif
01267 
01268 #endif /* _ASTERISK_PBX_H */

Generated on Mon Mar 19 11:30:28 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7