From: David Vossel Date: Wed, 8 Jul 2009 21:35:12 +0000 (+0000) Subject: moving ast_devstate_to_extenstate to pbx.c from devicestate.c X-Git-Tag: 1.4.26-rc6~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e330f772c02da4beabdd6b9661ce6cf52585e3c;p=thirdparty%2Fasterisk.git moving ast_devstate_to_extenstate to pbx.c from devicestate.c ast_devstate_to_extenstate belongs in pbx.c. This change fixes a compile time error with chan_vpb as well. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@205409 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/devicestate.h b/include/asterisk/devicestate.h index e9f1c36f38..c1a5abcd8f 100644 --- a/include/asterisk/devicestate.h +++ b/include/asterisk/devicestate.h @@ -151,15 +151,6 @@ void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_dev */ enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg); -/*! - * \brief Map devstate to an extension state. - * - * \param[in] device state - * - * \return the extension state mapping. - */ -enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate); - /*! * \brief You shouldn't care about the contents of this struct * diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index 0b5adf79cd..16c02f7fb9 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -273,6 +273,14 @@ int ast_add_extension2(struct ast_context *con, int replace, const char *extensi int priority, const char *label, const char *callerid, const char *application, void *data, void (*datad)(void *), const char *registrar); +/*! + * \brief Map devstate to an extension state. + * + * \param[in] device state + * + * \return the extension state mapping. + */ +enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate); /*! * \brief Register an application. diff --git a/main/devicestate.c b/main/devicestate.c index 70b9793c5a..e1a52dd636 100644 --- a/main/devicestate.c +++ b/main/devicestate.c @@ -432,31 +432,6 @@ void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_dev } } -enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate) -{ - switch (devstate) { - case AST_DEVICE_ONHOLD: - return AST_EXTENSION_ONHOLD; - case AST_DEVICE_BUSY: - return AST_EXTENSION_BUSY; - case AST_DEVICE_UNAVAILABLE: - case AST_DEVICE_UNKNOWN: - case AST_DEVICE_INVALID: - return AST_EXTENSION_UNAVAILABLE; - case AST_DEVICE_RINGINUSE: - return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING); - case AST_DEVICE_RINGING: - return AST_EXTENSION_RINGING; - case AST_DEVICE_INUSE: - return AST_EXTENSION_INUSE; - case AST_DEVICE_NOT_INUSE: - return AST_EXTENSION_NOT_INUSE; - case AST_DEVICE_TOTAL: /* not a device state, included for completeness */ - break; - } - - return AST_EXTENSION_NOT_INUSE; -} enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg) { if (agg->all_free) diff --git a/main/pbx.c b/main/pbx.c index 8fe5887fe9..ff21f551e5 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1914,6 +1914,32 @@ static struct ast_exten *ast_hint_extension(struct ast_channel *c, const char *c return e; } +enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate) +{ + switch (devstate) { + case AST_DEVICE_ONHOLD: + return AST_EXTENSION_ONHOLD; + case AST_DEVICE_BUSY: + return AST_EXTENSION_BUSY; + case AST_DEVICE_UNAVAILABLE: + case AST_DEVICE_UNKNOWN: + case AST_DEVICE_INVALID: + return AST_EXTENSION_UNAVAILABLE; + case AST_DEVICE_RINGINUSE: + return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING); + case AST_DEVICE_RINGING: + return AST_EXTENSION_RINGING; + case AST_DEVICE_INUSE: + return AST_EXTENSION_INUSE; + case AST_DEVICE_NOT_INUSE: + return AST_EXTENSION_NOT_INUSE; + case AST_DEVICE_TOTAL: /* not a device state, included for completeness */ + break; + } + + return AST_EXTENSION_NOT_INUSE; +} + /*! \brief ast_extensions_state2: Check state of extension by using hints */ static int ast_extension_state2(struct ast_exten *e) {