35 #include "asterisk/module.h"
78 char *buf,
size_t len)
130 struct timeval when = {0,};
144 res = sscanf(value,
"%30ld%30lf", &sec, &x);
145 if (res == 0 || sec < 0) {
148 }
else if (res == 1) {
150 }
else if (res == 2) {
152 when.tv_usec = x * 1000000;
162 ast_strftime(timestr,
sizeof(timestr),
"%Y-%m-%d %H:%M:%S.%3q %Z",
164 ast_verbose(
"Channel will hangup at %s.\n", timestr);
174 chan->
pbx->
rtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000;
182 chan->
pbx->
dtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000;
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
void ast_verbose(const char *fmt,...)
#define VERBOSITY_ATLEAST(level)
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
static int timeout_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
#define ast_verb(level,...)
static struct ast_custom_function timeout_function
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
General Asterisk PBX channel definitions.
Data structure associated with a custom dialplan function.
static int timeout_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Core PBX routines and definitions.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
static int unload_module(void)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
static int load_module(void)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct timeval whentohangup
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_custom_function_register(acf)
Register a custom function.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.