Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
conf_chan_record.c File Reference

ConfBridge recorder channel driver. More...

#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/format_cache.h"
#include "include/confbridge.h"
Include dependency graph for conf_chan_record.c:

Go to the source code of this file.


struct ast_channel_techconf_record_get_tech (void)
 Get ConfBridge record channel technology struct. More...
static int rec_call (struct ast_channel *chan, const char *addr, int timeout)
static struct ast_framerec_read (struct ast_channel *ast)
static struct ast_channelrec_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
static int rec_write (struct ast_channel *ast, struct ast_frame *f)


static unsigned int name_sequence = 0
static struct ast_channel_tech record_tech

Detailed Description

ConfBridge recorder channel driver.

Richard Mudgett

See Also:

Definition in file conf_chan_record.c.

Function Documentation

◆ conf_record_get_tech()

struct ast_channel_tech* conf_record_get_tech ( void  )

Get ConfBridge record channel technology struct.

ConfBridge record channel technology.

Definition at line 102 of file conf_chan_record.c.

References record_tech.

Referenced by load_module(), rec_request(), and unload_module().

103 {
104  return &record_tech;
105 }
static struct ast_channel_tech record_tech

◆ rec_call()

static int rec_call ( struct ast_channel chan,
const char *  addr,
int  timeout 

Definition at line 41 of file conf_chan_record.c.

42 {
43  /* Make sure anyone calling ast_call() for this channel driver is going to fail. */
44  return -1;
45 }

◆ rec_read()

static struct ast_frame* rec_read ( struct ast_channel ast)

Definition at line 47 of file conf_chan_record.c.

References ast_null_frame.

48 {
49  return &ast_null_frame;
50 }
struct ast_frame ast_null_frame
Definition: main/frame.c:79

◆ rec_request()

static struct ast_channel* rec_request ( const char *  type,
struct ast_format_cap cap,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
const char *  data,
int *  cause 

Definition at line 57 of file conf_chan_record.c.

References ao2_cleanup, ast_atomic_fetchadd_int(), ast_channel_add_bridge_role(), ast_channel_alloc, ast_channel_nativeformats_set(), ast_channel_release(), ast_channel_set_rawreadformat(), ast_channel_set_rawwriteformat(), ast_channel_set_readformat(), ast_channel_set_writeformat(), ast_channel_tech_set(), ast_channel_unlock, ast_format_cap_alloc, ast_format_cap_append_by_type(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_slin, AST_MEDIA_TYPE_AUDIO, AST_STATE_UP, conf_record_get_tech(), ast_channel::data, name_sequence, NULL, and RAII_VAR.

58 {
59  struct ast_channel *chan;
60  const char *conf_name = data;
61  RAII_VAR(struct ast_format_cap *, capabilities, NULL, ao2_cleanup);
62  int generated_seqno = ast_atomic_fetchadd_int((int *) &name_sequence, +1);
65  if (!capabilities) {
66  return NULL;
67  }
71  "CBRec/%s-%08x",
72  conf_name, (unsigned) generated_seqno);
73  if (!chan) {
74  return NULL;
75  }
76  if (ast_channel_add_bridge_role(chan, "recorder")) {
77  ast_channel_unlock(chan);
78  ast_channel_release(chan);
79  return NULL;
80  }
83  ast_channel_nativeformats_set(chan, capabilities);
88  ast_channel_unlock(chan);
89  return chan;
90 }
Main Channel structure associated with a channel.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
Definition: channel.c:1584
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
int ast_format_cap_append_by_type(struct ast_format_cap *cap, enum ast_media_type type)
Add all codecs Asterisk knows about for a specific type to the capabilities structure.
Definition: format_cap.c:216
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
Definition: bridge_roles.c:317
#define NULL
Definition: resample.c:96
const char * data
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
Definition: lock.h:755
struct ast_channel_tech * conf_record_get_tech(void)
Get ConfBridge record channel technology struct.
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
static unsigned int name_sequence
#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
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
#define ast_format_cap_alloc(flags)
Definition: format_cap.h:52
Format capabilities structure, holds formats + preference order + etc.
Definition: format_cap.c:54
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Definition: channel.h:1259
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
Definition: format_cache.c:41

◆ rec_write()

static int rec_write ( struct ast_channel ast,
struct ast_frame f 

Definition at line 52 of file conf_chan_record.c.

53 {
54  return 0;
55 }

Variable Documentation

◆ name_sequence

unsigned int name_sequence = 0

Definition at line 39 of file conf_chan_record.c.

Referenced by rec_request().

◆ record_tech

struct ast_channel_tech record_tech

Definition at line 92 of file conf_chan_record.c.

Referenced by conf_record_get_tech().