37 #include <sys/socket.h>
39 #include <arpa/inet.h>
41 #include <sys/ioctl.h>
51 static const char tdesc[] =
"Network Broadcast Sound Driver";
57 static const char type[] =
"NBS";
102 if (nbs_connect(p->
nbs)) {
116 nbs_delstream(p->
nbs);
129 if ((opts = strchr(stream,
':'))) {
137 if (strchr(opts,
'm'))
138 flags |= NBS_FLAG_MUTE;
139 if (strchr(opts,
'o'))
140 flags |= NBS_FLAG_OVERSPEAK;
141 if (strchr(opts,
'e'))
142 flags |= NBS_FLAG_EMERGENCY;
143 if (strchr(opts,
'O'))
144 flags |= NBS_FLAG_OVERRIDE;
146 flags = NBS_FLAG_OVERSPEAK;
149 p->
nbs = nbs_newstream(
"asterisk", stream, flags);
151 ast_log(
LOG_WARNING,
"Unable to allocate new NBS stream '%s' with flags %d\n", stream, flags);
156 nbs_setbitrate(p->
nbs, 8000);
157 nbs_setchannels(p->
nbs, 1);
158 nbs_setblocksize(p->
nbs, 640);
159 nbs_setblocking(p->
nbs, 0);
226 tmp =
ast_channel_alloc(1, state, 0, 0,
"",
"s", context, linkedid, 0,
"NBS/%s", i->
stream);
union ast_frame_subclass subclass
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
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 format_t prefformat
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 with payload.
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
char context[AST_MAX_CONTEXT]
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
Configuration File Parser.
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 ...
static struct nbs_pvt * nbs_alloc(void *data)
static struct ast_channel * nbs_new(struct nbs_pvt *i, int state, const char *linkedid)
const ast_string_field linkedid
#define ast_module_user_remove(user)
static struct ast_frame * nbs_xread(struct ast_channel *ast)
struct ast_channel * ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const char *linkedid, const int amaflag, const char *name_fmt,...)
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define AST_MAX_EXTENSION
static char language[MAX_LANGUAGE]
#define ast_module_user_add(chan)
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
char * ast_getformatname(format_t format)
Get the name of a format.
static int nbs_xwrite(struct ast_channel *ast, struct ast_frame *frame)
enum ast_channel_state _state
const ast_string_field name
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...
static int nbs_call(struct ast_channel *ast, char *dest, int timeout)
static const char tdesc[]
struct ast_module_user * u
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
static char context[AST_MAX_EXTENSION]
#define AST_FORMAT_SLINEAR
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Data structure associated with a single frame of data.
static int load_module(void)
enum ast_frame_type frametype
static struct ast_channel * nbs_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static snd_pcm_format_t format
union ast_frame::@172 data
struct ast_channel_tech * tech
char exten[AST_MAX_EXTENSION]
struct ast_channel * owner
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
static void nbs_destroy(struct nbs_pvt *p)