From: Russell Bryant Date: Wed, 28 Nov 2007 00:20:13 +0000 (+0000) Subject: - update documentation for some of the goto functions to note that they X-Git-Tag: 1.4.16.1~97 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0cd120d47ef881901fcc01ebd2c6aa9ae4962c4;p=thirdparty%2Fasterisk.git - 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/branches/1.4@89893 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index 699aa50826..1e8bf56d69 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -804,10 +804,29 @@ int ast_extension_patmatch(const char *pattern, const char *data); set to 1, sets to auto fall through. If newval set to 0, sets to no auto fall through (reads extension instead). Returns previous value. */ int pbx_set_autofallthrough(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 025bcef21e..fc3ccb15ee 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -4581,6 +4581,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)) @@ -4592,6 +4594,8 @@ int ast_explicit_goto(struct ast_channel *chan, const char *context, const char chan->priority--; } + ast_channel_unlock(chan); + return 0; }