From 880fb1ece980e7adc228407758bf5a3553da1dd1 Mon Sep 17 00:00:00 2001 From: Russell Bryant <russell@russellbryant.com> Date: Wed, 28 Nov 2007 00:24:19 +0000 Subject: [PATCH] Merged revisions 89893 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89893 | russell | 2007-11-27 18:20:13 -0600 (Tue, 27 Nov 2007) | 4 lines - update documentation for some of the goto functions to note that they handle locking the channel as needed - update ast_explicit_goto() to lock the channel as needed ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89915 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/pbx.h | 21 ++++++++++++++++++++- main/pbx.c | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index bc1155b8a6..3568e7ec4b 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -846,10 +846,29 @@ int pbx_set_autofallthrough(int newval); set to 1, sets to use the new Trie-based pattern matcher. If newval set to 0, sets to use the old linear-search algorithm. Returns previous value. */ int pbx_set_extenpatternmatchnew(int newval); + +/*! + * \note This function will handle locking the channel as needed. + */ int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority); -/* I can find neither parsable nor parseable at dictionary.com, but google gives me 169000 hits for parseable and only 49,800 for parsable */ + +/*! + * \note I can find neither parsable nor parseable at dictionary.com, + * but google gives me 169000 hits for parseable and only 49,800 + * for parsable + * + * \note This function will handle locking the channel as needed. + */ int ast_parseable_goto(struct ast_channel *chan, const char *goto_string); + +/*! + * \note This function will handle locking the channel as needed. + */ int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority); + +/*! + * \note This function will handle locking the channel as needed. + */ int ast_async_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority); struct ast_custom_function* ast_custom_function_find(const char *name); diff --git a/main/pbx.c b/main/pbx.c index 857b7e2189..e3498c5adf 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -5719,6 +5719,8 @@ int ast_explicit_goto(struct ast_channel *chan, const char *context, const char if (!chan) return -1; + ast_channel_lock(chan); + if (!ast_strlen_zero(context)) ast_copy_string(chan->context, context, sizeof(chan->context)); if (!ast_strlen_zero(exten)) @@ -5730,6 +5732,8 @@ int ast_explicit_goto(struct ast_channel *chan, const char *context, const char chan->priority--; } + ast_channel_unlock(chan); + return 0; } -- GitLab