Asterisk - The Open Source Telephony Project GIT-master-754dea3
|
AudioSocket support functions. More...
Go to the source code of this file.
Enumerations | |
enum | ast_audiosocket_msg_kind { AST_AUDIOSOCKET_KIND_HANGUP = 0x00 , AST_AUDIOSOCKET_KIND_UUID = 0x01 , AST_AUDIOSOCKET_KIND_DTMF = 0x03 , AST_AUDIOSOCKET_KIND_AUDIO = 0x10 , AST_AUDIOSOCKET_KIND_ERROR = 0xFF } |
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... | |
struct ast_frame * | ast_audiosocket_receive_frame_with_hangup (const int svc, int *const hangup) |
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.
Definition at line 40 of 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 100 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 181 of file res_audiosocket.c.
References AST_AUDIOSOCKET_KIND_UUID, ast_log, ast_strlen_zero(), buf, errno, 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 248 of file res_audiosocket.c.
References ast_audiosocket_receive_frame_with_hangup(), and NULL.
struct ast_frame * ast_audiosocket_receive_frame_with_hangup | ( | const int | svc, |
int *const | hangup | ||
) |
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. |
hangup | Will be true if the AudioSocket server requested the channel be hung up, otherwise false. Used as an out-parameter only, pass NULL if not needed. The function return value will always be NULL when true. |
A | ast_frame on success |
NULL | on error or when the hungup parameter is true. |
Definition at line 253 of file res_audiosocket.c.
References AST_AUDIOSOCKET_KIND_AUDIO, AST_AUDIOSOCKET_KIND_HANGUP, ast_format_slin, AST_FRAME_VOICE, ast_free, ast_frisolate, ast_log, ast_malloc, AST_MALLOCD_DATA, ast_frame::data, ast_frame::datalen, errno, ast_frame::frametype, hangup(), LOG_ERROR, LOG_WARNING, NULL, ast_frame::ptr, and ast_frame::samples.
Referenced by ast_audiosocket_receive_frame(), 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 210 of file res_audiosocket.c.
References AST_AUDIOSOCKET_KIND_AUDIO, AST_AUDIOSOCKET_KIND_DTMF, AST_FRAME_DTMF, AST_FRAME_VOICE, ast_log, buf, ast_frame::data, ast_frame::datalen, errno, ast_frame::frametype, ast_frame_subclass::integer, LOG_ERROR, LOG_WARNING, ast_frame::ptr, and ast_frame::subclass.
Referenced by audiosocket_run(), audiosocket_send_dtmf(), and audiosocket_write().