diff options
author | Mark Murawki <markm@intellasoft.net> | 2012-04-03 19:31:25 +0000 |
---|---|---|
committer | Mark Murawki <markm@intellasoft.net> | 2012-04-03 19:31:25 +0000 |
commit | e4252eac1010af969007afb525871242855d39e7 (patch) | |
tree | 27f4bcb1ede2c708c34454ba98e5880a7df836a5 /include | |
parent | 9cc6f2c59e41c0d5fa34f03950131a4eb81cc7ab (diff) |
Allow the Hangup manager action to match channels by regex
* Hangup now can take a regular expression as the Channel option. If you want
to hangup multiple channels, use /regex/ as the Channel option. Existing
behavior to hanging up a single channel is unchanged, but if you pass a regex,
the manager will send you a list of channels back that were hung up.
(closes issue ASTERISK-19575)
Reported by: Mark Murawski
Tested by: Mark Murawski
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361038 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/channel.h | 8 | ||||
-rw-r--r-- | include/asterisk/manager.h | 3 | ||||
-rw-r--r-- | include/asterisk/strings.h | 21 |
3 files changed, 29 insertions, 3 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 8e438bbd5..54faa1d51 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -1383,6 +1383,14 @@ int ast_check_hangup(struct ast_channel *chan); int ast_check_hangup_locked(struct ast_channel *chan); /*! + * \brief Lock the given channel, then request softhangup on the channel with the given causecode + * \param obj channel on which to hang up + * \param causecode cause code to use + * \return 0 + */ +int ast_channel_softhangup_withcause_locked(void *obj, int causecode); + +/*! * \brief Compare a offset with the settings of when to hang a channel up * \param chan channel on which to check for hang up * \param offset offset in seconds from current time diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h index 5ffe7fac1..65aa1fb28 100644 --- a/include/asterisk/manager.h +++ b/include/asterisk/manager.h @@ -261,6 +261,9 @@ struct ast_variable *astman_get_variables(const struct message *m); /*! \brief Send error in manager transaction */ void astman_send_error(struct mansession *s, const struct message *m, char *error); +/*! \brief Send error in manager transaction (with va_args support) */ +void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt, ...); + /*! \brief Send response in manager transaction */ void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg); diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 6764125d1..e3ff4c4fe 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -252,11 +252,26 @@ int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attri */ int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap) __attribute__((format(printf, 3, 0))); -/*! +/*! + \brief Given a string regex_string in the form of "/regex/", convert it into the form of "regex" + + This function will trim one leading / and one trailing / from a given input string + ast_str regex_pattern must be preallocated before calling this function + + \return 0 on success, non-zero on failure. + \return 1 if we only stripped a leading / + \return 2 if we only stripped a trailing / + \return 3 if we did not strip any / characters + \param regex_string the string containing /regex/ + \param regex_pattern the destination ast_str which will contain "regex" after execution +*/ +int ast_regex_string_to_regex_pattern(const char *regex_string, struct ast_str *regex_pattern); + +/*! * \brief Make sure something is true. * Determine if a string containing a boolean value is "true". - * This function checks to see whether a string passed to it is an indication of an "true" value. - * It checks to see if the string is "yes", "true", "y", "t", "on" or "1". + * This function checks to see whether a string passed to it is an indication of an "true" value. + * It checks to see if the string is "yes", "true", "y", "t", "on" or "1". * * \retval 0 if val is a NULL pointer. * \retval -1 if "true". |