Create an API for adding an optional time unit onto the ends of time periods.

Two examples of its use are included, and the usage could be expanded in some
cases into certain configuration options where time periods are specified.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@224225 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-10-15 22:33:30 +00:00
parent a39f3a7521
commit c74a2d0b45
3 changed files with 79 additions and 8 deletions

View File

@@ -84,6 +84,12 @@ struct ast_ivr_menu {
static struct ast_ivr_option __options_##holder[] = foo;\
static struct ast_ivr_menu holder = { title, flags, __options_##holder }
typedef enum {
TIMELEN_HOURS,
TIMELEN_MINUTES,
TIMELEN_SECONDS,
TIMELEN_MILLISECONDS,
} ast_timelen;
/*! \brief Runs an IVR menu
\return returns 0 on successful completion, -1 on hangup, or -2 on user error in menu */
@@ -580,6 +586,17 @@ int ast_safe_fork(int stop_reaper);
*/
void ast_safe_fork_cleanup(void);
/*!
* \brief Common routine to parse time lengths, with optional time unit specifier
* \param[in] timestr String to parse
* \param[in] defunit Default unit type
* \param[out] result Resulting value, specified in milliseconds
* \retval 0 Success
* \retval -1 Failure
* \since 1.8
*/
int ast_app_parse_timelen(const char *timestr, int *result, ast_timelen defunit);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif