📄 pbx.h
字号:
int ast_extension_state_add(const char *context, const char *exten, ast_state_cb_type callback, void *data);/*! * \brief Deletes a registered state change callback by ID * * \param id of the callback to delete * \param callback callback * * Removes the callback from list of callbacks * * \retval 0 success * \retval -1 failure */int ast_extension_state_del(int id, ast_state_cb_type callback);/*! * \brief If an extension hint exists, return non-zero * * \param hint buffer for hint * \param maxlen size of hint buffer * \param name buffer for name portion of hint * \param maxnamelen size of name buffer * \param c this is not important * \param context which context to look in * \param exten which extension to search for * * \return If an extension within the given context with the priority PRIORITY_HINT * is found a non zero value will be returned. * Otherwise, 0 is returned. */int ast_get_hint(char *hint, int maxlen, char *name, int maxnamelen, struct ast_channel *c, const char *context, const char *exten);/*! * \brief Determine whether an extension exists * * \param c this is not important * \param context which context to look in * \param exten which extension to search for * \param priority priority of the action within the extension * \param callerid callerid to search for * * \note It is possible for autoservice to be started and stopped on c during this * function call, it is important that c is not locked prior to calling this. Otherwise * a deadlock may occur * * \return If an extension within the given context(or callerid) with the given priority * is found a non zero value will be returned. Otherwise, 0 is returned. */int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid);/*! * \brief Find the priority of an extension that has the specified label * * \param c this is not important * \param context which context to look in * \param exten which extension to search for * \param label label of the action within the extension to match to priority * \param callerid callerid to search for * * \note It is possible for autoservice to be started and stopped on c during this * function call, it is important that c is not locked prior to calling this. Otherwise * a deadlock may occur * * \retval the priority which matches the given label in the extension * \retval -1 if not found. */int ast_findlabel_extension(struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid);/*! * \brief Find the priority of an extension that has the specified label * * \note It is possible for autoservice to be started and stopped on c during this * function call, it is important that c is not locked prior to calling this. Otherwise * a deadlock may occur * * \note This function is the same as ast_findlabel_extension, except that it accepts * a pointer to an ast_context structure to specify the context instead of the * name of the context. Otherwise, the functions behave the same. */int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *con, const char *exten, const char *label, const char *callerid);/*! * \brief Looks for a valid matching extension * * \param c not really important * \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 * * \note It is possible for autoservice to be started and stopped on c during this * function call, it is important that c is not locked prior to calling this. Otherwise * a deadlock may occur * * \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 * * \note It is possible for autoservice to be started and stopped on c during this * function call, it is important that c is not locked prior to calling this. Otherwise * a deadlock may occur * * \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 Determine if one extension should match before another * * \param a extension to compare with b * \param b extension to compare with a * * Checks whether or extension a should match before extension b * * \retval 0 if the two extensions have equal matching priority * \retval 1 on a > b * \retval -1 on a < b */int ast_extension_cmp(const char *a, const char *b);/*! * \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 * \param found * \param combined_find_spawn * * This adds a new extension to the asterisk extension list. * * \note It is possible for autoservice to be started and stopped on c during this * function call, it is important that c is not locked prior to calling this. Otherwise * a deadlock may occur * * \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, int *found, int combined_find_spawn);/*! * \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 (0 to remove all) * \param callerid NULL to remove all; non-NULL to match a single record per priority * \param matchcid non-zero to match callerid element (if non-NULL); 0 to match default case * \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, int already_locked);int ast_context_remove_extension_callerid(const char *context, const char *extension, int priority, const char *callerid, int matchcid, const char *registrar);int ast_context_remove_extension_callerid2(struct ast_context *con, const char *extension, int priority, const char *callerid, int matchcid, const char *registrar, int already_locked);/*! * \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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -