35 #include <sys/socket.h> 37 #include <arpa/inet.h> 39 #include <sys/ioctl.h> 50 static const char tdesc[] =
"Network Broadcast Sound Driver";
53 static const char type[] =
"NBS";
96 if (nbs_connect(p->
nbs)) {
110 nbs_delstream(p->
nbs);
123 if ((opts = strchr(stream,
':'))) {
131 if (strchr(opts,
'm'))
132 flags |= NBS_FLAG_MUTE;
133 if (strchr(opts,
'o'))
134 flags |= NBS_FLAG_OVERSPEAK;
135 if (strchr(opts,
'e'))
136 flags |= NBS_FLAG_EMERGENCY;
137 if (strchr(opts,
'O'))
138 flags |= NBS_FLAG_OVERRIDE;
140 flags = NBS_FLAG_OVERSPEAK;
143 p->
nbs = nbs_newstream(
"asterisk", stream, flags);
145 ast_log(
LOG_WARNING,
"Unable to allocate new NBS stream '%s' with flags %d\n", stream, flags);
150 nbs_setbitrate(p->
nbs, 8000);
151 nbs_setchannels(p->
nbs, 1);
152 nbs_setblocksize(p->
nbs, 640);
153 nbs_setblocking(p->
nbs, 0);
196 tmp =
ast_channel_alloc(1, state, 0, 0,
"",
"s",
context, assignedids, requestor, 0,
"NBS/%s", i->
stream);
211 ast_channel_language_set(tmp,
"");
Main Channel structure associated with a channel.
static int unload_module(void)
static struct ast_channel_tech nbs_tech
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
static int nbs_hangup(struct ast_channel *ast)
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
void * ast_channel_tech_pvt(const struct ast_channel *chan)
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
Structure to pass both assignedid values to channel drivers.
ast_channel_state
ast_channel states
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
#define ast_str_alloca(init_len)
AST_MODULE_INFO_STANDARD_DEPRECATED(ASTERISK_GPL_KEY, "Network Broadcast Sound Support")
#define ast_module_user_remove(user)
static struct ast_frame * nbs_xread(struct ast_channel *ast)
#define ast_strlen_zero(foo)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
static struct nbs_pvt * nbs_alloc(const char *data)
Configuration File Parser.
#define ast_debug(level,...)
Log a DEBUG message.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
General Asterisk PBX channel definitions.
void ast_channel_rings_set(struct ast_channel *chan, int value)
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
static struct ast_channel * nbs_new(struct nbs_pvt *i, int state, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
#define AST_MAX_EXTENSION
#define ao2_ref(o, delta)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
#define ast_module_user_add(chan)
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int nbs_xwrite(struct ast_channel *ast, struct ast_frame *frame)
struct ast_format_cap * capabilities
#define ast_channel_unlock(chan)
static const char tdesc[]
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
static int nbs_call(struct ast_channel *ast, const char *dest, int timeout)
Module has failed to load, may be in an inconsistent state.
struct ast_module_user * u
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_frame ast_null_frame
static char context[AST_MAX_EXTENSION]
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
static struct ast_channel * nbs_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)
Data structure associated with a single frame of data.
static int load_module(void)
union ast_frame::@263 data
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
Asterisk module definitions.
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
struct ast_channel * owner
static void nbs_destroy(struct nbs_pvt *p)