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
This commit is contained in:
Mark Murawki
2012-04-03 19:31:25 +00:00
parent 9cc6f2c59e
commit e4252eac10
7 changed files with 179 additions and 18 deletions

View File

@@ -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".