diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 85aa5a06b5..5b6fce258c 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -203,6 +203,15 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch */ SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, char *varname); +/*! + * Start iterating over the entries in the channel variable list. + * @param channel the channel to intterate the variales for + * @param pool The pool to allocate the switch_hash_index_t iterator. If this + * pool is NULL, then an internal, non-thread-safe iterator is used. + * @remark Use switch_hash_next and switch_hash_this with this function to iterate all the channel variables + */ +SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel, switch_memory_pool_t *pool); + /*! \brief Assign a caller extension to a given channel \param channel channel to assign extension to diff --git a/src/switch_channel.c b/src/switch_channel.c index fb54780c12..9bb29b1f01 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -292,6 +292,11 @@ SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, ch return switch_core_hash_find(channel->variables, varname); } +SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel, switch_memory_pool_t *pool) +{ + return switch_hash_first(pool, channel->variables); +} + SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, void *private_info) { assert(channel != NULL);