122static const char *
const app =
"Signal";
123static const char *
const app2 =
"WaitForSignal";
180 if (!strcmp(s->
name, sname)) {
183 ast_debug(1,
"Removed signal '%s'\n", sname);
196 if (!strcasecmp(s->
name, sname)) {
197 ast_debug(1,
"Using existing signal item '%s'\n", sname);
206 ast_debug(1,
"Created new signal item '%s'\n", sname);
212 ast_debug(1,
"Signal '%s' doesn't exist, and not creating it\n", sname);
222 int ms, remaining_time, res = 1, goaway = 0;
223 struct timeval start;
226 remaining_time = timeout;
235 while (timeout == 0 || remaining_time > 0) {
250 ast_debug(1,
"Alert pipe has data for us\n");
254 ast_debug(1,
"Alert pipe does not have data for us\n");
257 if (ms && (ofd < 0)) {
277 int save_errno =
errno;
299 int save_errno =
errno;
339 int r = 0, timeoutms = 0;
364 if (sscanf(
args.sigtimeout,
"%30lg", &timeout) != 1 || timeout < 0) {
367 timeoutms = timeout * 1000;
372 ast_debug(1,
"Waiting for signal '%s' for %d ms\n",
args.signame, timeoutms);
374 ast_debug(1,
"Waiting for signal '%s', indefinitely\n",
args.signame);
void ast_alertpipe_close(int alert_pipe[2])
Close an alert pipe.
ssize_t ast_alertpipe_write(int alert_pipe[2])
Write an event to an alert pipe.
int ast_alertpipe_init(int alert_pipe[2])
Initialize an alert pipe.
ast_alert_status_t ast_alertpipe_read(int alert_pipe[2])
Read an event from an alert pipe.
static int wait_for_signal_or_hangup(struct ast_channel *chan, char *signame, int timeout)
static int signal_exec(struct ast_channel *chan, const char *data)
static int waitsignal_exec(struct ast_channel *chan, const char *data)
static struct signalitem * alloc_signal(const char *sname)
static const char *const app
static const char *const app2
static int dealloc_signal(struct signalitem *s)
static int send_signal(char *signame, char *payload)
static struct signalitem * get_signal(char *sname, int addnew)
static int remove_signal(char *sname)
static int load_module(void)
static int unload_module(void)
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Channel Signaling Applications")
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Generic File Format Support. Should be included by clients of the file handling routines....
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_RWLIST_INSERT_HEAD
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
Asterisk module definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Main Channel structure associated with a channel.
Data structure associated with a single frame of data.
Structure for mutex and tracking information.
struct signalitem::@62 entry
char name[AST_MAX_CONTEXT]
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().