📄 pbx.h
字号:
* \param priority priority of extension path * \param callerid callerid of extension being searched for * * \return If "exten" *could be* a valid extension in this context with or without * 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, const char *context, const char *exten, int priority, const char *callerid);/*! * \brief Looks to see if adding anything to this extension might match something. (exists ^ canmatch) * * \param c not really important XXX * \param context context to serach within * \param exten extension to check * \param priority priority of extension path * \param callerid callerid of extension being searched for * * \return If "exten" *could match* a valid extension in this context with * some more digits, return non-zero. Does NOT return non-zero if this is * 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, const char *context, const char *exten, int priority, const char *callerid);/*! * \brief Determine if a given extension matches a given pattern (in NXX format) * * \param pattern pattern to match * \param extension extension to check against the pattern. * * Checks whether or not the given extension matches the given pattern. * * \retval 1 on match * \retval 0 on failure */int ast_extension_match(const char *pattern, const char *extension);int ast_extension_close(const char *pattern, const char *data, int needmore);/*! * \brief Launch a new extension (i.e. new stack) * * \param c not important * \param context which context to generate the extension within * \param exten new extension to add * \param priority priority of new extension * \param callerid callerid of extension * * This adds a new extension to the asterisk extension list. * * \retval 0 on success * \retval -1 on failure. */int ast_spawn_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);/*! * \brief Add a context include * * \param context context to add include to * \param include new include to add * \param registrar who's registering it * * Adds an include taking a char * string as the context parameter * * \retval 0 on success * \retval -1 on error*/int ast_context_add_include(const char *context, const char *include, const char *registrar);/*! * \brief Add a context include * * \param con context to add the include to * \param include include to add * \param registrar who registered the context * * Adds an include taking a struct ast_context as the first parameter * * \retval 0 on success * \retval -1 on failure */int ast_context_add_include2(struct ast_context *con, const char *include, const char *registrar);/*! * \brief Remove a context include * * \note See ast_context_add_include for information on arguments * * \retval 0 on success * \retval -1 on failure */int ast_context_remove_include(const char *context, const char *include, const char *registrar);/*! * \brief Removes an include by an ast_context structure * * \note See ast_context_add_include2 for information on arguments * * \retval 0 on success * \retval -1 on success */int ast_context_remove_include2(struct ast_context *con, const char *include, const char *registrar);/*! * \brief Verifies includes in an ast_contect structure * * \param con context in which to verify the includes * * \retval 0 if no problems found * \retval -1 if there were any missing context */int ast_context_verify_includes(struct ast_context *con); /*! * \brief Add a switch * * \param context context to which to add the switch * \param sw switch to add * \param data data to pass to switch * \param eval whether to evaluate variables when running switch * \param registrar whoever registered the switch * * This function registers a switch with the asterisk switch architecture * * \retval 0 on success * \retval -1 on failure */int ast_context_add_switch(const char *context, const char *sw, const char *data, int eval, const char *registrar);/*! * \brief Adds a switch (first param is a ast_context) * * \note See ast_context_add_switch() for argument information, with the exception of * the first argument. In this case, it's a pointer to an ast_context structure * as opposed to the name. */int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data, int eval, const char *registrar);/*! * \brief Remove a switch * * Removes a switch with the given parameters * * \retval 0 on success * \retval -1 on failure */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);/*! * \brief Simply remove extension from context * * \param context context to remove extension from * \param extension which extension to remove * \param priority priority of extension to remove * \param registrar registrar of the extension * * This function removes an extension from a given context. * * \retval 0 on success * \retval -1 on failure */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);/*! * \brief Add an ignorepat * * \param context which context to add the ignorpattern to * \param ignorepat ignorepattern to set up for the extension * \param registrar registrar of the ignore pattern * * Adds an ignore pattern to a particular context. * * \retval 0 on success * \retval -1 on failure */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);/* * \brief Remove an ignorepat * * \param context context from which to remove the pattern * \param ignorepat the pattern to remove * \param registrar the registrar of the ignore pattern * * This removes the given ignorepattern * * \retval 0 on success * \retval -1 on failure */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);/*! * \brief Checks to see if a number should be ignored * * \param context context to search within * \param pattern to check whether it should be ignored or not * * Check if a number should be ignored with respect to dialtone cancellation. * * \retval 0 if the pattern should not be ignored * \retval non-zero if the pattern should be ignored */int ast_ignore_pattern(const char *context, const char *pattern);/* Locking functions for outer modules, especially for completion functions *//*! * \brief Locks the context list * * \retval 0 on success * \retval -1 on error */int ast_lock_contexts(void);/*! * \brief Unlocks contexts * * \retval 0 on success * \retval -1 on failure */int ast_unlock_contexts(void);/*! * \brief Locks a given context * * \param con context to lock * * \retval 0 on success * \retval -1 on failure */int ast_lock_context(struct ast_context *con);/*! * \retval Unlocks the given context * * \param con context to unlock * * \retval 0 on success * \retval -1 on failure */int ast_unlock_context(struct ast_context *con);/*! * \brief locks the macrolock in the given given context * * \param macrocontext name of the macro-context to lock * * Locks the given macro-context to ensure only one thread (call) can execute it at a time * * \retval 0 on success * \retval -1 on failure */int ast_context_lockmacro(const char *macrocontext);/*! * \brief Unlocks the macrolock in the given context * * \param macrocontext name of the macro-context to unlock * * Unlocks the given macro-context so that another thread (call) can execute it * * \retval 0 on success * \retval -1 on failure */int ast_context_unlockmacro(const char *macrocontext);int ast_async_goto(struct ast_channel *chan, const char *context, const 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(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);/*! Synchronously or asynchronously make an outbound call and send it to a particular application with given extension */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);/*! * \brief Evaluate a condition * * \retval 0 if the condition is NULL or of zero length * \retval int If the string is an integer, the integer representation of * the integer is returned * \retval 1 Any other non-empty string */int pbx_checkcondition(const char *condition);/* Functions for returning values from structures */const char *ast_get_context_name(struct ast_context *con);const char *ast_get_extension_name(struct ast_exten *exten);struct ast_context *ast_get_extension_context(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);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 ... */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);struct ast_exten *ast_walk_context_extensions(struct ast_context *con, struct ast_exten *priority);struct ast_exten *ast_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority);struct ast_include *ast_walk_context_includes(struct ast_context *con, struct ast_include *inc);struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip);struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw);int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size);const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, const char *value);void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp);void pbx_builtin_clear_globals(void);int pbx_builtin_setvar(struct ast_channel *chan, void *data);void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count);void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count);int ast_extension_patmatch(const char *pattern, const char *data);/*! Set "autofallthrough" flag, if newval is <0, does not acutally set. If set to 1, sets to auto fall through. If newval set to 0, sets to no auto fall through (reads extension instead). Returns previous value. */int pbx_set_autofallthrough(int newval);int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);/* I can find neither parsable nor parseable at dictionary.com, but google gives me 169000 hits for parseable and only 49,800 for parsable */int ast_parseable_goto(struct ast_channel *chan, const char *goto_string);int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);int ast_async_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);struct ast_custom_function* ast_custom_function_find(const char *name);/*! * \brief Unregister a custom function */int ast_custom_function_unregister(struct ast_custom_function *acf);/*! * \brief Reigster a custom function */int ast_custom_function_register(struct ast_custom_function *acf);/*! * \brief Retrieve the number of active calls */int ast_active_calls(void); /*! * \brief executes a read operation on a function * * \param chan Channel to execute on * \param function Data containing the function call string (will be modified) * \param workspace A pointer to safe memory to use for a return value * \param len the number of bytes in workspace * * This application executes a function in read mode on a given channel. * * \return zero on success, non-zero on failure */int ast_func_read(struct ast_channel *chan, char *function, char *workspace, size_t len);/*! * \brief executes a write operation on a function * * \param chan Channel to execute on * \param function Data containing the function call string (will be modified) * \param value A value parameter to pass for writing * * This application executes a function in write mode on a given channel. * * \return zero on success, non-zero on failure */int ast_func_write(struct ast_channel *chan, char *function, const char *value);void ast_hint_state_changed(const char *device);#if defined(__cplusplus) || defined(c_plusplus)}#endif#endif /* _ASTERISK_PBX_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -