summaryrefslogtreecommitdiff
path: root/include/asterisk/channel.h
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2008-11-04 23:23:39 +0000
committerSean Bright <sean@malleable.com>2008-11-04 23:23:39 +0000
commit086a52d9d1cc00b28b3146376935b6c64b258cb0 (patch)
treecc80e865574edf9aedd9298a568c9b998b118374 /include/asterisk/channel.h
parentbdb21bef93ce295c7593165a435fede4cf7034e4 (diff)
Introduce a new API call ast_channel_search_locked, which iterates through the
channel list calling a caller-defined callback. The callback returns non-zero if a match is found. This should speed up some of the code that I committed earlier today in chan_sip (which is also updated by this commit). Reviewed by russellb and kpfleming via ReviewBoard: http://reviewboard.digium.com/r/28/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@154429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/channel.h')
-rw-r--r--include/asterisk/channel.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 549b6883f..2f212cf65 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -1177,6 +1177,17 @@ struct ast_channel *ast_get_channel_by_exten_locked(const char *exten, const cha
struct ast_channel *ast_walk_channel_by_exten_locked(const struct ast_channel *chan, const char *exten,
const char *context);
+/*! \brief Search for a channel based on the passed channel matching callback
+ * Search for a channel based on the specified is_match callback, and return the
+ * first channel that we match. When returned, the channel will be locked. Note
+ * that the is_match callback is called with the passed channel locked, and should
+ * return 0 if there is no match, and non-zero if there is.
+ * \param is_match callback executed on each channel until non-zero is returned, or we
+ * run out of channels to search.
+ * \return Returns the matched channel, or NULL if no channel was matched.
+ */
+struct ast_channel *ast_channel_search_locked(int (*is_match)(struct ast_channel *));
+
/*! ! \brief Waits for a digit
* \param c channel to wait for a digit on
* \param ms how many milliseconds to wait