Asterisk - The Open Source Telephony Project  GIT-master-b7027de
Macros | Functions
monitor.h File Reference

Channel monitoring. More...

#include "asterisk/channel.h"
#include "asterisk/optional_api.h"

Go to the source code of this file.

Macros

#define X_JOIN   4
 
#define X_REC_IN   1
 
#define X_REC_OUT   2
 

Functions

int ast_monitor_change_fname (struct ast_channel *chan, const char *fname_base, int need_lock)
 Change monitored filename of channel. More...
 
int ast_monitor_pause (struct ast_channel *chan)
 Pause monitoring of channel. More...
 
void ast_monitor_setjoinfiles (struct ast_channel *chan, int turnon)
 
int ast_monitor_start (struct ast_channel *chan, const char *format_spec, const char *fname_base, int need_lock, int stream_action, const char *beep_id)
 Start monitoring a channel. More...
 
int ast_monitor_stop (struct ast_channel *chan, int need_lock)
 Stop monitoring channel. More...
 
int ast_monitor_unpause (struct ast_channel *chan)
 Unpause monitoring of channel. More...
 

Detailed Description

Channel monitoring.

Definition in file monitor.h.

Macro Definition Documentation

◆ X_JOIN

#define X_JOIN   4

Definition at line 32 of file monitor.h.

Referenced by start_monitor_exec().

◆ X_REC_IN

#define X_REC_IN   1

◆ X_REC_OUT

#define X_REC_OUT   2

Function Documentation

◆ ast_monitor_change_fname()

int ast_monitor_change_fname ( struct ast_channel chan,
const char *  fname_base,
int  need_lock 
)

Change monitored filename of channel.

Parameters
chan
fname_basenew filename
need_lock
Return values
0on success.
-1on failure.
Note
We cannot just compare filenames, due to symlinks, relative paths, and other possible filesystem issues. We could use realpath(3), but its use is discouraged. However, if we try to create the same file from two different paths, the second will fail, and so we have our notification that the filenames point to the same path.

Remember, also, that we're using the basename of the file (i.e. the file without the format suffix), so it does not already exist and we aren't interfering with the recording itself.

Definition at line 590 of file res_monitor.c.

References ast_channel_monitor(), ast_channel_name(), ast_config_AST_MONITOR_DIR, ast_copy_string(), ast_debug, ast_log, ast_mkdir(), ast_strdupa, ast_strlen_zero, doexit, errno, ast_channel_monitor::filename_base, ast_channel_monitor::filename_changed, LOCK_IF_NEEDED, LOG_ERROR, LOG_WARNING, name, and UNLOCK_IF_NEEDED.

Referenced by change_monitor_action(), change_monitor_exec(), start_monitor_action(), and start_monitor_exec().

591 {
592  if (ast_strlen_zero(fname_base)) {
593  ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null\n", ast_channel_name(chan));
594  return -1;
595  }
596 
597  LOCK_IF_NEEDED(chan, need_lock);
598 
599  if (ast_channel_monitor(chan)) {
600  int directory = strchr(fname_base, '/') ? 1 : 0;
601  const char *absolute = *fname_base == '/' ? "" : ast_config_AST_MONITOR_DIR;
602  const char *absolute_suffix = *fname_base == '/' ? "" : "/";
603  char tmpstring[sizeof(ast_channel_monitor(chan)->filename_base)] = "";
604  int i, fd[2] = { -1, -1 }, doexit = 0;
605 
606  /* before continuing, see if we're trying to rename the file to itself... */
607  snprintf(tmpstring, sizeof(tmpstring), "%s%s%s", absolute, absolute_suffix, fname_base);
608 
609  /* try creating the directory just in case it doesn't exist */
610  if (directory) {
611  char *name = ast_strdupa(tmpstring);
612  ast_mkdir(dirname(name), 0777);
613  }
614 
615  /*!
616  * \note We cannot just compare filenames, due to symlinks, relative
617  * paths, and other possible filesystem issues. We could use
618  * realpath(3), but its use is discouraged. However, if we try to
619  * create the same file from two different paths, the second will
620  * fail, and so we have our notification that the filenames point to
621  * the same path.
622  *
623  * Remember, also, that we're using the basename of the file (i.e.
624  * the file without the format suffix), so it does not already exist
625  * and we aren't interfering with the recording itself.
626  */
627  ast_debug(2, "comparing tmpstring %s to filename_base %s\n", tmpstring, ast_channel_monitor(chan)->filename_base);
628 
629  if ((fd[0] = open(tmpstring, O_CREAT | O_WRONLY, 0644)) < 0 ||
630  (fd[1] = open(ast_channel_monitor(chan)->filename_base, O_CREAT | O_EXCL | O_WRONLY, 0644)) < 0) {
631  if (fd[0] < 0) {
632  ast_log(LOG_ERROR, "Unable to compare filenames: %s\n", strerror(errno));
633  } else {
634  ast_debug(2, "No need to rename monitor filename to itself\n");
635  }
636  doexit = 1;
637  }
638 
639  /* Cleanup temporary files */
640  for (i = 0; i < 2; i++) {
641  if (fd[i] >= 0) {
642  while (close(fd[i]) < 0 && errno == EINTR);
643  }
644  }
645  unlink(tmpstring);
646  /* if previous monitor file existed in a subdirectory, the directory will not be removed */
647  unlink(ast_channel_monitor(chan)->filename_base);
648 
649  if (doexit) {
650  UNLOCK_IF_NEEDED(chan, need_lock);
651  return 0;
652  }
653 
654  ast_copy_string(ast_channel_monitor(chan)->filename_base, tmpstring, sizeof(ast_channel_monitor(chan)->filename_base));
656  } else {
657  ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started\n", ast_channel_name(chan), fname_base);
658  }
659 
660  UNLOCK_IF_NEEDED(chan, need_lock);
661 
662  return 0;
663 }
#define UNLOCK_IF_NEEDED(lock, needed)
Definition: res_monitor.c:268
#define LOG_WARNING
Definition: logger.h:274
char filename_base[FILENAME_MAX]
Definition: channel.h:4201
#define LOCK_IF_NEEDED(lock, needed)
Definition: res_monitor.c:263
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:444
#define ast_log
Definition: astobj2.c:42
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
#define LOG_ERROR
Definition: logger.h:285
int errno
#define ast_strlen_zero(a)
Definition: muted.c:73
static const char name[]
Definition: cdr_mysql.c:74
const char * ast_config_AST_MONITOR_DIR
Definition: options.c:155
static int doexit
Definition: main/db.c:112
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan)
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
Definition: main/utils.c:2231

◆ ast_monitor_pause()

int ast_monitor_pause ( struct ast_channel chan)

Pause monitoring of channel.

Definition at line 559 of file res_monitor.c.

References AST_MONITOR_PAUSED, and ast_monitor_set_state().

Referenced by do_pause_or_unpause(), and pause_monitor_exec().

560 {
562 }
static int ast_monitor_set_state(struct ast_channel *chan, int state)
Change state of monitored channel.
Definition: res_monitor.c:282

◆ ast_monitor_setjoinfiles()

void ast_monitor_setjoinfiles ( struct ast_channel chan,
int  turnon 
)

Definition at line 926 of file res_monitor.c.

References ast_channel_monitor(), and ast_channel_monitor::joinfiles.

Referenced by start_automonitor(), start_monitor_action(), start_monitor_exec(), and try_calling().

927 {
928  if (ast_channel_monitor(chan))
929  ast_channel_monitor(chan)->joinfiles = turnon;
930 }
struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan)

◆ ast_monitor_start()

int ast_monitor_start ( struct ast_channel chan,
const char *  format_spec,
const char *  fname_base,
int  need_lock,
int  stream_action,
const char *  beep_id 
)

Start monitoring a channel.

Parameters
chanast_channel struct to record
format_specfile format to use for recording
fname_basefilename base to record to
need_lockwhether to lock the channel mutex
stream_actionwhether to record the input and/or output streams. X_REC_IN | X_REC_OUT is most often used Creates the file to record, if no format is specified it assumes WAV It also sets channel variable __MONITORED=yes
Return values
0on success
-1on failure

Definition at line 305 of file res_monitor.c.

References ao2_cleanup, ast_calloc, ast_channel_blob_create_from_cache(), ast_channel_insmpl_set(), ast_channel_monitor(), ast_channel_monitor_set(), ast_channel_monitor_start_type(), ast_channel_name(), ast_channel_outsmpl_set(), ast_channel_topic(), ast_channel_uniqueid(), ast_closestream(), ast_config_AST_MONITOR_DIR, ast_copy_string(), ast_debug, AST_FILE_MODE, ast_filedelete(), ast_fileexists(), ast_free, ast_log, ast_mkdir(), AST_MONITOR_RUNNING, ast_monitor_set_state(), ast_monitor_stop(), ast_mutex_lock, ast_mutex_unlock, ast_strdup, ast_strdupa, ast_strlen_zero, ast_writefile(), ast_channel_monitor::beep_id, ast_channel_monitor::filename_base, ast_channel_monitor::filename_changed, FILENAME_MAX, ast_channel_monitor::format, LOCK_IF_NEEDED, LOG_WARNING, monitor, monitorlock, name, NULL, pbx_builtin_setvar_helper(), RAII_VAR, ast_channel_monitor::read_filename, ast_channel_monitor::read_stream, seq, stasis_publish(), ast_channel_monitor::stop, UNLOCK_IF_NEEDED, ast_channel_monitor::write_filename, ast_channel_monitor::write_stream, X_REC_IN, and X_REC_OUT.

Referenced by start_automonitor(), start_monitor_action(), start_monitor_exec(), and try_calling().

308 {
309  int res = 0;
311 
312  LOCK_IF_NEEDED(chan, need_lock);
313 
314  if (!(ast_channel_monitor(chan))) {
316  char *channel_name, *p;
317 
318  /* Create monitoring directory if needed */
320 
321  if (!(monitor = ast_calloc(1, sizeof(*monitor)))) {
322  UNLOCK_IF_NEEDED(chan, need_lock);
323  return -1;
324  }
325 
326  if (!ast_strlen_zero(beep_id)) {
327  ast_copy_string(monitor->beep_id, beep_id, sizeof(monitor->beep_id));
328  }
329 
330  /* Determine file names */
331  if (!ast_strlen_zero(fname_base)) {
332  int directory = strchr(fname_base, '/') ? 1 : 0;
333  const char *absolute = *fname_base == '/' ? "" : ast_config_AST_MONITOR_DIR;
334  const char *absolute_suffix = *fname_base == '/' ? "" : "/";
335 
336  snprintf(monitor->read_filename, FILENAME_MAX, "%s%s%s-in",
337  absolute, absolute_suffix, fname_base);
338  snprintf(monitor->write_filename, FILENAME_MAX, "%s%s%s-out",
339  absolute, absolute_suffix, fname_base);
340  snprintf(monitor->filename_base, FILENAME_MAX, "%s%s%s",
341  absolute, absolute_suffix, fname_base);
342 
343  /* try creating the directory just in case it doesn't exist */
344  if (directory) {
345  char *name = ast_strdupa(monitor->filename_base);
346  ast_mkdir(dirname(name), 0777);
347  }
348  } else {
350  snprintf(monitor->read_filename, FILENAME_MAX, "%s/audio-in-%lu",
352  snprintf(monitor->write_filename, FILENAME_MAX, "%s/audio-out-%lu",
354  seq++;
356 
357  /* Replace all '/' chars from the channel name with '-' chars. */
358  channel_name = ast_strdupa(ast_channel_name(chan));
359  for (p = channel_name; (p = strchr(p, '/')); ) {
360  *p = '-';
361  }
362 
363  snprintf(monitor->filename_base, FILENAME_MAX, "%s/%d-%s",
364  ast_config_AST_MONITOR_DIR, (int)time(NULL), channel_name);
365  monitor->filename_changed = 1;
366  }
367 
368  monitor->stop = ast_monitor_stop;
369 
370  /* Determine file format */
371  if (!ast_strlen_zero(format_spec)) {
372  monitor->format = ast_strdup(format_spec);
373  } else {
374  monitor->format = ast_strdup("wav");
375  }
376 
377  /* open files */
378  if (stream_action & X_REC_IN) {
379  if (ast_fileexists(monitor->read_filename, NULL, NULL) > 0)
380  ast_filedelete(monitor->read_filename, NULL);
381  if (!(monitor->read_stream = ast_writefile(monitor->read_filename,
382  monitor->format, NULL,
383  O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
384  ast_log(LOG_WARNING, "Could not create file %s\n",
385  monitor->read_filename);
386  ast_free(monitor);
387  UNLOCK_IF_NEEDED(chan, need_lock);
388  return -1;
389  }
390  } else
391  monitor->read_stream = NULL;
392 
393  if (stream_action & X_REC_OUT) {
394  if (ast_fileexists(monitor->write_filename, NULL, NULL) > 0) {
396  }
397  if (!(monitor->write_stream = ast_writefile(monitor->write_filename,
398  monitor->format, NULL,
399  O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
400  ast_log(LOG_WARNING, "Could not create file %s\n",
401  monitor->write_filename);
402  if (monitor->read_stream) {
403  ast_closestream(monitor->read_stream);
404  }
405  ast_free(monitor);
406  UNLOCK_IF_NEEDED(chan, need_lock);
407  return -1;
408  }
409  } else
410  monitor->write_stream = NULL;
411 
412  ast_channel_insmpl_set(chan, 0);
413  ast_channel_outsmpl_set(chan, 0);
414  ast_channel_monitor_set(chan, monitor);
416  /* so we know this call has been monitored in case we need to bill for it or something */
417  pbx_builtin_setvar_helper(chan, "__MONITORED","true");
418 
421  NULL);
422  if (message) {
424  }
425  } else {
426  ast_debug(1,"Cannot start monitoring %s, already monitored\n", ast_channel_name(chan));
427  res = -1;
428  }
429 
430  UNLOCK_IF_NEEDED(chan, need_lock);
431 
432  return res;
433 }
#define FILENAME_MAX
#define X_REC_IN
Definition: monitor.h:30
char read_filename[FILENAME_MAX]
Definition: channel.h:4199
static int ast_monitor_set_state(struct ast_channel *chan, int state)
Change state of monitored channel.
Definition: res_monitor.c:282
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
int(* stop)(struct ast_channel *chan, int need_lock)
Definition: channel.h:4207
#define UNLOCK_IF_NEEDED(lock, needed)
Definition: res_monitor.c:268
#define LOG_WARNING
Definition: logger.h:274
static ast_mutex_t monitorlock
Definition: res_monitor.c:261
char filename_base[FILENAME_MAX]
Definition: channel.h:4201
#define LOCK_IF_NEEDED(lock, needed)
Definition: res_monitor.c:263
#define ast_mutex_lock(a)
Definition: lock.h:187
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
#define NULL
Definition: resample.c:96
struct stasis_message_type * ast_channel_monitor_start_type(void)
Message type for starting monitor on a channel.
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
Definition: file.c:1098
char write_filename[FILENAME_MAX]
Definition: channel.h:4200
#define AST_FILE_MODE
Definition: asterisk.h:32
#define X_REC_OUT
Definition: monitor.h:31
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:444
#define ast_log
Definition: astobj2.c:42
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
static unsigned int monitor
Definition: chan_phone.c:116
struct ast_filestream * ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts writing a file.
Definition: file.c:1361
struct ast_filestream * read_stream
Definition: channel.h:4197
#define ast_strlen_zero(a)
Definition: muted.c:73
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic&#39;s subscribers.
Definition: stasis.c:1511
static const char name[]
Definition: cdr_mysql.c:74
#define ast_free(a)
Definition: astmm.h:182
const char * ast_config_AST_MONITOR_DIR
Definition: options.c:155
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
struct ast_filestream * write_stream
Definition: channel.h:4198
int ast_closestream(struct ast_filestream *f)
Closes a stream.
Definition: file.c:1068
struct stasis_message * ast_channel_blob_create_from_cache(const char *uniqueid, struct stasis_message_type *type, struct ast_json *blob)
Create a ast_channel_blob message, pulling channel state from the cache.
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...
int AST_OPTIONAL_API_NAME() ast_monitor_stop(struct ast_channel *chan, int need_lock)
Stop monitoring channel.
Definition: res_monitor.c:461
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
const char * ast_channel_name(const struct ast_channel *chan)
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
Definition: file.c:1086
static unsigned long seq
Definition: res_monitor.c:273
struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan)
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
char beep_id[64]
Definition: channel.h:4202
void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)
#define ast_mutex_unlock(a)
Definition: lock.h:188
int ast_mkdir(const char *path, int mode)
Recursively create directory path.
Definition: main/utils.c:2231

◆ ast_monitor_stop()

int ast_monitor_stop ( struct ast_channel chan,
int  need_lock 
)

Stop monitoring channel.

Parameters
chan
need_lockStop the recording, close any open streams, mix in/out channels if required
Returns
Always 0

Definition at line 461 of file res_monitor.c.

References ao2_cleanup, ast_beep_stop(), ast_channel_blob_create_from_cache(), ast_channel_monitor(), ast_channel_monitor_set(), ast_channel_monitor_stop_type(), ast_channel_topic(), ast_channel_uniqueid(), ast_closestream(), ast_debug, ast_filedelete(), ast_fileexists(), ast_filerename(), ast_free, ast_log, ast_safe_system(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_strlen_zero, execute(), ast_channel_monitor::filename_base, format, ast_channel_monitor::format, get_soxmix_format(), LOCK_IF_NEEDED, LOG_WARNING, NULL, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), RAII_VAR, stasis_publish(), tmp(), UNLOCK_IF_NEEDED, and write_stream().

Referenced by ast_monitor_start(), stop_monitor_action(), and stop_monitor_exec().

462 {
463  int delfiles = 0;
465 
466  LOCK_IF_NEEDED(chan, need_lock);
467 
468  if (ast_channel_monitor(chan)) {
469  RAII_VAR(struct ast_str *, tmp, ast_str_create(1024), ast_free);
470 
471  if (ast_channel_monitor(chan)->read_stream) {
473  }
474  if (ast_channel_monitor(chan)->write_stream) {
476  }
477 
480  ast_str_set(&tmp, 0, "%s-in", ast_channel_monitor(chan)->filename_base);
481  if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {
483  }
485  } else {
486  ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->read_filename);
487  }
488 
490  ast_str_set(&tmp, 0, "%s-out", ast_channel_monitor(chan)->filename_base);
491  if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {
493  }
495  } else {
496  ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->write_filename);
497  }
498  }
499 
501  const char *format = !strcasecmp(ast_channel_monitor(chan)->format,"wav49") ? "WAV" : ast_channel_monitor(chan)->format;
502  char *fname_base = ast_channel_monitor(chan)->filename_base;
503  const char *execute, *execute_args;
504  /* at this point, fname_base really is the full path */
505 
506  /* Set the execute application */
507  execute = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC");
508  if (ast_strlen_zero(execute)) {
509 #ifdef HAVE_SOXMIX
510  execute = "nice -n 19 soxmix";
511 #else
512  execute = "nice -n 19 sox -m";
513 #endif
514  format = get_soxmix_format(format);
515  delfiles = 1;
516  }
517  execute_args = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC_ARGS");
518  if (ast_strlen_zero(execute_args)) {
519  execute_args = "";
520  }
521 
522  ast_str_set(&tmp, 0, delfiles ? "( " : "");
523  ast_str_append(&tmp, 0, "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",
524  execute, fname_base, format, fname_base, format, fname_base, format,execute_args);
525  if (delfiles) {
526  /* remove legs when done mixing */
527  ast_str_append(&tmp, 0, "& rm -f \"%s-\"* ) &", fname_base);
528  }
529  ast_debug(1,"monitor executing %s\n", ast_str_buffer(tmp));
530  if (ast_safe_system(ast_str_buffer(tmp)) == -1)
531  ast_log(LOG_WARNING, "Execute of %s failed.\n", ast_str_buffer(tmp));
532  }
533 
536  }
537 
538  ast_free(ast_channel_monitor(chan)->format);
541 
544  NULL);
545  if (message) {
547  }
548  pbx_builtin_setvar_helper(chan, "MONITORED", NULL);
549  }
550  pbx_builtin_setvar_helper(chan, "AUTO_MONITOR", NULL);
551 
552  UNLOCK_IF_NEEDED(chan, need_lock);
553 
554  return 0;
555 }
char read_filename[FILENAME_MAX]
Definition: channel.h:4199
static SQLHSTMT execute(struct odbc_obj *obj, void *data, int silent)
Common execution function for SQL queries.
Definition: func_odbc.c:454
#define UNLOCK_IF_NEEDED(lock, needed)
Definition: res_monitor.c:268
#define LOG_WARNING
Definition: logger.h:274
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
static int tmp()
Definition: bt_open.c:389
char filename_base[FILENAME_MAX]
Definition: channel.h:4201
static void write_stream(struct ogg_vorbis_desc *s, FILE *f)
Write out any pending encoded data.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
int AST_OPTIONAL_API_NAME() ast_beep_stop(struct ast_channel *chan, const char *beep_id)
#define LOCK_IF_NEEDED(lock, needed)
Definition: res_monitor.c:263
#define NULL
Definition: resample.c:96
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
Definition: file.c:1098
char write_filename[FILENAME_MAX]
Definition: channel.h:4200
static const char * get_soxmix_format(const char *format)
Get audio format.
Definition: res_monitor.c:442
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Definition: strings.h:1065
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:444
#define ast_log
Definition: astobj2.c:42
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
struct stasis_message_type * ast_channel_monitor_stop_type(void)
Message type for stopping monitor on a channel.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
int ast_safe_system(const char *s)
Safely spawn an OS shell command while closing file descriptors.
Definition: extconf.c:829
struct ast_filestream * read_stream
Definition: channel.h:4197
#define ast_strlen_zero(a)
Definition: muted.c:73
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic&#39;s subscribers.
Definition: stasis.c:1511
#define ast_free(a)
Definition: astmm.h:182
int ast_closestream(struct ast_filestream *f)
Closes a stream.
Definition: file.c:1068
struct stasis_message * ast_channel_blob_create_from_cache(const char *uniqueid, struct stasis_message_type *type, struct ast_json *blob)
Create a ast_channel_blob message, pulling channel state from the cache.
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...
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
Definition: file.c:1086
int ast_filerename(const char *oldname, const char *newname, const char *fmt)
Renames a file.
Definition: file.c:1103
struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan)
static snd_pcm_format_t format
Definition: chan_alsa.c:102
char beep_id[64]
Definition: channel.h:4202
#define ast_str_create(init_len)
Create a malloc&#39;ed dynamic length string.
Definition: strings.h:620
void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)

◆ ast_monitor_unpause()

int ast_monitor_unpause ( struct ast_channel chan)

Unpause monitoring of channel.

Definition at line 565 of file res_monitor.c.

References AST_MONITOR_RUNNING, and ast_monitor_set_state().

Referenced by do_pause_or_unpause(), and unpause_monitor_exec().

566 {
568 }
static int ast_monitor_set_state(struct ast_channel *chan, int state)
Change state of monitored channel.
Definition: res_monitor.c:282