46#define AST_MODULE "app_audiosocket"
47#define AUDIOSOCKET_CONFIG "audiosocket.conf"
48#define MAX_WAIT_TIMEOUT_MSEC 2000
74static const char app[] =
"AudioSocket";
103 if (uuid_parse(
args.idStr, uu)) {
118 ast_log(
LOG_ERROR,
"Failed to set write format to SLINEAR for channel '%s'\n", chanName);
124 ast_log(
LOG_ERROR,
"Failed to set read format to SLINEAR for channel '%s'\n", chanName);
139 ast_log(
LOG_ERROR,
"Failed to restore write format for channel '%s'\n", chanName);
142 ast_log(
LOG_ERROR,
"Failed to restore read format for channel '%s'\n", chanName);
153 const char *chanName;
183 ast_log(
LOG_WARNING,
"Failed to receive frame from channel '%s' connected to AudioSocket server '%s'", chanName, server);
190 ast_log(
LOG_WARNING,
"Failed to forward frame from channel '%s' to AudioSocket server '%s'\n",
198 }
else if (outfd >= 0) {
207 " connected to channel '%s'\n", server, chanName);
212 ast_log(
LOG_WARNING,
"Failed to forward frame from AudioSocket server '%s' to channel '%s'\n", server, chanName);
241 "AudioSocket Application",
246 .
requires =
"res_audiosocket",
static int audiosocket_run(struct ast_channel *chan, const char *id, const int svc, const char *server)
static int audiosocket_exec(struct ast_channel *chan, const char *data)
#define MAX_WAIT_TIMEOUT_MSEC
static int load_module(void)
static int unload_module(void)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
static int hangup(void *data)
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
Generic File Format Support. Should be included by clients of the file handling routines....
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DRIVER
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
AudioSocket support functions.
const int ast_audiosocket_init(const int svc, const char *id)
Send the initial message to an AudioSocket server.
const int ast_audiosocket_send_frame(const int svc, const struct ast_frame *f)
Send an Asterisk audio frame to an AudioSocket server.
struct ast_frame * ast_audiosocket_receive_frame_with_hangup(const int svc, int *const hangup)
Receive an Asterisk frame from an AudioSocket server.
const int ast_audiosocket_connect(const char *server, struct ast_channel *chan)
Send the initial message to an AudioSocket server.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Main Channel structure associated with a channel.
Data structure associated with a single frame of data.
enum ast_frame_type frametype