Asterisk - The Open Source Telephony Project
18.5.0
|
AudioSocket support functions. More...
Go to the source code of this file.
Functions | |
const int | ast_audiosocket_connect (const char *server, struct ast_channel *chan) |
Send the initial message to an AudioSocket server. More... | |
const int | ast_audiosocket_init (const int svc, const char *id) |
Send the initial message to an AudioSocket server. More... | |
struct ast_frame * | ast_audiosocket_receive_frame (const int svc) |
Receive an Asterisk frame from an AudioSocket server. More... | |
const int | ast_audiosocket_send_frame (const int svc, const struct ast_frame *f) |
Send an Asterisk audio frame to an AudioSocket server. More... | |
AudioSocket support functions.
Definition in file res_audiosocket.h.
const int ast_audiosocket_connect | ( | const char * | server, |
struct ast_channel * | chan | ||
) |
Send the initial message to an AudioSocket server.
server | The server address, including port. |
chan | An optional channel which will be put into autoservice during the connection period. If there is no channel to be autoserviced, pass NULL instead. |
socket | file descriptor for AudioSocket on success |
-1 | on error |
Definition at line 99 of file res_audiosocket.c.
References AST_AF_UNSPEC, ast_autoservice_start(), ast_autoservice_stop(), ast_channel_name(), ast_connect(), ast_free, ast_log, ast_sockaddr_port, ast_sockaddr_resolve(), ast_sockaddr_stringify(), ast_socket_nonblock, ast_strlen_zero, end, errno, handle_audiosocket_connection(), LOG_ERROR, LOG_WARNING, NULL, PARSE_PORT_REQUIRE, and ast_sockaddr::ss.
Referenced by audiosocket_exec(), and audiosocket_request().
const int ast_audiosocket_init | ( | const int | svc, |
const char * | id | ||
) |
Send the initial message to an AudioSocket server.
svc | The file descriptor of the network socket to the AudioSocket server. |
id | The UUID to send to the AudioSocket server to uniquely identify this connection. |
0 | on success |
-1 | on error |
Definition at line 180 of file res_audiosocket.c.
References ast_log, ast_strlen_zero, buf, LOG_ERROR, and LOG_WARNING.
Referenced by audiosocket_call(), and audiosocket_run().
struct ast_frame* ast_audiosocket_receive_frame | ( | const int | svc | ) |
Receive an Asterisk frame from an AudioSocket server.
This returned object is a pointer to an Asterisk frame which must be manually freed by the caller.
svc | The file descriptor of the network socket to the AudioSocket server. |
A | ast_frame on success |
NULL | on error |
Definition at line 231 of file res_audiosocket.c.
References ast_format_slin, AST_FRAME_VOICE, ast_free, ast_frisolate, ast_log, ast_malloc, AST_MALLOCD_DATA, ast_null_frame, ast_frame::data, ast_frame::datalen, errno, ast_frame::frametype, len(), LOG_ERROR, LOG_WARNING, NULL, ast_frame::ptr, and ast_frame::samples.
Referenced by audiosocket_read(), and audiosocket_run().
const int ast_audiosocket_send_frame | ( | const int | svc, |
const struct ast_frame * | f | ||
) |
Send an Asterisk audio frame to an AudioSocket server.
svc | The file descriptor of the network socket to the AudioSocket server. |
f | The Asterisk audio frame to send. |
0 | on success |
-1 | on error |
Definition at line 209 of file res_audiosocket.c.
References ast_log, buf, ast_frame::data, ast_frame::datalen, LOG_WARNING, and ast_frame::ptr.
Referenced by audiosocket_run(), and audiosocket_write().