34 #include <uuid/uuid.h> 63 .
type =
"AudioSocket",
64 .description =
"AudioSocket Channel Driver",
92 if (instance ==
NULL || instance->
svc < 1) {
115 if (instance !=
NULL && instance->
svc > 0) {
116 close(instance->
svc);
160 ast_log(
LOG_ERROR,
"Destination is required for the 'AudioSocket' channel\n");
167 ast_log(
LOG_ERROR,
"Destination is required for the 'AudioSocket' channel\n");
180 if (uuid_parse(
args.idStr, uu)) {
197 ast_log(
LOG_ERROR,
"Codec '%s' not found for AudioSocket connection to '%s'\n",
198 opt_args[OPT_ARG_AUDIOSOCKET_CODEC],
args.destination);
204 ast_log(
LOG_ERROR,
"No codec available for AudioSocket connection to '%s'\n",
228 requestor, 0,
"AudioSocket/%s-%s",
args.destination,
args.idStr);
258 if (instance !=
NULL) {
300 .requires =
"res_audiosocket",
Main Channel structure associated with a channel.
static struct ast_channel * audiosocket_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)
Function called when we should prepare to call the unicast destination.
Asterisk main include file. File version handling, generic pbx functions.
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)
#define ast_test_flag(p, flag)
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)
static const struct ast_app_option audiosocket_options[128]
static int audiosocket_call(struct ast_channel *ast, const char *dest, int timeout)
Function called when we should actually call the destination.
Structure to pass both assignedid values to channel drivers.
static struct ast_channel_tech audiosocket_channel_tech
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 ...
Socket address structure.
const int ast_audiosocket_connect(const char *server, struct ast_channel *chan)
Send the initial message to an AudioSocket server.
#define ast_strlen_zero(foo)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
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)
const int ast_audiosocket_init(const int svc, const char *id)
Send the initial message to an AudioSocket server.
General Asterisk PBX channel definitions.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
Access Control of various sorts.
#define ao2_ref(o, delta)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
#define ast_strdupa(s)
duplicate a string in memory from the stack
AudioSocket support functions.
int ast_sockaddr_resolve_first_af(struct ast_sockaddr *addr, const char *name, int flag, int family)
Return the first entry from ast_sockaddr_resolve filtered by address family.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
static int audiosocket_write(struct ast_channel *ast, struct ast_frame *f)
Function called when we should write a frame to the channel.
#define AST_CAUSE_FAILURE
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
const int ast_audiosocket_send_frame(const int svc, const struct ast_frame *f)
Send an Asterisk audio frame to an AudioSocket server.
struct audiosocket_instance audiosocket_instance
struct ast_format_cap * capabilities
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
#define ast_calloc(num, len)
A wrapper for calloc()
static int audiosocket_hangup(struct ast_channel *ast)
Function called when we should hang the channel up.
Module has failed to load, may be in an inconsistent state.
Structure used to handle boolean flags.
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
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...
struct ast_frame * ast_audiosocket_receive_frame(const int svc)
Receive an Asterisk frame from an AudioSocket server.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
static struct ast_frame * audiosocket_read(struct ast_channel *ast)
Function called when we should read a frame from the channel.
static int load_module(void)
Function called when our module is loaded.
static int unload_module(void)
Function called when our module is unloaded.
#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)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define AST_APP_ARG(name)
Define an application argument.